[PATCH] D48054: [libFuzzer] Mutation tracking and logging implemented
Jonathan Metzman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 22 16:20:47 PDT 2018
metzman added inline comments.
================
Comment at: lib/fuzzer/FuzzerMutationStats.cpp:23
+ for (int i = 0; i < NUMBER_OF_MUTATION_TYPES; i++) {
+ double CurrentRatio =
+ (TotalMutations.at(i) != 0)
----------------
Dor1s wrote:
> I think the current version looks unnecessary messy, let's just do something like:
>
> ```
> // +1 is not significant, but prevents us from dividing by zero.
> double Ratio = static_cast<double>(100 * UsefulMutations.at(i)) / (1 + TotalMutations.at(i));
> ```
>
+1
================
Comment at: lib/fuzzer/FuzzerMutationStats.cpp:29
+ Printf("%.3f", CurrentRatio);
+ if (i < NUMBER_OF_MUTATION_TYPES-1) Printf(",");
+ else if (i == NUMBER_OF_MUTATION_TYPES-1) Printf("\n\n");
----------------
I think every arithmetic operator in libFuzzer has spaces around it. Please do that here by adding spaces around the "-"
================
Comment at: lib/fuzzer/FuzzerMutationStats.cpp:30
+ if (i < NUMBER_OF_MUTATION_TYPES-1) Printf(",");
+ else if (i == NUMBER_OF_MUTATION_TYPES-1) Printf("\n\n");
+ }
----------------
This `if` isn't needed. `else` is enough.
Please remove it
================
Comment at: lib/fuzzer/FuzzerMutationStats.cpp:30
+ if (i < NUMBER_OF_MUTATION_TYPES-1) Printf(",");
+ else if (i == NUMBER_OF_MUTATION_TYPES-1) Printf("\n\n");
+ }
----------------
metzman wrote:
> This `if` isn't needed. `else` is enough.
> Please remove it
This `if` isn't needed, `else` is enough
================
Comment at: test/fuzzer/fuzzer-mutationstats.test:2
+RUN: %cpp_compiler %S/SimpleTest.cpp -o %t-MutationStatsTest
+RUN: not %run %t-MutationStatsTest -max_total_time=360 -print_final_stats=1 -print_mutation_stats=1 -print_mutation_usefulness=1 2>&1 | FileCheck %s
+CHECK: stat::mutation_usefulness: {{.*[0-9]+\.[0-9]+[1-9]+.*}}
----------------
We don't need -max_total_time=360 -print_final_stats=1 -print_mutation_stats=1
Remove them please
Repository:
rCRT Compiler Runtime
https://reviews.llvm.org/D48054
More information about the llvm-commits
mailing list