mirror of
https://github.com/kmc7468/cs420.git
synced 2025-12-15 06:58:50 +00:00
Fix hw1 fuzzer again
This commit is contained in:
@@ -26,6 +26,7 @@ REPLACE_DICT = {
|
||||
"_Float128": "long double",
|
||||
"union": "struct",
|
||||
r"enum[\w\s]*\{[^\}]*\};": "",
|
||||
r"typedef enum[\w\s]*\{[^;]*;[\s_A-Z]*;": "",
|
||||
"const char \*const sys_errlist\[\];": "",
|
||||
r"[^\n]*printf[^;]*;": "",
|
||||
r"[^\n]*scanf[^;]*;": "",
|
||||
@@ -191,14 +192,6 @@ def creduce(tests_dir, fuzz_arg):
|
||||
def fuzz(tests_dir, fuzz_arg, num_iter):
|
||||
csmith_bin, csmith_inc = install_csmith(tests_dir)
|
||||
try:
|
||||
print("Building KECC..")
|
||||
try:
|
||||
proc = subprocess.Popen(["cargo", "build", "--release"], cwd=tests_dir)
|
||||
proc.communicate()
|
||||
except subprocess.TimeoutExpired as e:
|
||||
proc.kill()
|
||||
raise e
|
||||
|
||||
if num_iter is None:
|
||||
print("Fuzzing with infinitely many test cases. Please press [ctrl+C] to break.")
|
||||
iterator = itertools.count(0)
|
||||
@@ -247,6 +240,15 @@ if __name__ == "__main__":
|
||||
raise Exception("Specify fuzzing argument")
|
||||
|
||||
tests_dir = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
print("Building KECC..")
|
||||
try:
|
||||
proc = subprocess.Popen(["cargo", "build", "--release"], cwd=tests_dir)
|
||||
proc.communicate()
|
||||
except subprocess.TimeoutExpired as e:
|
||||
proc.kill()
|
||||
raise e
|
||||
|
||||
if args.reduce:
|
||||
creduce(tests_dir, fuzz_arg)
|
||||
else:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
cargo run --manifest-path $PROJECT_DIR/Cargo.toml --release -- -p test_reduced.c >/dev/null 2>&1 &&\
|
||||
cargo run --manifest-path $PROJECT_DIR/Cargo.toml --release -- --parse test_reduced.c >/dev/null 2>&1 &&\
|
||||
! cargo run --manifest-path $PROJECT_DIR/Cargo.toml --release --bin fuzz -- $FUZZ_ARG test_reduced.c
|
||||
|
||||
Reference in New Issue
Block a user