[LLVMdev] FYI: As of r159525, the LLVM test suite no longer uses tclsh-style quoting! (original) (raw)

Chandler Carruth chandlerc at gmail.com
Mon Jul 2 15:10:21 PDT 2012


And there was much rejoicing, but probably also some pain.

I've gotten the builds green (after some minor snafus) on Linux and Mac, and I think Windows should be fine (forcing the internal lit test runner passes on Linux).

This has sped up test runs by about 33% on many-core Linux builds. =]

However, for folks who maintain an out-of-tree regression test suite who were previously relying on the TCL/SH-style rules for interpreting the RUN-lines of the suite, there may be some issues updating to cope with this.

Below is the tale of terrible tricks I used to update LLVM's test suite. This should get well over 90% (close to 95% for me) of the conversion, and the rest is fairly easy to do by hand.

The first step is to build a list of test files containing 'RUN:' lines. You can use 'grep' or your favorite tool for this. Let's put that list in "tests.txt". I'm going to assume you have a modern zsh or bash-like shell for the rest:

First, remove a layer of TCL escaping:

perl -i -pe 's:\([\<>[]$]):\1:g if /.RUN:\s(|.(grep|sed|echo) [^{\047"|]*){/' $(cat tests.txt)

Next hide escaped open and close curlies behind sigils

perl -i -pe 's:\{:##OPEN_CURLY##:g if /.RUN:\s(|.(grep|sed|echo) [^{\047"|]){/' $(cat tests.txt) perl -i -pe 's:\}:##CLOSE_CURLY##:g if /.RUN:\s(|.(grep|sed|echo) [^{\047"|]){/' $(cat tests.txt)

This is a good point to checkpoint in git.

You may want to rewind to here if you hit issues.

Next up, we iteratively chomp through the TCL-style quotes

Run this command repeatedly, checkpointing in your local git

When running it produces no further edits, you're done

perl -i -pe 's!(.RUN:\s(|.(grep|sed|echo) [^{\047"|])){(([^{}]|{[^{}]}))}!\1"\4"!' $(cat tests.txt)

Now switch the sigils back to curlies.

perl -i -pe 's:##OPEN_CURLY##:{:g' $(cat tests.txt) perl -i -pe 's:##CLOSE_CURLY##:}:g' $(cat tests.txt)

Note that I have not tested these commands terribly thoroughly, and edited them in writing the email. ;] Use at your own risk!

Also, feel free to ping me on IRC if you need help converting something tricky. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120702/6ec5596f/attachment.html>



More information about the llvm-dev mailing list