mirror of
https://github.com/kmc7468/cs420.git
synced 2025-12-15 06:58:50 +00:00
Fix hw1 fuzzer
This commit is contained in:
2
tests/.gitignore
vendored
2
tests/.gitignore
vendored
@@ -1,4 +1,4 @@
|
||||
/platform.info
|
||||
/csmith-*
|
||||
/test*.c*
|
||||
/test*.c
|
||||
/reduce-criteria.sh
|
||||
|
||||
@@ -22,13 +22,18 @@ REPLACE_DICT = {
|
||||
"__restrict": "",
|
||||
"long __undefined;": "",
|
||||
"return 0;": "return crc32_context % 128;",
|
||||
r"__attribute__ \(\(.*\)\)": "",
|
||||
r"__attribute__\s*\(\(.*\)\)": "",
|
||||
"_Float128": "long double",
|
||||
"union": "struct",
|
||||
r"enum\s*\{[^\}]*\};": "",
|
||||
r"enum[\w\s]*\{[^\}]*\};": "",
|
||||
"const char \*const sys_errlist\[\];": "",
|
||||
r"[^\n]*printf[^;]*;": "",
|
||||
r"[^\n]*scanf[^;]*;": "",
|
||||
" restrict": "",
|
||||
"inline ": "",
|
||||
"_Nullable": "",
|
||||
"\"g_\w*\", ": "",
|
||||
"char\* vname, ": "",
|
||||
}
|
||||
CSMITH_DIR = "csmith-2.3.0"
|
||||
|
||||
@@ -172,7 +177,8 @@ def creduce(tests_dir, fuzz_arg):
|
||||
raise e
|
||||
|
||||
try:
|
||||
args = ["creduce", "./reduce-criteria.sh", "test_reduced.c"]
|
||||
# --tidy: Do not make a backup copy of each file to reduce as file.orig
|
||||
args = ["creduce", "--tidy", "./reduce-criteria.sh", "test_reduced.c"]
|
||||
proc = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd=tests_dir)
|
||||
(out, err) = proc.communicate()
|
||||
if proc.returncode != 0:
|
||||
|
||||
@@ -1,3 +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 --bin fuzz -- $FUZZ_ARG test_reduced.c
|
||||
|
||||
Reference in New Issue
Block a user