llvm.org GIT mirror llvm / f190277
Describe quoting rules. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36060 91177308-0d34-0410-b5e6-96231b3b80d8 Reid Spencer 12 years ago
1 changed file(s) with 46 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
322322 any process in the pipeline fails, the entire line (and test case) fails too.
323323

324324
325

Below is an example of legal RUN lines in a .ll file:

326

                  
                
327 ; RUN: llvm-as < %s | llvm-dis > %t1
328 ; RUN: llvm-dis < %s.bc-13 > %t2
329 ; RUN: diff %t1 %t2
330
331
325332

As with a Unix shell, the RUN: lines permit pipelines and I/O redirection

326333 to be used. However, the usage is slightly different than for Bash. To check
327334 what's legal, see the documentation for the
340347 shouldn't use that here.
341348
342349
343

Below is an example of legal RUN lines in a .ll file:

350

There are some quoting rules that you must pay attention to when writing

351 your RUN lines. In general nothing needs to be quoted. Tcl won't strip off any
352 ' or " so they will get passed to the invoked program. For example:

344353

                  
                
345 ; RUN: llvm-as < %s | llvm-dis > %t1
346 ; RUN: llvm-dis < %s.bc-13 > %t2
347 ; RUN: diff %t1 %t2
354 ... | grep 'find this string'
348355
356

This will fail because the ' characters are passed to grep. This would

357 instruction grep to look for 'find in the files this and
358 string'. To avoid this use curly braces to tell Tcl that it should
359 treat everything enclosed as one value. So our example would become:

360

                  
                
361 ... | grep {find this string}
362
363

Additionally, the characters [ and ] are treated

364 specially by Tcl. They tell Tcl to interpret the content as a command to
365 execute. Since these characters are often used in regular expressions this can
366 have disastrous results and cause the entire test run in a directory to fail.
367 For example, a common idiom is to look for some basicblock number:

368

                  
                
369 ... | grep bb[2-8]
370
371

This, however, will cause Tcl to fail because its going to try to execute

372 a program named "2-8". Instead, what you want is this:

373

                  
                
374 ... | grep {bb\[2-8\]}
375
376

Finally, if you need to pass the \ character down to a program,

377 then it must be doubled. This is another Tcl special character. So, suppose
378 you had:
379

                  
                
380 ... | grep 'i32\*'
381
382

This will fail to match what you want (a pointer to i32). First, the

383 ' do not get stripped off. Second, the \ gets stripped off
384 by Tcl so what grep sees is: 'i32*'. That's not likely to match
385 anything. To resolve this you must use \\ and the {}, like
386 this:

387

                  
                
388 ... | grep {i32\\*}
389
390
349391
350392
351393