Mercurial > hg
comparison tests/run-tests.py @ 20508:91d4f82c2d3b
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.
author | Simon Heimberg <simohe@besonet.ch> |
---|---|
date | Thu, 13 Feb 2014 08:26:13 +0100 |
parents | 38444739a69f |
children | 8ac08939c3fc |
comparison
equal
deleted
inserted
replaced
20507:38444739a69f | 20508:91d4f82c2d3b |
---|---|
879 if options.verbose: | 879 if options.verbose: |
880 log("\nSkipping %s: %s" % (testpath, msg)) | 880 log("\nSkipping %s: %s" % (testpath, msg)) |
881 return 's', test, msg | 881 return 's', test, msg |
882 | 882 |
883 def fail(msg, ret): | 883 def fail(msg, ret): |
884 warned = ret is False | |
884 if not options.nodiff: | 885 if not options.nodiff: |
885 log("\nERROR: %s %s" % (testpath, msg)) | 886 log("\n%s: %s %s" % (warned and 'Warning' or 'ERROR', test, msg)) |
886 if (not ret and options.interactive | 887 if (not ret and options.interactive |
887 and os.path.exists(testpath + ".err")): | 888 and os.path.exists(testpath + ".err")): |
888 iolock.acquire() | 889 iolock.acquire() |
889 print "Accept this change? [n] ", | 890 print "Accept this change? [n] ", |
890 answer = sys.stdin.readline().strip() | 891 answer = sys.stdin.readline().strip() |
893 if test.endswith(".t"): | 894 if test.endswith(".t"): |
894 rename(testpath + ".err", testpath) | 895 rename(testpath + ".err", testpath) |
895 else: | 896 else: |
896 rename(testpath + ".err", testpath + ".out") | 897 rename(testpath + ".err", testpath + ".out") |
897 return '.', test, '' | 898 return '.', test, '' |
898 return '!', test, msg | 899 return warned and '~' or '!', test, msg |
899 | 900 |
900 def success(): | 901 def success(): |
901 return '.', test, '' | 902 return '.', test, '' |
902 | 903 |
903 def ignore(msg): | 904 def ignore(msg): |