[PATCH 2 of 3] run-tests: remove resultslock since it serves no useful purpose

Siddharth Agarwal sid0 at fb.com
Fri Nov 9 17:17:14 CST 2012


# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1352502575 28800
# Node ID b13852f4d046f29c49ec4171e435b86bb8fad017
# Parent  f333cd9952248730977f8129a3ef34e7a26898e7
run-tests: remove resultslock since it serves no useful purpose

Each child process has its own copy of the results dict, so all access to the results dict is serial.

diff -r f333cd995224 -r b13852f4d046 tests/run-tests.py
--- a/tests/run-tests.py	Fri Nov 09 14:42:36 2012 -0800
+++ b/tests/run-tests.py	Fri Nov 09 15:09:35 2012 -0800
@@ -754,18 +754,13 @@
     True -> passed
     False -> failed'''
 
-    global results, resultslock, iolock
+    global results, iolock
 
     testpath = os.path.join(TESTDIR, test)
 
-    def result(l, e):
-        resultslock.acquire()
-        results[l].append(e)
-        resultslock.release()
-
     def skip(msg):
         if not options.verbose:
-            result('s', (test, msg))
+            results['s'].append((test, msg))
         else:
             iolock.acquire()
             print "\nSkipping %s: %s" % (testpath, msg)
@@ -788,15 +783,15 @@
                     rename(testpath + ".err", testpath)
                 else:
                     rename(testpath + ".err", testpath + ".out")
-                result('p', test)
+                success(test)
                 return
-        result('f', (test, msg))
+        results['f'].append((test, msg))
 
     def success():
-        result('p', test)
+        results['p'].append(test)
 
     def ignore(msg):
-        result('i', (test, msg))
+        results['i'].append((test, msg))
 
     if (os.path.basename(test).startswith("test-") and '~' not in test and
         ('.' not in test or test.endswith('.py') or
@@ -1099,7 +1094,6 @@
     sys.exit(failures != 0)
 
 results = dict(p=[], f=[], s=[], i=[])
-resultslock = threading.Lock()
 iolock = threading.Lock()
 
 def runqueue(options, tests):


More information about the Mercurial-devel mailing list