Less error hiding anti-pattern when running regression tests.
authorGustavo J. A. M. Carneiro <gjc@inescporto.pt>
Thu Apr 02 13:16:13 2009 +0100 (10 months ago)
changeset 4308b8528d30dfb3
parent 4307 a4f0b6527129
child 4309 bf8c338c7820
Less error hiding anti-pattern when running regression tests.
regression.py
     1.1 --- a/regression.py	Wed Apr 01 19:16:18 2009 -0400
     1.2 +++ b/regression.py	Thu Apr 02 13:16:13 2009 +0100
     1.3 @@ -3,7 +3,7 @@
     1.4  import sys
     1.5  import shutil
     1.6  import pproc as subprocess
     1.7 -import urllib
     1.8 +import errno
     1.9  
    1.10  # WAF modules
    1.11  import Build
    1.12 @@ -118,7 +118,11 @@
    1.13  
    1.14          if Options.options.regression_generate:
    1.15              # clean the target dir
    1.16 -            shutil.rmtree(reference_traces_path, ignore_errors=True)
    1.17 +            try:
    1.18 +                shutil.rmtree(trace_output_path)
    1.19 +            except OSError, ex:
    1.20 +                if ex.errno not in [errno.ENOENT]:
    1.21 +                    raise
    1.22              os.makedirs(reference_traces_path)
    1.23              result = self.run_reference_generate(reference_traces_path, program, arguments, is_pyscript)
    1.24              if result == 0:
    1.25 @@ -127,7 +131,11 @@
    1.26                  print "GENERATE FAIL " + self.test_name
    1.27          else:
    1.28              # clean the target dir
    1.29 -            shutil.rmtree(trace_output_path, ignore_errors=True)
    1.30 +            try:
    1.31 +                shutil.rmtree(trace_output_path)
    1.32 +            except OSError, ex:
    1.33 +                if ex.errno not in [errno.ENOENT]:
    1.34 +                    raise
    1.35              os.makedirs(trace_output_path)
    1.36              # run it
    1.37              result = self.run_reference_test(reference_traces_path, trace_output_path, program, arguments, is_pyscript)