|
| 1 | +import json |
| 2 | +import os |
| 3 | +import sys |
| 4 | +import ethereum.testutils as testutils |
| 5 | +from ethereum.slogging import get_logger, configure_logging |
| 6 | +logger = get_logger() |
| 7 | +# customize VM log output to your needs |
| 8 | +# hint: use 'py.test' with the '-s' option to dump logs to the console |
| 9 | + |
| 10 | + |
| 11 | +def do_test_vm(filename, testname=None, testdata=None, limit=99999999): |
| 12 | + logger.debug('running test:%r in %r' % (testname, filename)) |
| 13 | + testutils.check_vm_test(testutils.fixture_to_bytes(testdata)) |
| 14 | + |
| 15 | + |
| 16 | +failing = [ |
| 17 | + 'vmSystemOperationsTest.json_ABAcallsSuicide1', |
| 18 | + 'vmSystemOperationsTest.json_ABAcalls0', |
| 19 | + 'vmSystemOperationsTest.json_ABAcallsSuicide0', |
| 20 | + 'vmSystemOperationsTest.json_callcodeToReturn1', |
| 21 | + 'vmEnvironmentalInfoTest.json_env1', |
| 22 | + 'vmSystemOperationsTest.json_createNameRegistrator', |
| 23 | + 'vmSystemOperationsTest.json_CallRecursiveBomb0', |
| 24 | + 'vmSystemOperationsTest.json_CallToReturn1', |
| 25 | + 'vmSystemOperationsTest.json_CallToPrecompiledContract', |
| 26 | + 'vmSystemOperationsTest.json_CallToNameRegistrator0', |
| 27 | + 'vmSystemOperationsTest.json_callcodeToNameRegistrator0' |
| 28 | +] |
| 29 | +failing = [x.split('_', 1)[-1] for x in failing] # testnames |
| 30 | + |
| 31 | + |
| 32 | +fixtures = testutils.get_tests_from_file_or_dir( |
| 33 | + os.path.join(testutils.fixture_path, 'VMTests')) |
| 34 | + |
| 35 | + |
| 36 | +def mk_test_func(filename, testname, testdata): |
| 37 | + return lambda: do_test_vm(filename, testname, testdata) |
| 38 | + |
| 39 | + |
| 40 | +for filename, tests in list(fixtures.items()): |
| 41 | + for testname, testdata in list(tests.items()): |
| 42 | + func_name = 'test_%s_%s' % (filename, testname) |
| 43 | + if testname not in failing: |
| 44 | + continue |
| 45 | + globals()[func_name] = mk_test_func(filename, testname, testdata) |
0 commit comments