summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Fuzzer/test/FuzzerUnittest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [LibFuzzer] Fix ``FuzzerMutate.ShuffleBytes2`` unit test on OSX.Dan Liew2016-06-151-1/+1
| | | | | | | | | | | | | | | | 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. Differential Revision: http://reviews.llvm.org/D21359 llvm-svn: 272743
* [LibFuzzer] Fix some unit test crashes on OSX.Dan Liew2016-06-101-0/+4
| | | | | | | | | | | | | | | | | | | | | This fixes the following unit tests: FuzzerDictionary.ParseOneDictionaryEntry FuzzerDictionary.ParseDictionaryFile The issue appears to be mixing non-ASan-ified code (LibFuzzer) and ASan-ified code (the unittest) as the tests would pass fine if everything was built with ASan enabled. I believe the issue is that different implementations of std::vector<> are being used in LibFuzzer and outside LibFuzzer (in the unittests). For Libcxx (I've not seen the issue manifest for libstdc++) we can disable the ASanified std::vector<> by definining the ``_LIBCPP_HAS_NO_ASAN`` macro. Doing this fixes the tests on OSX. Differential Revision: http://reviews.llvm.org/D21049 llvm-svn: 272374
* [LibFuzzer] Declare and use sanitizer functions in ``fuzzer::ExternalFunctions``Dan Liew2016-06-071-0/+21
| | | | | | | | | | | | | | | | | | | | | | | This fixes linking problems on OSX. Unfortunately it turns out we need to use an instance of the ``fuzzer::ExternalFunctions`` object in several places so this commit also replaces all instances with a single global instance. It also turns out initializing a global ``fuzzer::ExternalFunctions`` before main is entered (i.e. letting the object be initialised by the global initializers) is not safe (on OSX the call to ``Printf()`` in the CTOR crashes if it is called from a global initializer) so we instead have a global ``fuzzer::ExternalFunctions*`` and initialize it inside ``FuzzerDriver()``. Multiple unit tests depend also depend on the ``fuzzer::ExternalFunctions*`` global so a ``main()`` function has been added that initializes it before running any tests. Differential Revision: http://reviews.llvm.org/D20943 llvm-svn: 272072
* [libfuzzer] replacing unittest for truncate_units with functional test.Mike Aizatsky2016-05-251-22/+0
| | | | | | Differential Revision: http://reviews.llvm.org/D20641 llvm-svn: 270755
* [libfuzzer] Trying random unit prefixes during corpus load.Mike Aizatsky2016-05-241-0/+22
| | | | | | Differential Revision: http://reviews.llvm.org/D20301 llvm-svn: 270632
* [libfuzzer] adding license headers to cpp filesMike Aizatsky2016-04-011-0/+3
| | | | | | Differential Revision: http://reviews.llvm.org/D18705 llvm-svn: 265174
* [libFuzzer] get rid of UserSuppliedFuzzer; NFCKostya Serebryany2016-02-131-2/+2
| | | | llvm-svn: 260798
* [libFuzzer] simplify the code around Random. NFCKostya Serebryany2016-02-131-11/+11
| | | | llvm-svn: 260797
* Use std::piecewise_constant_distribution instead of ad-hoc binary search.Ivan Krasin2016-01-221-1/+21
| | | | | | | | | | | | | | | Summary: Fix the issue with the most recently discovered unit receiving much less attention. Note: this is the second attempt (prev: r258473). Now, libc++ build is fixed. Reviewers: aizatsky, kcc Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D16487 llvm-svn: 258571
* Revert r258473 as it's breaking the build with libc++Ivan Krasin2016-01-221-21/+1
| | | | | | | | Reviewers: kcc Differential Revision: http://reviews.llvm.org/D16441 llvm-svn: 258479
* Use std::piecewise_constant_distribution instead of ad-hoc binary search.Ivan Krasin2016-01-221-1/+21
| | | | | | | | | | | | | | | | | | Summary: Fix the issue with the most recently discovered unit receiving much less attention. Note: I had to change the seed for one test to make it pass. Alternatively, the number of runs could be increased. I believe that the average time of 'foo' discovery is not increased, just seed=1 was particularly convenient for the previous PRNG scheme used. Reviewers: aizatsky, kcc Subscribers: llvm-commits, kcc Differential Revision: http://reviews.llvm.org/D16419 llvm-svn: 258473
* [libFuzzer] replace vector with a simpler data structure in the Dictionaries ↵Kostya Serebryany2016-01-161-6/+6
| | | | | | to avoid memory allocations on hot path llvm-svn: 257985
* [libFuzzer] suggest a dictionary to the user of some of the trace-based ↵Kostya Serebryany2016-01-141-1/+1
| | | | | | dictionary entries were successful llvm-svn: 257736
* [libFuzzer] add a position hint to the dictionary-based mutatorKostya Serebryany2016-01-071-4/+31
| | | | llvm-svn: 257013
* [libFuzzer] make CrossOver just one of the other mutationsKostya Serebryany2015-12-191-1/+1
| | | | llvm-svn: 256081
* [libFuzzer] compute base64 in-process instead of using an external lib. ↵Kostya Serebryany2015-12-041-0/+13
| | | | | | Since libFuzzer should not depend on anything, just re-implement base64 encoder. PR25746 llvm-svn: 254784
* [libFuzzer] add one more mutator: Mutate_ChangeASCIIIntegerKostya Serebryany2015-09-081-0/+31
| | | | llvm-svn: 247027
* [libFuzzer] actually make the dictionaries work (+docs)Kostya Serebryany2015-09-041-10/+70
| | | | llvm-svn: 246825
* [libFuzzer] refactor the mutation functions so that they are now methods of ↵Kostya Serebryany2015-09-031-19/+25
| | | | | | a class. NFC llvm-svn: 246808
* [libFuzzer] adding a parser for AFL-style dictionaries + tests.Kostya Serebryany2015-09-031-0/+48
| | | | llvm-svn: 246800
* [libFuzzer] add one more mutation strategy: byte shufflingKostya Serebryany2015-08-061-0/+23
| | | | llvm-svn: 244188
* [libFuzzer] more refactoring of the Mutator and adding tests to itKostya Serebryany2015-08-011-12/+98
| | | | llvm-svn: 243818
* [libFuzzer] start refactoring the Mutator and adding tests to itKostya Serebryany2015-08-011-1/+35
| | | | llvm-svn: 243817
* [libFuzzer] allow users to supply their own implementation of randKostya Serebryany2015-07-241-1/+2
| | | | llvm-svn: 243078
* [lib/Fuzzer] extend the fuzzer interface to allow user-supplied mutatorsKostya Serebryany2015-05-221-1/+4
| | | | llvm-svn: 238059
* [lib/Fuzzer] Add SHA1 implementation from public domain.Kostya Serebryany2015-05-141-0/+8
| | | | | | | | | | | | | | | | | | | | | | | Summary: This adds a SHA1 implementation taken from public domain code. The change is trivial, but as it involves third-party code I'd like a second pair of eyes before commit. LibFuzzer can not use SHA1 from openssl because openssl may not be available and because we may be fuzzing openssl itself. Using sha1sum via a pipe is too slow. Test Plan: n/a Reviewers: chandlerc Reviewed By: chandlerc Subscribers: majnemer, llvm-commits Differential Revision: http://reviews.llvm.org/D9733 llvm-svn: 237400
* [lib/Fuzzer] rename TestOneInput to LLVMFuzzerTestOneInput to make it more ↵Kostya Serebryany2015-05-061-3/+3
| | | | | | unique llvm-svn: 236652
* [fuzzer] Add a gtest-style testKostya Serebryany2015-01-301-0/+62
Summary: Add one gtest-style test. Test Plan: run on bot Reviewers: samsonov Reviewed By: samsonov Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D7287 llvm-svn: 227639
OpenPOWER on IntegriCloud