[all-commits] [llvm/llvm-project] 27731f: [llvm][lit] Respect GTEST_TOTAL_SHARDS and GTEST_S...

Joe Loser via All-commits all-commits at lists.llvm.org
Fri Sep 9 16:48:20 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 27731f047587162b820cc35c31ec8d36147940f5
      https://github.com/llvm/llvm-project/commit/27731f047587162b820cc35c31ec8d36147940f5
  Author: Joe Loser <joeloser at fastmail.com>
  Date:   2022-09-09 (Fri, 09 Sep 2022)

  Changed paths:
    M llvm/utils/lit/lit/formats/googletest.py
    A llvm/utils/lit/tests/Inputs/googletest-format-respect-gtest-sharding-env-vars/DummySubDir/OneTest.py
    A llvm/utils/lit/tests/Inputs/googletest-format-respect-gtest-sharding-env-vars/lit.cfg
    A llvm/utils/lit/tests/googletest-format-respect-gtest-sharding-env-vars.py

  Log Message:
  -----------
  [llvm][lit] Respect GTEST_TOTAL_SHARDS and GTEST_SHARD_INDEX env vars

There are a variety of issues with using GTest sharding by default for users of
`lit` using the Google Test formatter as mentioned in
https://github.com/llvm/llvm-project/issues/56492 and
https://github.com/llvm/llvm-project/issues/56491.

Currently, there is no way for users to explicitly control the sharding
behavior, even with the environment variables that GTest provides. This patch
teaches the `googletest` formatter to actually respect `GTEST_TOTAL_SHARDS`
and `GTEST_SHARD_INDEX` environment variables if they are set.

In practice, we could go one step further and not do any of the post-processing
of the JSON files if `GTEST_TOTAL_SHARDS` is `1` for example, but that it left
as a follow-up if desired.  There may be preferred alternative approaches to
disabling sharding entirely through another mechanism, such as a lit config
variable.

Differential Revision: https://reviews.llvm.org/D133542




More information about the All-commits mailing list