There is test for ft file-id in control file, but no test for cov line.
Without the test, a invalid cov file-id would cause crash.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
compiler-rt/lib/fuzzer/FuzzerMerge.cpp | ||
---|---|---|
123 | From the test I see that FT marker is required, but COV marker is optional. In the original code, LastSeenStartMarker also serves as a flag to mark if the FT marker is presented (by setting it to kInvalidStartMarker). However, because we want to keep LastSeenStartMarker's value to check with COV marker, so I add the HaveFtMarker as a flag to see if the FT marker is presented or not. |
compiler-rt/lib/fuzzer/FuzzerMerge.cpp | ||
---|---|---|
123–126 | I believe your code is equivalent to if (!HaveFtMarker && LastSeenStartMarker != kInvalidStartMarker) LastFailure = Files[LastSeenStartMarker].Name; But as I see, the only way to have HaveFtMarker == false is to go through (Marker == "STARTED") so LastSeenStartMarker will be set. LastFailure = Files[LastSeenStartMarker].Name; will never happen Would you like to extract HaveFtMarker change into a separate patch, with own test? |
compiler-rt/lib/fuzzer/FuzzerMerge.cpp | ||
---|---|---|
123–126 | I don't see why LastFailure = Files[LastSeenStartMarker].Name; will never happen. When going through (Marker == "STARTED"), HaveFtMarker is set to false and LastSeenStartMarker will have a meaningful value, assuming without going through (Marker == "FT"), then (!HaveFtMarker && LastSeenStartMarker != kInvalidStartMarker) is true and LastFailure = Files[LastSeenStartMarker].Name; will happen. But I see that the condition could be simplified as you suggested. Also, I don't think it's a good idea to move HaveFtMarker change to another patch because without HaveFtMarker, this patch will break some LastFailure assertions in fuzzer unittest. |
compiler-rt/lib/fuzzer/FuzzerMerge.cpp | ||
---|---|---|
123–126 | Also, it is difficult to write a test for HaveFtMarker, bacause:
|
compiler-rt/lib/fuzzer/FuzzerMerge.cpp | ||
---|---|---|
123–126 |
Thanks, you are correct.
If this fixes some assertions then we can count that as a test coverage. |
this one is LGTM, and I see the test