[PATCH] D133542: [llvm][lit] Respect GTEST_TOTAL_SHARDS and GTEST_SHARD_INDEX env vars
Joe Loser via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 9 12:48:41 PDT 2022
jloser added a comment.
In D133542#3778957 <https://reviews.llvm.org/D133542#3778957>, @ychen wrote:
> Looks good. I think this is useful to discover whether tests are affecting each other or to disable sharding if the platform has trouble correctly emitting & parsing the GTest JSON result file (like the Github issues you mentioned). On a side note, if you think the LIT sharding implementation is buggy, it is better to submit a bug report.
>
> Could you please add a test? Thanks.
Just added a test! Let me know if you see a way to simplify it — I'm new to using `FileCheck` tests, so I just created a new directory so the environment variables wouldn't conflict with the other test in `googletest-format.py`. Thanks!
As to the use cases that this patch enables, I want to disable sharding downstream since we're seeing some issues with emitting malformed JSON files that the issues I linked mentioned. If I come across any bugs in the lit sharding itself, I will certainly file GitHub issues.
================
Comment at: llvm/utils/lit/lit/formats/googletest.py:115
'GTEST_SHUFFLE': '1' if use_shuffle else '0',
- 'GTEST_TOTAL_SHARDS': total_shards,
- 'GTEST_SHARD_INDEX': shard_idx
+ 'GTEST_TOTAL_SHARDS': os.getenv("GTEST_TOTAL_SHARDS", total_shards),
+ 'GTEST_SHARD_INDEX': os.getenv("GTEST_SHARD_INDEX", shard_idx)
----------------
ychen wrote:
> use `os.environ.get()`
Fixed!
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D133542/new/
https://reviews.llvm.org/D133542
More information about the llvm-commits
mailing list