Patchwork [035,of,179,tests-refactor] run-tests: move retesting result to Test.run()

login
register
mail settings
Submitter Gregory Szorc
Date May 2, 2014, 6:37 p.m.
Message ID <8f54e7d2536ab22b6117.1399055872@vm-ubuntu-main.gateway.sonic.net>
Download mbox | patch
Permalink /patch/4530/
State Accepted
Commit 3f79bacbf80bcfab07568dde64c53ea9f54d6abe
Headers show

Comments

Gregory Szorc - May 2, 2014, 6:37 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1397966648 25200
#      Sat Apr 19 21:04:08 2014 -0700
# Branch stable
# Node ID 8f54e7d2536ab22b6117f5e77e2c6981b9b14c6b
# Parent  068caaa57910a2eac90970679e00d768fdd06a51
run-tests: move retesting result to Test.run()

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -585,16 +585,19 @@  class Test(object):
             return self.skip("Doesn't exist")
 
         options = self._options
         if not (options.whitelisted and self._test in options.whitelisted):
             if options.blacklist and self._test in options.blacklist:
                 result.skipped = True
                 return self.skip('blacklisted')
 
+            if options.retest and not os.path.exists('%s.err' % self._test):
+                return self.ignore('not retesting')
+
         # 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)
@@ -756,16 +759,19 @@  class Test(object):
         return warned and '~' or '!', self._test, msg
 
     def skip(self, msg):
         if self._options.verbose:
             log("\nSkipping %s: %s" % (self._path, msg))
 
         return 's', self._test, msg
 
+    def ignore(self, msg):
+        return 'i', self._test, msg
+
 class TestResult(object):
     """Holds the result of a test execution."""
 
     def __init__(self):
         self.ret = None
         self.out = None
         self.duration = None
         self.exception = None
@@ -1108,27 +1114,21 @@  def run(cmd, wd, options, replacements, 
 def runone(options, test, count):
     '''returns a result element: (code, test, msg)'''
 
     def skip(msg):
         if options.verbose:
             log("\nSkipping %s: %s" % (testpath, msg))
         return 's', test, msg
 
-    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 (options.whitelisted and test in options.whitelisted):
-        if options.retest and not os.path.exists(test + ".err"):
-            return ignore("not retesting")
-
         if options.keywords:
             fp = open(test)
             t = fp.read().lower() + test.lower()
             fp.close()
             for k in options.keywords.lower().split():
                 if k in t:
                     break
                 else: