This is an archive of the discontinued LLVM Phabricator instance.

[lit] Introduce LIT_WORKERS environment variable
AbandonedPublic

Authored by jansvoboda11 on Feb 24 2021, 2:40 AM.

Details

Summary

There is no way to specify the number of workers when invoking lit indirectly (e.g. when building targets similar "check-clang"). Lit does not see the -j N target passed to the build tool (e.g. ninja).

This patch introduces the LIT_WORKERS environment variable, which works around this. Now, the number of cores for building dependencies of a lit test and runing the lit test can be both parametrized:
LIT_WORKERS=N ninja check-clang -j M

When invoking lit directly, the value specified via LIT_WORKERS can be overwritten by lit -j argument.

Diff Detail

Event Timeline

jansvoboda11 created this revision.Feb 24 2021, 2:40 AM
jansvoboda11 requested review of this revision.Feb 24 2021, 2:40 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 24 2021, 2:40 AM
jansvoboda11 edited the summary of this revision. (Show Details)Feb 24 2021, 2:42 AM
jansvoboda11 edited the summary of this revision. (Show Details)
dexonsmith accepted this revision.Feb 24 2021, 7:51 AM

LGTM! Thanks for implementing this.

This revision is now accepted and ready to land.Feb 24 2021, 7:51 AM
yln added a comment.Feb 24 2021, 12:00 PM

There is no way to specify the number of workers when invoking lit indirectly ...

You could have accomplished this with LIT_OPTS=--workers=4 instead of adding a dedicated env var.

In D97373#2585720, @yln wrote:

There is no way to specify the number of workers when invoking lit indirectly ...

You could have accomplished this with LIT_OPTS=--workers=4 instead of adding a dedicated env var.

Ah, I totally missed that in the documentation, thanks for pointing this out.

What's the reason for having granular environment variables then? (e.g. LIT_FILTER, LIT_FILTER_OUT, LIT_XFAIL)

yln added a comment.Feb 24 2021, 1:24 PM

What's the reason for having granular environment variables then? (e.g. LIT_FILTER, LIT_FILTER_OUT, LIT_XFAIL)

LIT_FILTER predates LIT_OPTS and the others were added for convenience I guess (not too happy about that).

jansvoboda11 abandoned this revision.Feb 24 2021, 11:33 PM
In D97373#2585887, @yln wrote:

LIT_FILTER predates LIT_OPTS and the others were added for convenience I guess (not too happy about that).

I see, thanks for the clarification.

Abandoning in favor of LIT_OPTS="-j N".