[llvm] 72416b1 - Fixed a problem removing temp files

Pete Steinfeld via llvm-commits llvm-commits at lists.llvm.org
Wed May 13 11:41:02 PDT 2020


Author: Pete Steinfeld
Date: 2020-05-13T11:40:19-07:00
New Revision: 72416b136ec67e3036add616875438dc93bec149

URL: https://github.com/llvm/llvm-project/commit/72416b136ec67e3036add616875438dc93bec149
DIFF: https://github.com/llvm/llvm-project/commit/72416b136ec67e3036add616875438dc93bec149.diff

LOG: Fixed a problem removing temp files

Summary:
Before making this change, whenever I ran "check-flang", I'd get an
error message like:

llvm-lit: /mnt/c/GitHub/f18/c751/flang/build/bin/../../../llvm/utils/lit/lit/main.py:252: warning: Failed to delete temp directory '/tmp/lit_tmp_gOKUIh'

With this change, there's no such message in the output, and the temp
directory is successfully removed.

Note that my working environment is on Windows 10 running Windows
Subsystem for Linux using the Ubuntu app.  I'm running Python version
2.7.1.

Earlier versions of Python do not contain `shutil`.  It may be that this
module was available on Windows systems later than other platforms.
Upgrading my version of Python made the problem go away

I don't believe that timing was a problem since inserting a long delay
didn't fix things.

So I added some text to the error message recommending that the user
upgrade their version of Python if they run into this problem.

Reviewers: yln, DavidTruby

Subscribers: delcypher, llvm-commits

Tags: #llvm

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

Added: 
    

Modified: 
    llvm/utils/lit/lit/main.py

Removed: 
    


################################################################################
diff  --git a/llvm/utils/lit/lit/main.py b/llvm/utils/lit/lit/main.py
index f9b54805d70c..d2958590aa8a 100755
--- a/llvm/utils/lit/lit/main.py
+++ b/llvm/utils/lit/lit/main.py
@@ -247,9 +247,8 @@ def execute_in_tmp_dir(run, lit_config):
             try:
                 import shutil
                 shutil.rmtree(tmp_dir)
-            except:
-                # FIXME: Re-try after timeout on Windows.
-                lit_config.warning("Failed to delete temp directory '%s'" % tmp_dir)
+            except Exception as e: 
+                lit_config.warning("Failed to delete temp directory '%s', try upgrading your version of Python to fix this" % tmp_dir)
 
 
 def print_histogram(tests):


        


More information about the llvm-commits mailing list