<div>And there was much rejoicing, but probably also some pain.</div><div><br></div><div>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).</div>
<div><br></div><div>This has sped up test runs by about 33% on many-core Linux builds. =]</div><div><br></div><div><br></div><div>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.</div>
<div><br></div><div>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.</div><div>
<br></div><div>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:</div>
<div><br></div><font face="courier new, monospace"># First, remove a layer of TCL escaping:<br>perl -i -pe 's:\\([\\<>\[\]*\$]):\1:g if /.*RUN:\s*(|.*(grep|sed|echo) [^{\047"|]*){/' $(cat tests.txt)<br>
<br># Next hide escaped open and close curlies behind sigils<br>perl -i -pe 's:\\{:##_OPEN_CURLY_##:g if /.*RUN:\s*(|.*(grep|sed|echo) [^{\047"|]*){/' $(cat tests.txt)<br>perl -i -pe 's:\\}:##_CLOSE_CURLY_##:g if /.*RUN:\s*(|.*(grep|sed|echo) [^{\047"|]*){/' $(cat tests.txt)<br>
<br># This is a good point to checkpoint in git.</font><div><font face="courier new, monospace"># You may want to rewind to here if you hit issues.<br><br># Next up, we iteratively chomp through the TCL-style quotes<br># Run this command repeatedly, checkpointing in your local git<br>
# When running it produces no further edits, you're done<br>perl -i -pe 's!(.*RUN:\s*(|.*(grep|sed|echo) [^{\047"|]*)){(([^{}]|{[^{}]*})*)}!\1"\4"!' $(cat tests.txt)<br><br># Now switch the sigils back to curlies.<br>
perl -i -pe 's:##_OPEN_CURLY_##:{:g' $(cat tests.txt)<br>perl -i -pe 's:##_CLOSE_CURLY_##:}:g' $(cat tests.txt)</font><div><br></div><br>Note that I have not tested these commands terribly thoroughly, and edited them in writing the email. ;] Use at your own risk!<br>
<br>Also, feel free to ping me on IRC if you need help converting something tricky.</div>