Fix case of 'diff xxx | head' appearing to succeed even if the diff command returned non-zero exit statux.
authorGustavo J. A. M. Carneiro <gjc@inescporto.pt>
Sun Apr 06 19:22:39 2008 +0100 (22 months ago)
changeset 2882542f4d57464b
parent 2881 81d1080cd0ae
child 2883 0b4cb407bb9e
Fix case of 'diff xxx | head' appearing to succeed even if the diff command returned non-zero exit statux.
wscript
     1.1 --- a/wscript	Fri Apr 04 19:33:39 2008 +0100
     1.2 +++ b/wscript	Sun Apr 06 19:22:39 2008 +0100
     1.3 @@ -677,12 +677,16 @@
     1.4              run_program(testName, command_template=get_command_template())
     1.5  
     1.6              if verbose:
     1.7 -                diffCmd = "diff traces " + refTestDirName + " | head"
     1.8 +                #diffCmd = "diff traces " + refTestDirName + " | head"
     1.9 +                diffCmd = subprocess.Popen(args=["diff", "traces", refTestDirName], stdout=subprocess.PIPE)
    1.10 +                headCmd = subprocess.Popen(args=["diff", "traces", refTestDirName], stdin=diffCmd.stdout)
    1.11 +                rc1 = diffCmd.wait()
    1.12 +                rc2 = headCmd.wait()
    1.13 +                rc = rc1 or rc2
    1.14              else:
    1.15                  diffCmd = "diff traces " + refTestDirName + \
    1.16                      " > /dev/null 2>&1"
    1.17 -
    1.18 -            rc = os.system(diffCmd)
    1.19 +                rc = os.system(diffCmd)
    1.20              if rc:
    1.21                  print "----------"
    1.22                  print "Traces differ in test: test-" + testName