diff options
| author | Mike Aizatsky <aizatsky@chromium.org> | 2016-06-30 20:43:06 +0000 |
|---|---|---|
| committer | Mike Aizatsky <aizatsky@chromium.org> | 2016-06-30 20:43:06 +0000 |
| commit | 8ba86a5a48b95fc7818946790fa8e97cbe98b62d (patch) | |
| tree | 4ca35c7928017991d010c2e7880b1ce3492bde04 /llvm/lib/Fuzzer/test/afl-driver-extra-stats.test | |
| parent | 3898a0468c63b66c0533cf313f16cb8b5edab5b9 (diff) | |
| download | bcm5719-llvm-8ba86a5a48b95fc7818946790fa8e97cbe98b62d.tar.gz bcm5719-llvm-8ba86a5a48b95fc7818946790fa8e97cbe98b62d.zip | |
[libFuzzer] Let user specify extra stats file.
Summary: If AFL_DRIVER_EXTRA_STATS_FILENAME is set and valid, write to it peak_rss_mb and slowest_unit_time_sec. These are both stats that libFuzzer can print but afl cannot.
Reviewers: kcc, aizatsky, metzman
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D21742
llvm-svn: 274273
Diffstat (limited to 'llvm/lib/Fuzzer/test/afl-driver-extra-stats.test')
| -rw-r--r-- | llvm/lib/Fuzzer/test/afl-driver-extra-stats.test | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/llvm/lib/Fuzzer/test/afl-driver-extra-stats.test b/llvm/lib/Fuzzer/test/afl-driver-extra-stats.test new file mode 100644 index 00000000000..81e384e7dad --- /dev/null +++ b/llvm/lib/Fuzzer/test/afl-driver-extra-stats.test @@ -0,0 +1,28 @@ +; Test that not specifying an extra stats file isn't broken. +RUN: unset AFL_DRIVER_EXTRA_STATS_FILENAME +RUN: AFLDriverTest + +; Test that specifying an invalid extra stats file causes a crash. +RUN: ASAN_OPTIONS= AFL_DRIVER_EXTRA_STATS_FILENAME=%T not --crash 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 + +; Test that specifying a valid nonexistent stats file works. +RUN: rm -f %t +RUN: AFL_DRIVER_EXTRA_STATS_FILENAME=%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 +; 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: [[ $(grep "9999" %t | wc -l) -eq 2 ]] |

