This is an archive of the discontinued LLVM Phabricator instance.

Fix dotest on Windows after multiprocessing refactor
ClosedPublic

Authored by zturner on Sep 3 2015, 3:40 PM.

Details

Summary

On Windows, when you call pool.map, under the hood python will *again* import whatever the main module is. In this case it's dotest.py. Importing dotest then causes all of its code to run again, and since the main execution of dotest was not protected by if name == "main", it would recursively kick off the entire process all over again.

Diff Detail

Event Timeline

zturner updated this revision to Diff 33983.Sep 3 2015, 3:40 PM
zturner retitled this revision from to Fix dotest on Windows after multiprocessing refactor.
zturner updated this object.
zturner added reviewers: tfiala, amccarth, chying.
zturner added a subscriber: lldb-commits.
tfiala accepted this revision.Sep 3 2015, 3:49 PM
tfiala edited edge metadata.

Okay I see, makes sense. Particularly the discrepancy.

That code will get much nicer (in dotest.py) when that gets some energy put into cleaning it up.

Thanks for tracking it down, Zachary!

This revision is now accepted and ready to land.Sep 3 2015, 3:49 PM
chying accepted this revision.Sep 3 2015, 4:02 PM
chying edited edge metadata.

This patch works for me.
Although I thought we could put less code in main() function.
Then have
if name == "main":

main()

But that will require some more work to refactor the code. Probably that could wait for Todd's clean up.

zturner added a subscriber: zturner.Sep 3 2015, 4:04 PM

I tried that at first, but unfortunately in order to do that you have to
write a line like

global dont_do_dsym_test

for every global accessed by main. Like you said, Todd can probably clean
that up, for now I just wanted to get something working.

tfiala added a comment.Sep 3 2015, 4:04 PM

This patch works for me.
Although I thought we could put less code in main() function.
Then have
if name == "main":

main()

But that will require some more work to refactor the code. Probably that could wait for Todd's clean up.

Yep, let's wait on that. There is a metric ton of code that needs to shift around in there, be broken down into bite-sized chunks of functionality, etc. We'll get it cleaned up with a main() function soon enough when we do some of that decomposition.

Did this go in, Zachary? I'm just looking to clear out my reviews and this one seems to still be open.

tfiala closed this revision.Oct 11 2015, 9:45 AM

Great, thanks!