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