Skip to content

Commit

Permalink
Merge pull request #501 from fuzzland/fix-offchain-test
Browse files Browse the repository at this point in the history
Fix offchain tests
  • Loading branch information
jacob-chia authored Jun 4, 2024
2 parents a620cab + 08e063d commit 705b4af
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 180 deletions.
23 changes: 11 additions & 12 deletions integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,12 @@ def test_one(path):
start_time = time.time()
cmd = [
TIMEOUT_BIN,
"5s",
"10s",
"./target/release/ityfuzz",
"evm",
"-t",
f"'{path}/*'",
"-f",
"--panic-on-bug",
]
# exit(0)

Expand All @@ -72,30 +71,24 @@ def test_one(path):
if "taint" in path:
cmd.append("--sha3-bypass")


print(" ".join(cmd))

p = subprocess.run(
" ".join(cmd), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True
)

if (
b"target bug found" not in p.stderr
and b"bug() hit" not in p.stdout
and b"[typed_bug]" not in p.stdout
and b"[selfdestruct]" not in p.stdout
and b"[echidna_bug]" not in p.stdout
and b"Found violations!" not in p.stdout
):
if b"Found vulnerabilities!" not in p.stdout:
print("================ STDERR =================")
print(p.stderr.decode("utf-8"))
print("================ STDOUT =================")
print(p.stdout.decode("utf-8"))
print(f"=== Failed to fuzz {path}")
if b"panicked" in p.stderr or b"panicked" in p.stdout:
crashed_any = True
return False, path
else:
print(f"=== Success: {path}, Finished in {time.time() - start_time}s")
return True, path

# clean up
# os.system(f"rm -rf {path}/*.abi")
Expand Down Expand Up @@ -230,7 +223,13 @@ def build_flash_loan_v2_fuzzer():
if "offchain" in actions:
build_fuzzer()
with multiprocessing.Pool(3) as p:
p.map(test_one, glob.glob("./tests/evm/*", recursive=True))
results = p.map(test_one, glob.glob("./tests/evm/*", recursive=True))
failed = [result for result in results if result and not result[0]]
if failed:
print("❌ Failed tests:")
for f in failed:
print(f[1])
exit(1)

if "onchain" in actions:
build_flash_loan_v2_fuzzer()
Expand Down
15 changes: 0 additions & 15 deletions run_ityfuzz.sh

This file was deleted.

39 changes: 0 additions & 39 deletions tests/evm/flashloan/test.sol

This file was deleted.

9 changes: 0 additions & 9 deletions tests/evm/flashloan/token_config.json

This file was deleted.

1 change: 0 additions & 1 deletion tests/evm/multi-contract/X.address

This file was deleted.

22 changes: 0 additions & 22 deletions tests/evm/multi-contract/test.sol

This file was deleted.

7 changes: 0 additions & 7 deletions tests/evm/multi-contract/x.sol

This file was deleted.

51 changes: 0 additions & 51 deletions tests/evm/scribble/test.flat.sol

This file was deleted.

1 change: 0 additions & 1 deletion tests/evm/taints-2/main.address

This file was deleted.

1 change: 0 additions & 1 deletion tests/evm/taints-2/sb.address

This file was deleted.

22 changes: 0 additions & 22 deletions tests/evm/taints-2/test.sol

This file was deleted.

0 comments on commit 705b4af

Please sign in to comment.