This is an archive of the discontinued LLVM Phabricator instance.

[lit] Fix type error for parallelism groups
ClosedPublic

Authored by modocache on Jul 25 2017, 9:17 PM.

Details

Summary

Whereas rL299560 and rL309071 call parallelism_groups.items(), under the
assumption that parallelism_groups is a dict type, the default
parameter for that attribute is a list. Change the default to a
dict for type correctness.

This regression in the unit tests would have been caught if the
unit tests were being run continously. It also would have been caught
if the lit project used a Python type checker such as mypy.

Test Plan:
As per the instructions in utils/lit/README.txt, run the lit unit
test suite:

utils/lit/lit.py \
    --path /path/to/your/llvm/build/bin \
    utils/lit/tests

Verify that the test lit :: unit/TestRunner.py fails before applying this
patch, but passes once this patch is applied.

Event Timeline

modocache created this revision.Jul 25 2017, 9:17 PM
mgorny accepted this revision.Jul 26 2017, 3:53 AM

LGTM. I've confirmed that it fixes lit test suite, and no additional tests from the LLVM test suite fails (except the one that failed before applying the patch). I haven't tested other LLVM projects though.

This revision is now accepted and ready to land.Jul 26 2017, 3:53 AM
modocache closed this revision.Jul 26 2017, 8:02 AM

Thanks for all the reviews, @mgorny! @rnk, let me know if this is OK by you when you can.

rnk added inline comments.Jul 26 2017, 10:52 AM
utils/lit/lit/LitConfig.py
28

Isn't this one of the classic python traps? If self.parallelism_groups is modified, it will modify the default argument used by all LitConfig objects. The usual workaround is to set this to None and test for it below or elsewhere.