This is an archive of the discontinued LLVM Phabricator instance.

[lit] Hack lit to allow a test suite to request that it is run "early".
ClosedPublic

Authored by chandlerc on Mar 11 2016, 9:52 AM.

Details

Summary

This lets us for example start running the unit test suite early. For
'check-llvm' on my machine, this drops the tim e from 44s to 32s!!!!!

It's pretty ugly. I barely know how to write Python, so feel free to
just tell me how I should write it instead. =D

Diff Detail

Event Timeline

chandlerc updated this revision to Diff 50443.Mar 11 2016, 9:52 AM
chandlerc retitled this revision from to [lit] Hack lit to allow a test suite to request that it is run "early"..
chandlerc updated this object.
chandlerc added a subscriber: llvm-commits.
filcab added a subscriber: filcab.Mar 11 2016, 10:10 AM
filcab added inline comments.
utils/lit/lit/main.py
370

Maybe run.tests.sort(key = lambda x: (x.isEarlyTest(), x.getFullName())?
The manual says: "tuples are compared lexicographically; the first items are compared; if they are the same then the second items are compared, and so on.". You'd be able to avoid that nasty string concatenation.

chandlerc updated this revision to Diff 50446.Mar 11 2016, 10:19 AM

Use a tuple instead of hideous string concatenation tricks.

chandlerc marked an inline comment as done.Mar 11 2016, 10:20 AM
chandlerc added inline comments.
utils/lit/lit/main.py
370–371

Fantastic suggestion (but needed a "not")!

FWIW I'm fine with this. It is a bit "hacky", but it helps a real problem. And almost 25% reduction on the test-suite time is welcome for every bots around.

Nice!

I can also reproduce the speedup, from 35.66s to 29.46s in a Release+Asserts!

chandlerc marked an inline comment as done.Mar 11 2016, 2:38 PM

Cool, since folks seem happy with this approach, I'll land it. Also happy to follow up with any other tweaks or solutions folks want.

This revision was automatically updated to reflect the committed changes.