Fix a diff|head race condition; Fix regression error messages to indicate the new waf commands to run regression tests.
authorGustavo J. A. M. Carneiro <gjc@inescporto.pt>
Sun, 06 Apr 2008 19:58:29 +0100
changeset 2884 635509281306
parent 2883 0b4cb407bb9e
child 2885 34fd5f64cf72
Fix a diff|head race condition; Fix regression error messages to indicate the new waf commands to run regression tests.
wscript
--- a/wscript	Sun Apr 06 19:54:39 2008 +0100
+++ b/wscript	Sun Apr 06 19:58:29 2008 +0100
@@ -127,7 +127,7 @@
                    help=("Enable regression testing; only used for the 'check' target"),
                    default=False, dest='regression', action="store_true")
     opt.add_option('--regression-generate',
-                   help=("Generate new regression test traces; only used for the 'check' target"),
+                   help=("Generate new regression test traces."),
                    default=False, dest='regression_generate', action="store_true")
     opt.add_option('--regression-tests',
                    help=('For regression testing, only run/generate the indicated regression tests, '
@@ -678,10 +678,12 @@
 
             if verbose:
                 #diffCmd = "diff traces " + refTestDirName + " | head"
-                diffCmd = subprocess.Popen(args=["diff", "traces", refTestDirName], stdout=subprocess.PIPE)
-                headCmd = subprocess.Popen(args=["diff", "traces", refTestDirName], stdin=diffCmd.stdout)
+                diffCmd = subprocess.Popen(["diff", "traces", refTestDirName],
+                                           stderr=subprocess.PIPE, stdout=subprocess.PIPE)
+                headCmd = subprocess.Popen("head", stdin=diffCmd.stdout)
+                rc2 = headCmd.wait()
+                diffCmd.stdout.close()
                 rc1 = diffCmd.wait()
-                rc2 = headCmd.wait()
                 rc = rc1 or rc2
             else:
                 diffCmd = "diff traces " + refTestDirName + \
@@ -690,11 +692,11 @@
             if rc:
                 print "----------"
                 print "Traces differ in test: test-" + testName
-                print "Reference traces in directory: " + refTestDirName
+                print "Reference traces in directory: regression/" + refTestDirName
                 print "Traces in directory: traces"
                 print "Rerun regression test as: " + \
-                    "\"python regression.py test-" + testName + "\""
-                print "Then do \"diff -u traces " + refTestDirName + \
+                    "\"./waf --regression --regression-tests=test-" + testName + "\""
+                print "Then do \"diff -u regression/traces regression/" + refTestDirName + \
                     "\" for details"
                 print "----------"
             return rc