Home | History | Annotate | Download | only in test
      1 ; Test that not specifying an extra stats file isn't broken.
      2 RUN: unset AFL_DRIVER_EXTRA_STATS_FILENAME
      3 RUN: AFLDriverTest
      4 
      5 ; Test that specifying an invalid extra stats file causes a crash.
      6 RUN: ASAN_OPTIONS= AFL_DRIVER_EXTRA_STATS_FILENAME=%T not --crash AFLDriverTest
      7 
      8 ; Test that specifying a corrupted stats file causes a crash.
      9 echo "peak_rss_mb :0" > %t
     10 ASAN_OPTIONS= AFL_DRIVER_EXTRA_STATS_FILENAME=%t not --crash AFLDriverTest
     11 
     12 ; Test that specifying a valid nonexistent stats file works.
     13 RUN: rm -f %t
     14 RUN: AFL_DRIVER_EXTRA_STATS_FILENAME=%t AFLDriverTest
     15 RUN: [[ $(grep "peak_rss_mb\|slowest_unit_time_sec" %t | wc -l) -eq 2 ]]
     16 
     17 ; Test that specifying a valid preexisting stats file works.
     18 RUN: printf "peak_rss_mb : 0\nslowest_unit_time_sec: 0\n" > %t
     19 RUN: AFL_DRIVER_EXTRA_STATS_FILENAME=%t AFLDriverTest
     20 ; Check that both lines were printed.
     21 RUN: [[ $(grep "peak_rss_mb\|slowest_unit_time_sec" %t | wc -l) -eq 2 ]]
     22 
     23 ; Test that peak_rss_mb and slowest_unit_time_in_secs are only updated when necessary.
     24 ; Check that both lines have 9999 since there's no way we have exceeded that
     25 ; amount of time or virtual memory.
     26 RUN: printf "peak_rss_mb : 9999\nslowest_unit_time_sec: 9999\n" > %t
     27 RUN: AFL_DRIVER_EXTRA_STATS_FILENAME=%t AFLDriverTest
     28 RUN: [[ $(grep "9999" %t | wc -l) -eq 2 ]]
     29