<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html><body style='font-family: Verdana,Geneva,sans-serif'>
<p>Hi Nick and Stephen,</p>
<p>Actually, the truth is a little more insidious: linkagename.gcno is not a text file, and contains nul characters. The echo `cat %T`removes the nul characters as well as adding a newline. It happens to work in this case, but it might not work in general.</p>
<p>I've updated the test to include comments. I tested it out on QNX and it's working there.</p>
<p>We may want to look at another utility in the long run. In order to get the clang tests to pass, I wrote a "gstrp" - which is grep that handles long lines (QNX's grep fails if the line length is >2048 chars). It looks for strings, not regular expressions, hence its name.</p>
<p>gstrp also handles non-text files and files without newlines since does a byte-by-byte analysis. I can upload this file to you guys if you're interested.</p>
<p>Regards,</p>
<p>Thomas O'Dell</p>
<p> </p>
<p>On 2013-09-26 02:56, Nick Lewycky wrote:</p>
<blockquote type="cite" style="padding-left:5px; border-left:#1010ff 2px solid; margin-left:5px"><!-- html ignored --><!-- head ignored --><!-- meta ignored -->
<pre>Stephen Checkoway wrote:</pre>
<blockquote type="cite" style="padding-left:5px; border-left:#1010ff 2px solid; margin-left:5px">On Sep 25, 2013, at 2:16 AM, Thomas O'Dell<<a href="mailto:thomas_odell@trsolutions.biz">thomas_odell@trsolutions.biz</a>> wrote:
<blockquote type="cite" style="padding-left:5px; border-left:#1010ff 2px solid; margin-left:5px">Hi Stephen, The problem with the test is that QNX's grep (POSIX-compliant) doesn't find the required symbol if the file lacks a newline.</blockquote>
Very bizarre!</blockquote>
<pre>Please add a comment in the test explaining this. Anybody in the future 
who didn't read this thread is going to "fix" it and put it back.

Something like "Per POSIX, grep matches lines, so add a newline to 
ensure it has a line to match." ... except correct. I haven't actually 
checked what POSIX says.

Nick</pre>
<blockquote type="cite" style="padding-left:5px; border-left:#1010ff 2px solid; margin-left:5px">
<blockquote type="cite" style="padding-left:5px; border-left:#1010ff 2px solid; margin-left:5px">The extra step uses echo to ensure there is at least 1 newline in the file. The test then passes.</blockquote>
You could use echo>> %T/linkagename.gcno to add a newline rather than create a new file, but I suspect it doesn't matter much.
<blockquote type="cite" style="padding-left:5px; border-left:#1010ff 2px solid; margin-left:5px">As Nick pointed out, there was a typo in the change I uploaded. The corrected diff is: Index: test/Transforms/GCOVProfiling/linkagename.ll =================================================================== --- test/Transforms/GCOVProfiling/linkagename.ll (revision 191282) +++ test/Transforms/GCOVProfiling/linkagename.ll (working copy) @@ -1,7 +1,8 @@ ; RUN: echo '!9 = metadata !{metadata !"%T/linkagename.ll", metadata !0}'> %t1 ; RUN: cat %s %t1> %t2 ; RUN: opt -insert-gcov-profiling -disable-output< %t2 -; RUN: grep _Z3foov %T/linkagename.gcno +; RUN: echo `cat %T/linkagename.gcno`>%t3 +; RUN: grep _Z3foov %t3 ; RUN: rm %T/linkagename.gcno</blockquote>
LGTM, but I'm just a list lurker, someone else needs to approve.</blockquote>
</blockquote>
<p> </p>
<div> </div>
</body></html>