mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-17 04:18:06 +00:00
test: skip afl-fuzz test if too few locations were instrumented
This commit is contained in:
@ -25,6 +25,7 @@ test "$SYS" = "i686" -o "$SYS" = "x86_64" -o "$SYS" = "amd64" -o "$SYS" = "i86pc
|
|||||||
CODE=1
|
CODE=1
|
||||||
}
|
}
|
||||||
rm -f test-instr.plain.0 test-instr.plain.1
|
rm -f test-instr.plain.0 test-instr.plain.1
|
||||||
|
SKIP=
|
||||||
TUPLES=`echo 1|../afl-showmap -m ${MEM_LIMIT} -o /dev/null -- ./test-instr.plain 2>&1 | grep Captur | awk '{print$3}'`
|
TUPLES=`echo 1|../afl-showmap -m ${MEM_LIMIT} -o /dev/null -- ./test-instr.plain 2>&1 | grep Captur | awk '{print$3}'`
|
||||||
test "$TUPLES" -gt 2 -a "$TUPLES" -lt 12 && {
|
test "$TUPLES" -gt 2 -a "$TUPLES" -lt 12 && {
|
||||||
$ECHO "$GREEN[+] ${AFL_GCC} run reported $TUPLES instrumented locations which is fine"
|
$ECHO "$GREEN[+] ${AFL_GCC} run reported $TUPLES instrumented locations which is fine"
|
||||||
@ -32,6 +33,8 @@ test "$SYS" = "i686" -o "$SYS" = "x86_64" -o "$SYS" = "amd64" -o "$SYS" = "i86pc
|
|||||||
$ECHO "$RED[!] ${AFL_GCC} instrumentation produces weird numbers: $TUPLES"
|
$ECHO "$RED[!] ${AFL_GCC} instrumentation produces weird numbers: $TUPLES"
|
||||||
CODE=1
|
CODE=1
|
||||||
}
|
}
|
||||||
|
test "$TUPLES" -lt 4 && SKIP=1
|
||||||
|
true # this is needed because of the test above
|
||||||
} || {
|
} || {
|
||||||
$ECHO "$RED[!] ${AFL_GCC} failed"
|
$ECHO "$RED[!] ${AFL_GCC} failed"
|
||||||
echo CUT------------------------------------------------------------------CUT
|
echo CUT------------------------------------------------------------------CUT
|
||||||
@ -65,18 +68,20 @@ test "$SYS" = "i686" -o "$SYS" = "x86_64" -o "$SYS" = "amd64" -o "$SYS" = "i86pc
|
|||||||
}) || {
|
}) || {
|
||||||
mkdir -p in
|
mkdir -p in
|
||||||
echo 0 > in/in
|
echo 0 > in/in
|
||||||
$ECHO "$GREY[*] running afl-fuzz for ${AFL_GCC}, this will take approx 10 seconds"
|
test -z "$SKIP" && {
|
||||||
{
|
$ECHO "$GREY[*] running afl-fuzz for ${AFL_GCC}, this will take approx 10 seconds"
|
||||||
../afl-fuzz -V10 -m ${MEM_LIMIT} -i in -o out -- ./test-instr.plain >>errors 2>&1
|
{
|
||||||
} >>errors 2>&1
|
../afl-fuzz -V10 -m ${MEM_LIMIT} -i in -o out -- ./test-instr.plain >>errors 2>&1
|
||||||
test -n "$( ls out/default/queue/id:000002* 2>/dev/null )" && {
|
} >>errors 2>&1
|
||||||
$ECHO "$GREEN[+] afl-fuzz is working correctly with ${AFL_GCC}"
|
test -n "$( ls out/default/queue/id:000002* 2>/dev/null )" && {
|
||||||
} || {
|
$ECHO "$GREEN[+] afl-fuzz is working correctly with ${AFL_GCC}"
|
||||||
echo CUT------------------------------------------------------------------CUT
|
} || {
|
||||||
cat errors
|
echo CUT------------------------------------------------------------------CUT
|
||||||
echo CUT------------------------------------------------------------------CUT
|
cat errors
|
||||||
$ECHO "$RED[!] afl-fuzz is not working correctly with ${AFL_GCC}"
|
echo CUT------------------------------------------------------------------CUT
|
||||||
CODE=1
|
$ECHO "$RED[!] afl-fuzz is not working correctly with ${AFL_GCC}"
|
||||||
|
CODE=1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
echo 000000000000000000000000 > in/in2
|
echo 000000000000000000000000 > in/in2
|
||||||
echo 111 > in/in3
|
echo 111 > in/in3
|
||||||
@ -121,6 +126,7 @@ test "$SYS" = "i686" -o "$SYS" = "x86_64" -o "$SYS" = "amd64" -o "$SYS" = "i86pc
|
|||||||
}
|
}
|
||||||
if [ ${AFL_GCC} = "afl-gcc" ] ; then AFL_GCC=afl-clang ; else AFL_GCC=afl-gcc ; fi
|
if [ ${AFL_GCC} = "afl-gcc" ] ; then AFL_GCC=afl-clang ; else AFL_GCC=afl-gcc ; fi
|
||||||
$ECHO "$BLUE[*] Testing: ${AFL_GCC}, afl-showmap, afl-fuzz, afl-cmin and afl-tmin"
|
$ECHO "$BLUE[*] Testing: ${AFL_GCC}, afl-showmap, afl-fuzz, afl-cmin and afl-tmin"
|
||||||
|
SKIP=
|
||||||
test -e ../${AFL_GCC} -a -e ../afl-showmap -a -e ../afl-fuzz && {
|
test -e ../${AFL_GCC} -a -e ../afl-showmap -a -e ../afl-fuzz && {
|
||||||
../${AFL_GCC} -o test-instr.plain ../test-instr.c > /dev/null 2>&1
|
../${AFL_GCC} -o test-instr.plain ../test-instr.c > /dev/null 2>&1
|
||||||
AFL_HARDEN=1 ../${AFL_GCC} -o test-compcov.harden test-compcov.c > /dev/null 2>&1
|
AFL_HARDEN=1 ../${AFL_GCC} -o test-compcov.harden test-compcov.c > /dev/null 2>&1
|
||||||
@ -147,6 +153,8 @@ test "$SYS" = "i686" -o "$SYS" = "x86_64" -o "$SYS" = "amd64" -o "$SYS" = "i86pc
|
|||||||
$ECHO "$RED[!] ${AFL_GCC} instrumentation produces weird numbers: $TUPLES"
|
$ECHO "$RED[!] ${AFL_GCC} instrumentation produces weird numbers: $TUPLES"
|
||||||
CODE=1
|
CODE=1
|
||||||
}
|
}
|
||||||
|
test "$TUPLES" -lt 4 && SKIP=1
|
||||||
|
true # this is needed because of the test above
|
||||||
} || {
|
} || {
|
||||||
$ECHO "$RED[!] ${AFL_GCC} failed"
|
$ECHO "$RED[!] ${AFL_GCC} failed"
|
||||||
echo CUT------------------------------------------------------------------CUT
|
echo CUT------------------------------------------------------------------CUT
|
||||||
@ -180,18 +188,20 @@ test "$SYS" = "i686" -o "$SYS" = "x86_64" -o "$SYS" = "amd64" -o "$SYS" = "i86pc
|
|||||||
}) || {
|
}) || {
|
||||||
mkdir -p in
|
mkdir -p in
|
||||||
echo 0 > in/in
|
echo 0 > in/in
|
||||||
$ECHO "$GREY[*] running afl-fuzz for ${AFL_GCC}, this will take approx 10 seconds"
|
test -z "$SKIP" && {
|
||||||
{
|
$ECHO "$GREY[*] running afl-fuzz for ${AFL_GCC}, this will take approx 10 seconds"
|
||||||
../afl-fuzz -V10 -m ${MEM_LIMIT} -i in -o out -- ./test-instr.plain >>errors 2>&1
|
{
|
||||||
} >>errors 2>&1
|
../afl-fuzz -V10 -m ${MEM_LIMIT} -i in -o out -- ./test-instr.plain >>errors 2>&1
|
||||||
test -n "$( ls out/default/queue/id:000002* 2>/dev/null )" && {
|
} >>errors 2>&1
|
||||||
$ECHO "$GREEN[+] afl-fuzz is working correctly with ${AFL_GCC}"
|
test -n "$( ls out/default/queue/id:000002* 2>/dev/null )" && {
|
||||||
} || {
|
$ECHO "$GREEN[+] afl-fuzz is working correctly with ${AFL_GCC}"
|
||||||
echo CUT------------------------------------------------------------------CUT
|
} || {
|
||||||
cat errors
|
echo CUT------------------------------------------------------------------CUT
|
||||||
echo CUT------------------------------------------------------------------CUT
|
cat errors
|
||||||
$ECHO "$RED[!] afl-fuzz is not working correctly with ${AFL_GCC}"
|
echo CUT------------------------------------------------------------------CUT
|
||||||
CODE=1
|
$ECHO "$RED[!] afl-fuzz is not working correctly with ${AFL_GCC}"
|
||||||
|
CODE=1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
echo 000000000000000000000000 > in/in2
|
echo 000000000000000000000000 > in/in2
|
||||||
echo AAA > in/in3
|
echo AAA > in/in3
|
||||||
|
@ -26,6 +26,8 @@ test -e ../afl-gcc-fast -a -e ../afl-compiler-rt.o && {
|
|||||||
$ECHO "$YELLOW[-] this is a known issue in gcc, not afl++. It is not flagged as an error because travis builds would all fail otherwise :-("
|
$ECHO "$YELLOW[-] this is a known issue in gcc, not afl++. It is not flagged as an error because travis builds would all fail otherwise :-("
|
||||||
#CODE=1
|
#CODE=1
|
||||||
}
|
}
|
||||||
|
test "$TUPLES" -lt 4 && SKIP=1
|
||||||
|
true
|
||||||
}
|
}
|
||||||
} || {
|
} || {
|
||||||
$ECHO "$RED[!] gcc_plugin instrumentation failed"
|
$ECHO "$RED[!] gcc_plugin instrumentation failed"
|
||||||
@ -60,22 +62,24 @@ test -e ../afl-gcc-fast -a -e ../afl-compiler-rt.o && {
|
|||||||
CODE=1
|
CODE=1
|
||||||
true
|
true
|
||||||
}) || {
|
}) || {
|
||||||
mkdir -p in
|
test -z "$SKIP" && {
|
||||||
echo 0 > in/in
|
mkdir -p in
|
||||||
$ECHO "$GREY[*] running afl-fuzz for gcc_plugin, this will take approx 10 seconds"
|
echo 0 > in/in
|
||||||
{
|
$ECHO "$GREY[*] running afl-fuzz for gcc_plugin, this will take approx 10 seconds"
|
||||||
../afl-fuzz -V10 -m ${MEM_LIMIT} -i in -o out -- ./test-instr.plain.gccpi >>errors 2>&1
|
{
|
||||||
} >>errors 2>&1
|
../afl-fuzz -V10 -m ${MEM_LIMIT} -i in -o out -- ./test-instr.plain.gccpi >>errors 2>&1
|
||||||
test -n "$( ls out/default/queue/id:000002* 2>/dev/null )" && {
|
} >>errors 2>&1
|
||||||
$ECHO "$GREEN[+] afl-fuzz is working correctly with gcc_plugin"
|
test -n "$( ls out/default/queue/id:000002* 2>/dev/null )" && {
|
||||||
} || {
|
$ECHO "$GREEN[+] afl-fuzz is working correctly with gcc_plugin"
|
||||||
echo CUT------------------------------------------------------------------CUT
|
} || {
|
||||||
cat errors
|
echo CUT------------------------------------------------------------------CUT
|
||||||
echo CUT------------------------------------------------------------------CUT
|
cat errors
|
||||||
$ECHO "$RED[!] afl-fuzz is not working correctly with gcc_plugin"
|
echo CUT------------------------------------------------------------------CUT
|
||||||
CODE=1
|
$ECHO "$RED[!] afl-fuzz is not working correctly with gcc_plugin"
|
||||||
|
CODE=1
|
||||||
|
}
|
||||||
|
rm -rf in out errors
|
||||||
}
|
}
|
||||||
rm -rf in out errors
|
|
||||||
}
|
}
|
||||||
rm -f test-instr.plain.gccpi
|
rm -f test-instr.plain.gccpi
|
||||||
|
|
||||||
|
@ -31,6 +31,8 @@ test -e ../afl-clang-fast -a -e ../split-switches-pass.so && {
|
|||||||
$ECHO "$RED[!] llvm_mode instrumentation produces weird numbers: $TUPLES"
|
$ECHO "$RED[!] llvm_mode instrumentation produces weird numbers: $TUPLES"
|
||||||
CODE=1
|
CODE=1
|
||||||
}
|
}
|
||||||
|
test "$TUPLES" -lt 4 && SKIP=1
|
||||||
|
true
|
||||||
}
|
}
|
||||||
} || {
|
} || {
|
||||||
$ECHO "$RED[!] llvm_mode instrumentation failed"
|
$ECHO "$RED[!] llvm_mode instrumentation failed"
|
||||||
@ -66,18 +68,20 @@ test -e ../afl-clang-fast -a -e ../split-switches-pass.so && {
|
|||||||
}) || {
|
}) || {
|
||||||
mkdir -p in
|
mkdir -p in
|
||||||
echo 0 > in/in
|
echo 0 > in/in
|
||||||
$ECHO "$GREY[*] running afl-fuzz for llvm_mode, this will take approx 10 seconds"
|
test -z "$SKIP" && {
|
||||||
{
|
$ECHO "$GREY[*] running afl-fuzz for llvm_mode, this will take approx 10 seconds"
|
||||||
../afl-fuzz -V10 -m ${MEM_LIMIT} -i in -o out -- ./test-instr.plain >>errors 2>&1
|
{
|
||||||
} >>errors 2>&1
|
../afl-fuzz -V10 -m ${MEM_LIMIT} -i in -o out -- ./test-instr.plain >>errors 2>&1
|
||||||
test -n "$( ls out/default/queue/id:000002* 2>/dev/null )" && {
|
} >>errors 2>&1
|
||||||
$ECHO "$GREEN[+] afl-fuzz is working correctly with llvm_mode"
|
test -n "$( ls out/default/queue/id:000002* 2>/dev/null )" && {
|
||||||
} || {
|
$ECHO "$GREEN[+] afl-fuzz is working correctly with llvm_mode"
|
||||||
echo CUT------------------------------------------------------------------CUT
|
} || {
|
||||||
cat errors
|
echo CUT------------------------------------------------------------------CUT
|
||||||
echo CUT------------------------------------------------------------------CUT
|
cat errors
|
||||||
$ECHO "$RED[!] afl-fuzz is not working correctly with llvm_mode"
|
echo CUT------------------------------------------------------------------CUT
|
||||||
CODE=1
|
$ECHO "$RED[!] afl-fuzz is not working correctly with llvm_mode"
|
||||||
|
CODE=1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
test "$SYS" = "i686" -o "$SYS" = "x86_64" -o "$SYS" = "amd64" -o "$SYS" = "i86pc" || {
|
test "$SYS" = "i686" -o "$SYS" = "x86_64" -o "$SYS" = "amd64" -o "$SYS" = "i86pc" || {
|
||||||
echo 000000000000000000000000 > in/in2
|
echo 000000000000000000000000 > in/in2
|
||||||
|
@ -90,6 +90,7 @@ unset AFL_CUSTOM_MUTATOR_LIBRARY
|
|||||||
unset AFL_PYTHON_MODULE
|
unset AFL_PYTHON_MODULE
|
||||||
unset AFL_PRELOAD
|
unset AFL_PRELOAD
|
||||||
unset LD_PRELOAD
|
unset LD_PRELOAD
|
||||||
|
unset SKIP
|
||||||
|
|
||||||
rm -rf in in2 out
|
rm -rf in in2 out
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user