Skip to content

Commit

Permalink
fix test-performance.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
vanhauser-thc committed Oct 6, 2020
1 parent fd4efd0 commit 2314207
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
3 changes: 2 additions & 1 deletion TODO.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# TODO list for AFL++

## Roadmap 2.68+
## Roadmap 3.00+

- AFL_MAP_SIZE for qemu_mode and unicorn_mode
- CPU affinity for many cores? There seems to be an issue > 96 cores
- afl-plot to support multiple plot_data
- afl_custom_fuzz_splice_optin()
- intel-pt tracer
- https://github.com/zyingp/desockmulti ?

## Further down the road

Expand Down
15 changes: 11 additions & 4 deletions test/test-performance.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,19 @@
# you can set the AFL_PERFORMANCE_FILE environment variable:
FILE=$AFL_PERFORMANCE_FILE
# otherwise we use ~/.afl_performance
test -z "$FILE" && FILE=~/.afl_performance
test -z "$FILE" && FILE=.afl_performance

test -e $FILE || {
echo Warning: This script measure the performance of afl++ and saves the result for future comparisons into $FILE
echo Press ENTER to continue or CONTROL-C to abort
read IN
}

test -e ./test-performance.sh || { echo Error: this script must be run from the directory in which it lies. ; exit 1 ; }

export AFL_QUIET=1
export AFL_PATH=`pwd`/..

unset AFL_EXIT_WHEN_DONE
unset AFL_SKIP_CPUFREQ
unset AFL_DEBUG
Expand All @@ -36,8 +40,10 @@ test -e /usr/local/bin/opt && {
# afl-gcc does not work there
test `uname -s` = 'Darwin' -o `uname -s` = 'FreeBSD' && {
AFL_GCC=afl-clang
CC=clang
} || {
AFL_GCC=afl-gcc
CC=gcc
}

ECHO="printf %b\\n"
Expand All @@ -57,9 +63,9 @@ RED="\\033[0;31m"
YELLOW="\\033[1;93m"
RESET="\\033[0m"

MEM_LIMIT=150
MEM_LIMIT=500

>> $FILE || { echo Error: can not write to $FILE ; exit 1 ; }
touch $FILE || { echo Error: can not write to $FILE ; exit 1 ; }

echo Warning: this script is setting performance parameters with afl-system-config
sleep 1
Expand Down Expand Up @@ -144,7 +150,7 @@ test -e ../afl-gcc-fast -a -e ../afl-fuzz && {
$ECHO "$BLUE[*] Testing: qemu_mode"
QEMU=x
test -e ../afl-qemu-trace -a -e ../afl-fuzz && {
cc -o test-instr.qemu ../test-instr.c > /dev/null 2>&1
$CC -o test-instr.qemu ../test-instr.c > /dev/null 2>&1
test -e test-instr.qemu && {
$ECHO "$GREEN[+] native compilation with cc succeeded"
mkdir -p in
Expand All @@ -157,6 +163,7 @@ test -e ../afl-qemu-trace -a -e ../afl-fuzz && {
QEMU=`grep execs_done out-qemu/fuzzer_stats | awk '{print$3}'`
} || {
echo CUT----------------------------------------------------------------
echo ../afl-fuzz -Q -V 30 -s 123 -m ${MEM_LIMIT} -i in -o out-qemu -- ./test-instr.qemu
cat errors
echo CUT----------------------------------------------------------------
$ECHO "$RED[!] afl-fuzz is not working correctly with qemu_mode"
Expand Down

0 comments on commit 2314207

Please sign in to comment.