Patchwork [033,of,179,tests-refactor] run-tests: check for test file existence in Test.run()

login
register
mail settings
Submitter Gregory Szorc
Date May 2, 2014, 6:37 p.m.
Message ID <c2b5960abd286705ac0f.1399055870@vm-ubuntu-main.gateway.sonic.net>
Download mbox | patch
Permalink /patch/4528/
State Accepted
Commit 9da0761a22a1d2ae63a970d79940b8ceb33e578b
Headers show

Comments

Gregory Szorc - May 2, 2014, 6:37 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1397966424 25200
#      Sat Apr 19 21:00:24 2014 -0700
# Branch stable
# Node ID c2b5960abd286705ac0f3c5275034400b45af1f9
# Parent  81791dd44f6a46347241632be793ae3aa59da98d
run-tests: check for test file existence in Test.run()

We delay this a little bit. But it shouldn't really matter when the
check is performed.

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -575,16 +575,20 @@  class Test(object):
     def __del__(self):
         for entry in self._daemonpids:
             killdaemons(entry)
 
         if self._threadtmp and not self._options.keep_tmpdir:
             shutil.rmtree(self._threadtmp, True)
 
     def run(self, result):
+        if not os.path.exists(self._path):
+            result.skipped = True
+            return self.skip("Doesn't exist")
+
         # Remove any previous output files.
         if os.path.exists(self._errpath):
             os.remove(self._errpath)
 
         testtmp = os.path.join(self._threadtmp, os.path.basename(self._path))
         os.mkdir(testtmp)
         replacements, port = self._getreplacements(testtmp)
         env = self._getenv(testtmp, port)
@@ -1105,19 +1109,16 @@  def runone(options, test, count):
 
     def ignore(msg):
         return 'i', test, msg
 
     testpath = os.path.join(TESTDIR, test)
     err = os.path.join(TESTDIR, test + ".err")
     lctest = test.lower()
 
-    if not os.path.exists(testpath):
-            return skip("doesn't exist")
-
     if not (options.whitelisted and test in options.whitelisted):
         if options.blacklist and test in options.blacklist:
             return skip("blacklisted")
 
         if options.retest and not os.path.exists(test + ".err"):
             return ignore("not retesting")
 
         if options.keywords: