Changes to llvm tests to fix Bug 17327

Thomas O'Dell thomas_odell at
Thu Sep 26 01:31:54 PDT 2013


Hi Nick and Stephen, 

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. 

I've updated the test to include comments. I tested it out on QNX and
it's working there. 

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. 

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


Thomas O'Dell 

On 2013-09-26 02:56, Nick Lewycky wrote: 

> Stephen Checkoway wrote:
> On Sep 25, 2013, at 2:16 AM, Thomas O'Dell<thomas_odell at> wrote: 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. Very bizarre!

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.


>> The extra step uses echo to ensure there is at least 1 newline in the file. The test then passes.
> 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. 
>> 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
> LGTM, but I'm just a list lurker, someone else needs to approve.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr17327.diff.txt
Type: text/x-diff
Size: 8796 bytes
Desc: not available
URL: <>

More information about the llvm-commits mailing list