mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Isolate test cases from all tests and store under hash.
This commit is contained in:
parent
b28aefe28c
commit
b18aea315d
@ -8,10 +8,12 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
import re
|
import re
|
||||||
|
import os
|
||||||
|
import hashlib
|
||||||
|
from os.path import join
|
||||||
|
|
||||||
def extract_cases(path):
|
def extract_cases(path):
|
||||||
lines = open(path).read().splitlines()
|
lines = open(path, 'rb').read().splitlines()
|
||||||
|
|
||||||
inside = False
|
inside = False
|
||||||
delimiter = ''
|
delimiter = ''
|
||||||
@ -33,16 +35,14 @@ def extract_cases(path):
|
|||||||
return tests
|
return tests
|
||||||
|
|
||||||
|
|
||||||
def write_cases(tests, start=0):
|
def write_cases(tests):
|
||||||
for i, test in enumerate(tests, start=start):
|
for test in tests:
|
||||||
open('test%d.sol' % i, 'w').write(test)
|
open('test_%s.sol' % hashlib.sha256(test).hexdigest(), 'wb').write(test)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
files = sys.argv[1:]
|
path = sys.argv[1]
|
||||||
|
|
||||||
i = 0
|
for root, dir, files in os.walk(path):
|
||||||
for path in files:
|
for f in files:
|
||||||
cases = extract_cases(path)
|
cases = extract_cases(join(root, f))
|
||||||
write_cases(cases, start=i)
|
write_cases(cases)
|
||||||
i += len(cases)
|
|
||||||
|
@ -73,7 +73,7 @@ TMPDIR=$(mktemp -d)
|
|||||||
cd "$REPO_ROOT"
|
cd "$REPO_ROOT"
|
||||||
REPO_ROOT=$(pwd) # make it absolute
|
REPO_ROOT=$(pwd) # make it absolute
|
||||||
cd "$TMPDIR"
|
cd "$TMPDIR"
|
||||||
"$REPO_ROOT"/scripts/isolate_tests.py "$REPO_ROOT"/test/contracts/* "$REPO_ROOT"/test/libsolidity/*EndToEnd*
|
"$REPO_ROOT"/scripts/isolate_tests.py "$REPO_ROOT"/test/
|
||||||
for f in *.sol
|
for f in *.sol
|
||||||
do
|
do
|
||||||
"$REPO_ROOT"/build/test/solfuzzer < "$f"
|
"$REPO_ROOT"/build/test/solfuzzer < "$f"
|
||||||
|
Loading…
Reference in New Issue
Block a user