[PATCH 5 of 7] run-tests: add possibility for test-runners to report a "warned" test result

Simon Heimberg simohe at besonet.ch
Thu Feb 13 16:36:59 CST 2014


# HG changeset patch
# User Simon Heimberg <simohe at besonet.ch>
# Date 1392276373 -3600
#      Thu Feb 13 08:26:13 2014 +0100
# Node ID 92f9965a571a7134e37e7043a45cecd1646f04c8
# Parent  8a00507aa070e25b79f43f70d94b0a0034188ea8
run-tests: add possibility for test-runners to report a "warned" test result

A test result is recognized as "warned" when the test runner returns the exit
code False. (False is similar to 0, which is reporting a command has run
sucessfully.)

The only difference in display is that the failure message while running writes
"Warning:" instead of "ERROR:". The diff output is the same as when the test
fails. Runing "run-tests.py -i" asks to accept the changed result also for
tests reported as "warned".

When running tests, a "warned" test would look like this:
..
--- xxxx\tests\test-something.t
+++ xxxx\tests\test-something.t.err
@@ -1279,7 +1279,7 @@
   $ echo anything
   $ hg commit -S -m whatever
   committing subrepository s
-  committing subrepository s/sbs
+  committing subrepository s/sbs (glob)
   warning: something happened
   committing subrepository t
   $ echo something

Warning: xxxx\tests\test-sOMETHING.t output changed
~.s...s...s..


Reporting a test result as "warned" will be used in following patches.

diff -r 8a00507aa070 -r 92f9965a571a tests/run-tests.py
--- a/tests/run-tests.py	Thu Feb 13 08:17:39 2014 +0100
+++ b/tests/run-tests.py	Thu Feb 13 08:26:13 2014 +0100
@@ -881,8 +881,9 @@
         return 's', test, msg
 
     def fail(msg, ret):
+        warned = ret is False
         if not options.nodiff:
-            log("\nERROR: %s %s" % (testpath, msg))
+            log("\n%s: %s %s" % (warned and 'Warning' or 'ERROR', test, msg))
         if (not ret and options.interactive
             and os.path.exists(testpath + ".err")):
             iolock.acquire()
@@ -895,7 +896,7 @@
                 else:
                     rename(testpath + ".err", testpath + ".out")
                 return '.', test, ''
-        return '!', test, msg
+        return warned and '~' or '!', test, msg
 
     def success():
         return '.', test, ''




More information about the Mercurial-devel mailing list