diff --git a/.circleci/config.yml b/.circleci/config.yml index 4b0eea21..1d5a2031 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -12,6 +12,7 @@ jobs: # Basic testing of a new commit to any branch. test: <<: *defaults + parallelism: 4 steps: - checkout: path: /home/mythril @@ -50,7 +51,9 @@ jobs: - run: name: Unit-testing - command: tox + command: | + TESTFILES=$(circleci tests glob tests/**/*test.py | circleci tests split --split-by=timings) + tox -- $TESTFILES working_directory: /home/mythril no_output_timeout: 10m environment: diff --git a/Dockerfile b/Dockerfile index 5edb5ebd..4931136a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -123,9 +123,9 @@ print("\n".join(str(v) for v in solcx.get_installed_solc_versions())) # Check myth can run myth version myth function-to-hash 'function transfer(address _to, uint256 _value) public returns (bool success)' -myth analyze /solidity_examples/timelock.sol > timelock.log || true -grep 'SWC ID: 116' timelock.log || { - error "Failed to detect SWC ID: 116 in timelock.sol"; +myth analyze /solidity_examples/origin.sol -t 1 > origin.log || true +grep 'SWC ID: 115' origin.log || { + error "Failed to detect SWC ID: 115 in origin.sol"; exit 1 } diff --git a/tests/cli_tests/test_cli_opts.py b/tests/cli_tests/cli_opts_test.py similarity index 100% rename from tests/cli_tests/test_cli_opts.py rename to tests/cli_tests/cli_opts_test.py diff --git a/tests/disassembler/asm.py b/tests/disassembler/asm_test.py similarity index 100% rename from tests/disassembler/asm.py rename to tests/disassembler/asm_test.py diff --git a/tests/disassembler/disassembly.py b/tests/disassembler/disassembly_test.py similarity index 96% rename from tests/disassembler/disassembly.py rename to tests/disassembler/disassembly_test.py index 8b5075df..a86fa7d6 100644 --- a/tests/disassembler/disassembly.py +++ b/tests/disassembler/disassembly_test.py @@ -41,7 +41,7 @@ def test_get_function_info_multiple_names(mocker): ) # Assert - assert function_name == "**ambiguous** function_name" + assert function_name == "function_name or another_name" def test_get_function_info_no_names(mocker): diff --git a/tests/instructions/test_basefee.py b/tests/instructions/basefee_test.py similarity index 100% rename from tests/instructions/test_basefee.py rename to tests/instructions/basefee_test.py diff --git a/tests/instructions/create2_test.py b/tests/instructions/create2_test.py index 1cba44f4..eecc5ce6 100644 --- a/tests/instructions/create2_test.py +++ b/tests/instructions/create2_test.py @@ -4,6 +4,7 @@ from mythril.laser.ethereum.state.environment import Environment from mythril.laser.ethereum.state.machine_state import MachineState from mythril.laser.ethereum.state.global_state import GlobalState from mythril.laser.ethereum.state.world_state import WorldState +from mythril.laser.ethereum.time_handler import time_handler from mythril.laser.ethereum.instructions import Instruction from mythril.laser.ethereum.transaction.transaction_models import ( MessageCallTransaction, @@ -57,6 +58,7 @@ def test_create2(): ] og_state.mstate.memory.extend(100) og_state.mstate.memory[0:6] = [96] * 6 + time_handler.start_execution(10) instruction = Instruction("create2", dynamic_loader=None) # Act + Assert with pytest.raises(TransactionStartSignal) as t: diff --git a/tests/integration_tests/test_safe_functions.py b/tests/integration_tests/safe_functions_test.py similarity index 100% rename from tests/integration_tests/test_safe_functions.py rename to tests/integration_tests/safe_functions_test.py diff --git a/tests/integration_tests/test_solc_settings.py b/tests/integration_tests/solc_settings_test.py similarity index 100% rename from tests/integration_tests/test_solc_settings.py rename to tests/integration_tests/solc_settings_test.py diff --git a/tests/integration_tests/test_src_mapping.py b/tests/integration_tests/src_mapping_test.py similarity index 100% rename from tests/integration_tests/test_src_mapping.py rename to tests/integration_tests/src_mapping_test.py diff --git a/tests/laser/Precompiles/test_blake2.py b/tests/laser/Precompiles/blake2_test.py similarity index 100% rename from tests/laser/Precompiles/test_blake2.py rename to tests/laser/Precompiles/blake2_test.py diff --git a/tests/laser/Precompiles/test_ec_add.py b/tests/laser/Precompiles/ec_add_test.py similarity index 100% rename from tests/laser/Precompiles/test_ec_add.py rename to tests/laser/Precompiles/ec_add_test.py diff --git a/tests/laser/Precompiles/test_ecrecover.py b/tests/laser/Precompiles/ecrecover_test.py similarity index 100% rename from tests/laser/Precompiles/test_ecrecover.py rename to tests/laser/Precompiles/ecrecover_test.py diff --git a/tests/laser/Precompiles/test_elliptic_curves.py b/tests/laser/Precompiles/elliptic_curves_test.py similarity index 100% rename from tests/laser/Precompiles/test_elliptic_curves.py rename to tests/laser/Precompiles/elliptic_curves_test.py diff --git a/tests/laser/Precompiles/test_elliptic_mul.py b/tests/laser/Precompiles/elliptic_mul_test.py similarity index 100% rename from tests/laser/Precompiles/test_elliptic_mul.py rename to tests/laser/Precompiles/elliptic_mul_test.py diff --git a/tests/laser/Precompiles/test_identity.py b/tests/laser/Precompiles/identity_test.py similarity index 100% rename from tests/laser/Precompiles/test_identity.py rename to tests/laser/Precompiles/identity_test.py diff --git a/tests/laser/Precompiles/test_mod_exp.py b/tests/laser/Precompiles/mod_exp_test.py similarity index 100% rename from tests/laser/Precompiles/test_mod_exp.py rename to tests/laser/Precompiles/mod_exp_test.py diff --git a/tests/laser/Precompiles/test_ripemd.py b/tests/laser/Precompiles/ripemd_test.py similarity index 100% rename from tests/laser/Precompiles/test_ripemd.py rename to tests/laser/Precompiles/ripemd_test.py diff --git a/tests/laser/Precompiles/test_sha256.py b/tests/laser/Precompiles/sha256_test.py similarity index 100% rename from tests/laser/Precompiles/test_sha256.py rename to tests/laser/Precompiles/sha256_test.py diff --git a/tests/laser/strategy/test_beam.py b/tests/laser/strategy/beam_test.py similarity index 100% rename from tests/laser/strategy/test_beam.py rename to tests/laser/strategy/beam_test.py diff --git a/tests/laser/strategy/test_loop_bound.py b/tests/laser/strategy/loop_bound_test.py similarity index 100% rename from tests/laser/strategy/test_loop_bound.py rename to tests/laser/strategy/loop_bound_test.py diff --git a/tests/laser/test_transaction.py b/tests/laser/transaction_test.py similarity index 97% rename from tests/laser/test_transaction.py rename to tests/laser/transaction_test.py index 294c2164..f66d9b9c 100644 --- a/tests/laser/test_transaction.py +++ b/tests/laser/transaction_test.py @@ -2,6 +2,7 @@ from mythril.disassembler.disassembly import Disassembly from mythril.laser.ethereum import svm from mythril.laser.ethereum.state.account import Account from mythril.laser.ethereum.state.world_state import WorldState +from mythril.support.support_args import args import mythril.laser.ethereum.cfg as cfg @@ -24,7 +25,7 @@ def test_intercontract_call(): callee_account = Account(callee_address, callee_code, contract_name="Callee") world_state.put_account(callee_account) world_state.put_account(caller_account) - + args.pruning_factor = 1 laser = svm.LaserEVM() # Act