This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] [tests] Test different projects concurrently
ClosedPublic

Authored by george.karpenkov on Feb 7 2018, 10:59 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

NoQ added a comment.Feb 7 2018, 1:37 PM

All right, so we have multiprocessing SATestBuild to run multiprocessing scan-build that intercepts the multiprocessing buildsystem, nice gj =)

Does it get interrupted gracefully with Ctrl+C?

utils/analyzer/SATestBuild.py
681–685 ↗(On Diff #133259)

Does this really need a separate code path?

All right, so we have multiprocessing SATestBuild

No, it's multithreaded.
That's why logging to stdin/stderr from multiple projects at the same time works (python logging is thread-safe).

Does it get interrupted gracefully with Ctrl+C?

Yeah I went to some trouble to make sure it does: all threads are daemon threads, so killing the main thread suffices.

utils/analyzer/SATestBuild.py
681–685 ↗(On Diff #133259)

I wanted to ensure no multithreaded stuff accidentally kicks in, but now that you're asking I guess it could be changed.

NoQ accepted this revision.Feb 7 2018, 1:49 PM

Great.

This revision is now accepted and ready to land.Feb 7 2018, 1:49 PM

...and the previous version was way to good to be true.

Turns out, the -j argument was not honored, and I had to actually implement a simple threading pool.
Additionally, logging was racing, and the "print" calls had to be replaced.

Fix global/local variable collision.

Better variable name.

NoQ accepted this revision.Feb 8 2018, 12:11 PM

Ew, i need to look at stuff more carefully :) Anyway, it still looks good.

utils/analyzer/SATestBuild.py
729–730 ↗(On Diff #133340)

Yeah, despite using an undocumented feature, i guess it's the most pythonic way of doing this we currently have.

This revision was automatically updated to reflect the committed changes.