<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 28, 2015 at 5:00 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"><span class="">On 29.1.2015 2:30, Kostya Serebryany wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
You mean, someone will *explicitly* try to build a target that [s]he does<br>
not care about?<br>
Not sure I understand the workflow that this new thing breaks.<br>
</blockquote>
<br></span>
Yes, someone who cares or doesn't know the requirements will eventually try to build it on a host where it isn't supported. Also the library itself could be tested by default on wider range of configurations by enabling its own test on supported platforms (if that is desirable and feasible).<br></blockquote><div>I hope to add gunite-style unit tests for the fuzzer itself that will not have any dependencies and that will be run by default. </div><div>That's in my TODO.  </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Main point here is to avoid false expectations, like if it's available it shall work ;)<span class="HOEnZb"><font color="#888888"><br>
<br>
Pasi.</font></span><div class="HOEnZb"><div class="h5"><br>
<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 3:45 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 29.1.2015 0:23, Kostya Serebryany wrote:<br>
<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>
  On 28.1.2015 0:08, Kostya Serebryany wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
  Author: kcc<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
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<br>
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>
<br>
</blockquote>
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>
<br>
</blockquote>
<br>
<br>
I don't have any strong opinion here. But none of the reviewers objected.<br>
<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
   Modified: llvm/trunk/lib/CMakeLists.txt<br>
<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>
  This target should only be added when build environment can satisfy its<br>
</blockquote>
requirements (sufficient posix interfaces + asan support), otherwise<br>
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>
<br>
</blockquote>
<br>
<br>
That's what EXCLUDE_FROM_ALL is for, right?<br>
<br>
<br>
</blockquote>
The point was that, though it is excluded from a default target, it's<br>
still available as a target anyway. And when trying to build that target,<br>
it will fail on environments which can not satisfy its requirements, such<br>
as MSVC.<br>
<br>
Pasi.<br>
<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>
Pasi.<br>
<br>
<br>
<br>
</blockquote>
<br>
</blockquote>
<br>
</blockquote>
<br>
</blockquote>
<br>
</div></div></blockquote></div><br></div></div>