[PATCH] D34732: Clean temp directories before running lit

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 27 18:11:12 PDT 2017


zturner created this revision.
Herald added subscribers: aheejin, mgorny.
Herald added a reviewer: modocache.

Currently, lit creates a little "sandbox" for each test to use by doing two things:

1. Creating a directory in the build folder for each test directory in the source tree.
2. Within the folder in directory 1, creating a unique file prefix that can be appended to to create unique per-test filenames that an individual test can use.

No effort is made to clean these files up between test runs, which creates two problems.

First is that we just leak files.  If a test changes, or gets removed, or moves to a different location, all the files remain in the old location.  (Very) gradually this can contribute to out of disk space errors on build bots, but in general it's just bad practice.

More sinister is that leaked files from previous runs can lead to false positives in tests.

This patch makes lit clean up the output directory before each run.  One existing design choice made this tricky: A tests' temporary folder is of the form `<build-dir>/test/SourceDir/Output`.  We can't just rmtree the entire `<build-dir>/test` because there are some lit configuration files in there.  So we would have to enumerate the top-level test directory deleting only certain ones.

To simplify this, I inverted the heirarchy, so that now it's `<build-dir>/test/Output/SourceDir`.  this way we can just indiscriminately rmtree anything under `Output` without worrying about what it is.

A few tests on Windows show that the rmtree takes about 1.75 seconds with a full output tree, which is a negligible portion of the overall test suite run.  On Linux I expect the rmtree to be even faster.

There is one test failure with this patch, in `llvm-symbolizer.test`.  For some reason it's demangling symbols differently, which is quite bizarre.  Still looking into this, but throwing up this patch early for high level comments.


https://reviews.llvm.org/D34732

Files:
  llvm/test/Other/lit-globbing.ll
  llvm/test/Unit/lit.cfg
  llvm/utils/FileEdit/CMakeLists.txt
  llvm/utils/FileEdit/FileEdit.cpp
  llvm/utils/lit/lit/Test.py
  llvm/utils/lit/lit/TestRunner.py
  llvm/utils/lit/lit/run.py

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34732.104328.patch
Type: text/x-patch
Size: 17780 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170628/e1450a55/attachment.bin>


More information about the llvm-commits mailing list