<div class="gmail_quote">On Tue, Mar 29, 2011 at 2:42 PM, Ted Kremenek <span dir="ltr"><<a href="mailto:kremenek@apple.com">kremenek@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div style="word-wrap:break-word"><div><div></div><div class="h5"><div>On Mar 29, 2011, at 1:30 PM, Chandler Carruth wrote:</div><div><br><blockquote type="cite">Sorry to dredge up an old thread, but I'm trying to get some policy clarification:<br>
<br><div class="gmail_quote">On Fri, Mar 11, 2011 at 6:49 PM, Ted Kremenek <span dir="ltr"><<a href="mailto:kremenek@apple.com" target="_blank">kremenek@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Added: cfe/trunk/test/<span>Analysis</span>/<span>iterators</span>.<span>cpp</span><br>

URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/iterators.cpp?rev=127525&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/<span>Analysis</span>/<span>iterators</span>.<span>cpp</span>?rev=127525&view=auto</a><br>


==============================================================================<br>
--- cfe/trunk/test/<span>Analysis</span>/<span>iterators</span>.<span>cpp</span> (added)<br>
+++ cfe/trunk/test/<span>Analysis</span>/<span>iterators</span>.<span>cpp</span> Fri Mar 11 20:49:15 2011<br>
@@ -0,0 +1,104 @@<br>
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental.<span>Iterators</span> -verify %s<br>
+<br>
+#include <vector></div></blockquote></div><br><div>I thought test cases were expected to be freestanding? Before this one, there were only two tests that violate that requirement. Thoughts?</div><div><br></div><div>

For reference, we build and run all Clang and LLVM tests in a freestanding environment out of necessity, so we end up catching these.</div>
</blockquote></div><br></div></div><div>The problem with making this freestanding is that it doesn't test that the checker works on a given platform.</div></div></blockquote><div><br></div><div>I was under the impression that the test/... directory was for regression and feature tests, not platform tests. In the past, those have typically been reserved for the LLVM test-suite, although that has no real concept or framework for testing the analyzer.</div>
<div><br></div><div>I feel like if we want to test how the checker works on a platform (or how anything else in Clang works on a platform excepting generated code performance), we should have a dedicated and separate group of tests for that purpose. When we find bugs, we can then check in just enough code to reproduce that problem into the regression suite in a freestanding form.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div style="word-wrap:break-word"><div>  The definitions of std::vector are allowed to vary, so having tests check against the local version actually helps us catch bugs in the checker.</div>
</div></blockquote><div><br></div><div>Certainly. It seems like it would be good to check in several different (hopefully greatly reduced) structures of code that represent ways of implementing the iterator part of vector, although perhaps that is overkill.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div style="word-wrap:break-word"><div>The other problem with making this freestanding is that simply copying the required parts from <vector> may not be an option if we want to keep the test case free of GPL code (in the case of using the stdc++ provided with GCC).  We of course could use the definition from LLVM's libc++, but then we wouldn't again be testing against what the user is always using when they compile.</div>
</div></blockquote><div><br></div><div>libc++'s implementation would provide a good starting point for this, but I would hope it could be reduced to a relatively small amount of code to keep things focused on the needs of the checker.</div>
<div><br></div><div>I am genuinely interested in a specifically targeted platform tests area. There are lots of things we don't really test well for that case already. It would also make a good sanity test for folks packaging clang on a platform. I suspect we want a test for the iterator checker that isn't dependent on this though.</div>
</div>