[llvm] r227252 - Add a Fuzzer library

Pasi Parviainen pasi.parviainen at iki.fi
Wed Jan 28 15:45:39 PST 2015


On 29.1.2015 0:23, Kostya Serebryany wrote:
> On Wed, Jan 28, 2015 at 1:54 PM, Pasi Parviainen <pasi.parviainen at iki.fi>
> wrote:
>
>> On 28.1.2015 0:08, Kostya Serebryany wrote:
>>
>>> Author: kcc
>>> Date: Tue Jan 27 16:08:41 2015
>>> New Revision: 227252
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=227252&view=rev
>>> Log:
>>> Add a Fuzzer library
>>>
>>> Summary:
>>> A simple genetic in-process coverage-guided fuzz testing library.
>>>
>>> I've used this fuzzer to test clang-format
>>> (it found 12+ bugs, thanks djasper@ for the fixes!)
>>> and it may also help us test other parts of LLVM.
>>> So why not keep it in the LLVM repository?
>>>
>>> I plan to add the cmake build rules later (in a separate patch, if that's
>>> ok)
>>> and also add a clang-format-fuzzer target.
>>>
>>> See README.txt for details.
>>>
>>> Test Plan: Tests will follow separately.
>>>
>>> Reviewers: djasper, chandlerc, rnk
>>>
>>> Reviewed By: rnk
>>>
>>> Subscribers: majnemer, ygribov, dblaikie, llvm-commits
>>>
>>> Differential Revision: http://reviews.llvm.org/D7184
>>>
>>> Added:
>>>       llvm/trunk/lib/Fuzzer/
>>>       llvm/trunk/lib/Fuzzer/CMakeLists.txt
>>>       llvm/trunk/lib/Fuzzer/FuzzerCrossOver.cpp
>>>       llvm/trunk/lib/Fuzzer/FuzzerFlags.def
>>>       llvm/trunk/lib/Fuzzer/FuzzerIO.cpp
>>>       llvm/trunk/lib/Fuzzer/FuzzerInternal.h
>>>       llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp
>>>       llvm/trunk/lib/Fuzzer/FuzzerMain.cpp
>>>       llvm/trunk/lib/Fuzzer/FuzzerMutate.cpp
>>>       llvm/trunk/lib/Fuzzer/FuzzerUtil.cpp
>>>       llvm/trunk/lib/Fuzzer/README.txt
>>>       llvm/trunk/lib/Fuzzer/test/
>>>       llvm/trunk/lib/Fuzzer/test/ExactTest.cpp
>>>       llvm/trunk/lib/Fuzzer/test/InfiniteTest.cpp
>>>       llvm/trunk/lib/Fuzzer/test/NullDerefTest.cpp
>>>       llvm/trunk/lib/Fuzzer/test/SimpleTest.cpp
>>>       llvm/trunk/lib/Fuzzer/test/TestFuzzerCrossOver.cpp
>>>       llvm/trunk/lib/Fuzzer/test/TimeoutTest.cpp
>>> Modified:
>>>       llvm/trunk/lib/CMakeLists.txt
>>>
>>
>> Putting this library directly under lib/ tree feels a little bit out of
>> place. Perhaps utils/ or even tools/ trees would be more appropriate
>> locations for this library, since most of its value is in testing (on
>> limited environments, see below).
>
>
> I don't have any strong opinion here. But none of the reviewers objected.
>
>
>>
>>
>>   Modified: llvm/trunk/lib/CMakeLists.txt
>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/
>>> CMakeLists.txt?rev=227252&r1=227251&r2=227252&view=diff
>>> ============================================================
>>> ==================
>>> --- llvm/trunk/lib/CMakeLists.txt (original)
>>> +++ llvm/trunk/lib/CMakeLists.txt Tue Jan 27 16:08:41 2015
>>> @@ -17,3 +17,4 @@ add_subdirectory(Target)
>>>    add_subdirectory(AsmParser)
>>>    add_subdirectory(LineEditor)
>>>    add_subdirectory(ProfileData)
>>> +add_subdirectory(Fuzzer)
>>>
>>> Added: llvm/trunk/lib/Fuzzer/CMakeLists.txt
>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/
>>> CMakeLists.txt?rev=227252&view=auto
>>> ============================================================
>>> ==================
>>> --- llvm/trunk/lib/Fuzzer/CMakeLists.txt (added)
>>> +++ llvm/trunk/lib/Fuzzer/CMakeLists.txt Tue Jan 27 16:08:41 2015
>>> @@ -0,0 +1,9 @@
>>> +add_library(LLVMFuzzer STATIC
>>> +  EXCLUDE_FROM_ALL  # Do not build if you are not building fuzzers.
>>> +  FuzzerCrossOver.cpp
>>> +  FuzzerIO.cpp
>>> +  FuzzerLoop.cpp
>>> +  FuzzerMain.cpp
>>> +  FuzzerMutate.cpp
>>> +  FuzzerUtil.cpp
>>> +  )
>>>
>>>
>> This target should only be added when build environment can satisfy its
>> requirements (sufficient posix interfaces + asan support), otherwise there
>> will be a build target which is known to fail. Fuzzers depending on this
>> library can then simply enable themselves by existence of this target.
>
>
> That's what EXCLUDE_FROM_ALL is for, right?
>

The point was that, though it is excluded from a default target, it's 
still available as a target anyway. And when trying to build that 
target, it will fail on environments which can not satisfy its 
requirements, such as MSVC.

Pasi.

>
>>
>>
>> Pasi.
>>
>>
>




More information about the llvm-commits mailing list