[PATCH] D35880: Un-revert "Teach the CMake build system to run lit's test suite. These can be run"

George Karpenkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 26 10:55:26 PDT 2017


george.karpenkov added a subscriber: ddunbar.
george.karpenkov added a comment.

@mgorny The problem here is that `%t` is expanded in a deterministic way based on a test filename.
This makes running concurrently the same test prone to race conditions.

One way to fix it would be to create a true temporary file instead:

  diff --git a/utils/lit/lit/TestRunner.py b/utils/lit/lit/TestRunner.py
  index a60a0f8..40f8c71 100644
  --- a/utils/lit/lit/TestRunner.py
  +++ b/utils/lit/lit/TestRunner.py
  @@ -817,7 +817,8 @@ def getDefaultSubstitutions(test, tmpDir, tmpBase, normalize_slashes=False):
       substitutions = []
       substitutions.extend([('%%', '#_MARKER_#')])
       substitutions.extend(test.config.substitutions)
  -    tmpName = tmpBase + '.tmp'
  +    fd, filename = tempfile.mkstemp()
  +    tmpName = filename
       baseName = os.path.basename(tmpBase)
       substitutions.extend([('%s', sourcepath),
                             ('%S', sourcedir),

(and we would have to delete it later).

This could be also undesirable, making figuring out test behavior hard to reproduce.
Again, an easy solution would be to add a flag and an environment variable to switch between the two modes (temporary deleted file vs. persistent file).
This might be also desirable for CI, which might be running multiple jobs in parallel on a single checkout.
@ddunbar any comments?


https://reviews.llvm.org/D35880





More information about the llvm-commits mailing list