Patchwork [034,of,179,tests-refactor] run-tests: move blacklist skipping to Test.run()

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

Comments

Gregory Szorc - May 2, 2014, 6:37 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1397966571 25200
#      Sat Apr 19 21:02:51 2014 -0700
# Branch stable
# Node ID 068caaa57910a2eac90970679e00d768fdd06a51
# Parent  c2b5960abd286705ac0f3c5275034400b45af1f9
run-tests: move blacklist skipping 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
@@ -579,26 +579,32 @@  class Test(object):
         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")
 
+        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')
+
         # 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)
         self._daemonpids.append(env['DAEMON_PIDS'])
-        createhgrc(env['HGRCPATH'], self._options)
+        createhgrc(env['HGRCPATH'], options)
 
         starttime = time.time()
 
         def updateduration():
             result.duration = time.time() - starttime
 
         try:
             ret, out = self._run(testtmp, replacements, env)
@@ -613,17 +619,17 @@  class Test(object):
         except Exception, e:
             updateduration()
             result.exception = e
 
         killdaemons(env['DAEMON_PIDS'])
 
         result.refout = self._refout
 
-        if not self._options.keep_tmpdir:
+        if not options.keep_tmpdir:
             shutil.rmtree(testtmp)
 
         def describe(ret):
             if ret < 0:
                 return 'killed by signal: %d' % -ret
             return 'returned error code %d' % ret
 
         if ret == SKIPPED_STATUS:
@@ -641,20 +647,20 @@  class Test(object):
                                  ret)
             else:
                 result.skipped = True
                 return self.skip(missing[-1])
         elif ret == 'timeout':
             return self.fail('timed out', ret)
         elif out != self._refout:
             info = {}
-            if not self._options.nodiff:
+            if not options.nodiff:
                 iolock.acquire()
-                if self._options.view:
-                    os.system("%s %s %s" % (self._options.view, self._refpath,
+                if options.view:
+                    os.system("%s %s %s" % (options.view, self._refpath,
                                             self._errpath))
                 else:
                     info = showdiff(self._refout, out, self._refpath,
                                     self._errpath)
                 iolock.release()
             msg = ''
             if info.get('servefail'):
                 msg += 'serve failed and '
@@ -1110,19 +1116,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 (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:
             fp = open(test)
             t = fp.read().lower() + test.lower()
             fp.close()
             for k in options.keywords.lower().split():