[PATCH] D21359: [LibFuzzer] Fix `FuzzerMutate.ShuffleBytes2` unit test on OSX.

Dan Liew via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 14 16:03:49 PDT 2016


delcypher created this revision.
delcypher added reviewers: kcc, aizatsky.
delcypher added subscribers: kcc, aizatsky, zaks.anna, kubabrecka, dcoughlin, llvm-commits.

[LibFuzzer] Fix `FuzzerMutate.ShuffleBytes2` unit test on OSX.

The `FuzzerMutate.ShuffleBytes2` unit test was failing on
OSX due to the implementation of `std::random_shuffle()`
being different between libcxx and libstdc++.

@kcc has decided (see http://reviews.llvm.org/D21218) it is acceptable
for there to be different mutation behavior on different platforms so
this commit just adjusts the test to perform the minimum number of
iterations (that is a power of 2) to see all the mutations the unit test
is looking for.


http://reviews.llvm.org/D21359

Files:
  lib/Fuzzer/test/FuzzerUnittest.cpp

Index: lib/Fuzzer/test/FuzzerUnittest.cpp
===================================================================
--- lib/Fuzzer/test/FuzzerUnittest.cpp
+++ lib/Fuzzer/test/FuzzerUnittest.cpp
@@ -259,7 +259,9 @@
   TestShuffleBytes(&MutationDispatcher::Mutate_ShuffleBytes, 1 << 16);
 }
 TEST(FuzzerMutate, ShuffleBytes2) {
-  TestShuffleBytes(&MutationDispatcher::Mutate, 1 << 19);
+  // The number used below is the minimum required for the test to pass using
+  // libstdc++ and libcxx.
+  TestShuffleBytes(&MutationDispatcher::Mutate, 1 << 20);
 }
 
 void TestAddWordFromDictionary(Mutator M, int NumIter) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21359.60777.patch
Type: text/x-patch
Size: 608 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160614/ffa77125/attachment.bin>


More information about the llvm-commits mailing list