diff options
author | Dominik Maier <domenukk@gmail.com> | 2020-08-04 21:33:29 +0200 |
---|---|---|
committer | Dominik Maier <domenukk@gmail.com> | 2020-08-04 21:33:29 +0200 |
commit | 194188fe56f06dfc49aef9066e96bf90bc4fbe71 (patch) | |
tree | 40c93782d003967ed9a9eaad50c5c57dc9073aea /test/test-compcov.sh | |
parent | cc74efa35e190d15533f99a5a99b698e772fbe81 (diff) | |
download | afl++-194188fe56f06dfc49aef9066e96bf90bc4fbe71.tar.gz |
split up testcases
Diffstat (limited to 'test/test-compcov.sh')
-rwxr-xr-x | test/test-compcov.sh | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/test/test-compcov.sh b/test/test-compcov.sh new file mode 100755 index 00000000..5becc862 --- /dev/null +++ b/test/test-compcov.sh @@ -0,0 +1,51 @@ +#!/bin/sh + +source ./test-pre.sh + +test -z "$AFL_CC" && unset AFL_CC + +$ECHO "$BLUE[*] Testing: shared library extensions" +cc $CFLAGS -o test-compcov test-compcov.c > /dev/null 2>&1 +test -e ../libtokencap.so && { + AFL_TOKEN_FILE=token.out LD_PRELOAD=../libtokencap.so DYLD_INSERT_LIBRARIES=../libtokencap.so DYLD_FORCE_FLAT_NAMESPACE=1 ./test-compcov foobar > /dev/null 2>&1 + grep -q BUGMENOT token.out > /dev/null 2>&1 && { + $ECHO "$GREEN[+] libtokencap did successfully capture tokens" + } || { + $ECHO "$RED[!] libtokencap did not capture tokens" + CODE=1 + } + rm -f token.out +} || { + $ECHO "$YELLOW[-] libtokencap is not compiled, cannot test" + INCOMPLETE=1 +} +test -e ../libdislocator.so && { + { + ulimit -c 1 + # DYLD_INSERT_LIBRARIES and DYLD_FORCE_FLAT_NAMESPACE is used on Darwin/MacOSX + LD_PRELOAD=../libdislocator.so DYLD_INSERT_LIBRARIES=../libdislocator.so DYLD_FORCE_FLAT_NAMESPACE=1 ./test-compcov BUFFEROVERFLOW > test.out 2>/dev/null + } > /dev/null 2>&1 + grep -q BUFFEROVERFLOW test.out > /dev/null 2>&1 && { + $ECHO "$RED[!] libdislocator did not detect the memory corruption" + CODE=1 + } || { + $ECHO "$GREEN[+] libdislocator did successfully detect the memory corruption" + } + rm -f test.out core test-compcov.core core.test-compcov +} || { + $ECHO "$YELLOW[-] libdislocator is not compiled, cannot test" + INCOMPLETE=1 +} +rm -f test-compcov + +test -z "$AFL_CC" && { + if type gcc >/dev/null; then + export AFL_CC=gcc + else + if type clang >/dev/null; then + export AFL_CC=clang + fi + fi +} + +source ./test-post.sh |