10
10
import binascii
11
11
import difflib
12
12
import logging
13
+ import pprint
13
14
14
15
def parse_output (a , fmt ):
15
16
"""Parse the output according to specified format.
@@ -65,6 +66,7 @@ def bctest(testDir, testObj, exeext):
65
66
raise
66
67
67
68
if outputData :
69
+ data_mismatch , formatting_mismatch = False , False
68
70
# Parse command output and expected output
69
71
try :
70
72
a_parsed = parse_output (outs [0 ], outputType )
@@ -79,7 +81,7 @@ def bctest(testDir, testObj, exeext):
79
81
# Compare data
80
82
if a_parsed != b_parsed :
81
83
logging .error ("Output data mismatch for " + outputFn + " (format " + outputType + ")" )
82
- raise Exception
84
+ data_mismatch = True
83
85
# Compare formatting
84
86
if outs [0 ] != outputData :
85
87
error_message = "Output formatting mismatch for " + outputFn + ":\n "
@@ -88,7 +90,9 @@ def bctest(testDir, testObj, exeext):
88
90
fromfile = outputFn ,
89
91
tofile = "returned" ))
90
92
logging .error (error_message )
91
- raise Exception
93
+ formatting_mismatch = True
94
+
95
+ assert not data_mismatch and not formatting_mismatch
92
96
93
97
# Compare the return code to the expected return code
94
98
wantRC = 0
@@ -115,7 +119,9 @@ def bctester(testDir, input_basename, buildenv):
115
119
failed_testcases .append (testObj ["description" ])
116
120
117
121
if failed_testcases :
118
- logging .error ("FAILED TESTCASES: [" + ", " .join (failed_testcases ) + "]" )
122
+ error_message = "FAILED_TESTCASES:\n "
123
+ error_message += pprint .pformat (failed_testcases , width = 400 )
124
+ logging .error (error_message )
119
125
sys .exit (1 )
120
126
else :
121
127
sys .exit (0 )
0 commit comments