tests: add run-tests --changed option for running tests changed in revisions stable
authorMads Kiilerich <madski@unity3d.com>
Fri, 28 Feb 2014 02:09:00 +0100
branchstable
changeset 1361 1d3aa8779efb
parent 1359 e23422941bae
child 1362 a5dabff2e764
child 1363 58a33a3ed565
tests: add run-tests --changed option for running tests changed in revisions Convenient when polishing patches and changing details of how they change test output. This will probably break in weird ways for revsets with special quoting ... but it is good enough for run-tests. Usage example: yes | ./run-tests.py -li --changed qparent [ original upstream message ]
tests/run-tests.py
--- a/tests/run-tests.py	Mon Mar 10 17:52:42 2014 -0400
+++ b/tests/run-tests.py	Fri Feb 28 02:09:00 2014 +0100
@@ -141,6 +141,8 @@
         help="skip tests listed in the specified blacklist file")
     parser.add_option("--whitelist", action="append",
         help="always run tests listed in the specified whitelist file")
+    parser.add_option("--changed", type="string",
+        help="run tests that are changed in parent rev or working directory")
     parser.add_option("-C", "--annotate", action="store_true",
         help="output files annotated with coverage")
     parser.add_option("-c", "--cover", action="store_true",
@@ -1181,7 +1183,13 @@
     checktools()
 
     if not args:
-        args = os.listdir(".")
+        if options.changed:
+            proc = Popen4('hg st --rev "%s" -man0 .' % options.changed,
+                          None, 0)
+            stdout, stderr = proc.communicate()
+            args = stdout.strip('\0').split('\0')
+        else:
+            args = os.listdir(".")
 
     tests = [t for t in args
              if t.startswith("test-")