-
Notifications
You must be signed in to change notification settings - Fork 12.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Port libFuzzer tests to LIT. Do not require two-stage build for check…
…-fuzzer. This revision ports all libFuzzer tests apart from the unittest to LIT. The advantages of doing so include: - Tests being self-contained - Much easier debugging of a single test - No need for using a two-stage compilation The unit-test is still compiled using CMake, but it does not need a freshly built compiler. NOTE: The previous two-stage bot configuration will NOT work, as in the second stage build LLVM_USE_SANITIZER is set, which disables ASAN from being built. Thus bots will be reconfigured in the next few commits. Differential Revision: https://reviews.llvm.org/D36295 llvm-svn: 310075
- Loading branch information
George Karpenkov
committed
Aug 4, 2017
1 parent
ff77cc7
commit 8ecdd7b
Showing
73 changed files
with
347 additions
and
445 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,32 @@ | ||
REQUIRES: posix | ||
|
||
RUN: %no_fuzzer_cpp_compiler -fno-sanitize-coverage=edge,trace-cmp,indirect-calls,8bit-counters,trace-pc-guard %S/AFLDriverTest.cpp %S/../afl/afl_driver.cpp -o %t-AFLDriverTest | ||
|
||
; Test that not specifying an extra stats file isn't broken. | ||
RUN: unset AFL_DRIVER_EXTRA_STATS_FILENAME | ||
RUN: AFLDriverTest | ||
RUN: %t-AFLDriverTest | ||
|
||
; Test that specifying an invalid extra stats file causes a crash. | ||
RUN: ASAN_OPTIONS= AFL_DRIVER_EXTRA_STATS_FILENAME=%T not --crash AFLDriverTest | ||
RUN: ASAN_OPTIONS= AFL_DRIVER_EXTRA_STATS_FILENAME=%T not --crash %t-AFLDriverTest | ||
|
||
; Test that specifying a corrupted stats file causes a crash. | ||
echo "peak_rss_mb :0" > %t | ||
ASAN_OPTIONS= AFL_DRIVER_EXTRA_STATS_FILENAME=%t not --crash AFLDriverTest | ||
ASAN_OPTIONS= AFL_DRIVER_EXTRA_STATS_FILENAME=%t not --crash %t-AFLDriverTest | ||
|
||
; Test that specifying a valid nonexistent stats file works. | ||
RUN: rm -f %t | ||
RUN: AFL_DRIVER_EXTRA_STATS_FILENAME=%t AFLDriverTest | ||
RUN: AFL_DRIVER_EXTRA_STATS_FILENAME=%t %t-AFLDriverTest | ||
RUN: [[ $(grep "peak_rss_mb\|slowest_unit_time_sec" %t | wc -l) -eq 2 ]] | ||
|
||
; Test that specifying a valid preexisting stats file works. | ||
RUN: printf "peak_rss_mb : 0\nslowest_unit_time_sec: 0\n" > %t | ||
RUN: AFL_DRIVER_EXTRA_STATS_FILENAME=%t AFLDriverTest | ||
RUN: AFL_DRIVER_EXTRA_STATS_FILENAME=%t %t-AFLDriverTest | ||
; Check that both lines were printed. | ||
RUN: [[ $(grep "peak_rss_mb\|slowest_unit_time_sec" %t | wc -l) -eq 2 ]] | ||
|
||
; Test that peak_rss_mb and slowest_unit_time_in_secs are only updated when necessary. | ||
; Check that both lines have 9999 since there's no way we have exceeded that | ||
; amount of time or virtual memory. | ||
RUN: printf "peak_rss_mb : 9999\nslowest_unit_time_sec: 9999\n" > %t | ||
RUN: AFL_DRIVER_EXTRA_STATS_FILENAME=%t AFLDriverTest | ||
RUN: AFL_DRIVER_EXTRA_STATS_FILENAME=%t %t-AFLDriverTest | ||
RUN: [[ $(grep "9999" %t | wc -l) -eq 2 ]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
REQUIRES: posix | ||
|
||
RUN: %no_fuzzer_cpp_compiler -fno-sanitize-coverage=edge,trace-cmp,indirect-calls,8bit-counters,trace-pc-guard %S/AFLDriverTest.cpp %S/../afl/afl_driver.cpp -o %t-AFLDriverTest | ||
|
||
; Test that not specifying a stderr file isn't broken. | ||
RUN: unset AFL_DRIVER_STDERR_DUPLICATE_FILENAME | ||
RUN: AFLDriverTest | ||
RUN: %t-AFLDriverTest | ||
|
||
; Test that specifying an invalid file causes a crash. | ||
RUN: ASAN_OPTIONS= AFL_DRIVER_STDERR_DUPLICATE_FILENAME="%T" not --crash AFLDriverTest | ||
RUN: ASAN_OPTIONS= AFL_DRIVER_STDERR_DUPLICATE_FILENAME="%T" not --crash %t-AFLDriverTest | ||
|
||
; Test that a file is created when specified as the duplicate stderr. | ||
RUN: AFL_DRIVER_STDERR_DUPLICATE_FILENAME=%t AFLDriverTest | ||
RUN: AFL_DRIVER_STDERR_DUPLICATE_FILENAME=%t %t-AFLDriverTest | ||
RUN: stat %t |
Oops, something went wrong.