Patchwork [037,of,179,tests-refactor] run-tests: move test name filter to Test.run()

login
register
mail settings
Submitter Gregory Szorc
Date May 2, 2014, 6:37 p.m.
Message ID <684520300db044d417f8.1399055874@vm-ubuntu-main.gateway.sonic.net>
Download mbox | patch
Permalink /patch/4531/
State Accepted
Commit 60ce874f5b06e61636ec5ab8906dc99dd98bc3df
Headers show

Comments

Gregory Szorc - May 2, 2014, 6:37 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1397966883 25200
#      Sat Apr 19 21:08:03 2014 -0700
# Branch stable
# Node ID 684520300db044d417f868fa6157570b33fcae31
# Parent  da0668d3b1d16d88b6788f113012d911692504fa
run-tests: move test name filter 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
@@ -598,16 +598,19 @@  class Test(object):
                 t = f.read().lower() + self._test.lower()
                 f.close()
                 for k in options.keywords.lower().split():
                     if k in t:
                         break
                     else:
                         return self.ignore("doesn't match keyword")
 
+        if not os.path.basename(self._test.lower()).startswith('test-'):
+            return self.skip('not a test file')
+
         # 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)
@@ -1128,18 +1131,16 @@  def runone(options, test, count):
         if options.verbose:
             log("\nSkipping %s: %s" % (testpath, msg))
         return 's', test, msg
 
     testpath = os.path.join(TESTDIR, test)
     err = os.path.join(TESTDIR, test + ".err")
     lctest = test.lower()
 
-    if not os.path.basename(lctest).startswith("test-"):
-        return skip("not a test file")
     for ext, cls, out in testtypes:
         if lctest.endswith(ext):
             runner = cls
             ref = os.path.join(TESTDIR, test + out)
             break
     else:
         return skip("unknown test type")