force recompilation during initial timing test run

pull/2302/head
bohendo 10 months ago
parent 61242af57a
commit b362a3c057
No known key found for this signature in database
  1. 2
      slither/tools/mutator/__main__.py
  2. 6
      slither/tools/mutator/utils/testing_generated_mutant.py

@ -204,7 +204,7 @@ def main() -> (None): # pylint: disable=too-many-statements,too-many-branches,t
# run and time tests, abort if they're broken
start_time = time.time()
if not run_test_cmd(test_command, "", 600): # use a very long timeout this first time
if not run_test_cmd(test_command, "", 0): # no timeout during the first run
logger.error(red("Test suite fails before mutation, aborting"))
return

@ -34,13 +34,17 @@ def run_test_cmd(cmd: str, timeout: int | None, target_file: str | None) -> bool
elif "hardhat test" in cmd or "truffle test" in cmd and "--bail" not in cmd:
cmd += " --bail"
if timeout == 0:
# add --forrce to ensure all contracts are recompiled w/out using cache
cmd += " --force"
try:
result = subprocess.run(
cmd,
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
timeout=timeout,
timeout=timeout if timeout != 0 else None,
check=False # True: Raises a CalledProcessError if the return code is non-zero
)

Loading…
Cancel
Save