comparison tests/run-tests.py @ 2213:6f76a479ae51

run-tests.py must print changed test output no matter what exit code is.
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Fri, 05 May 2006 10:41:38 -0700
parents a56fc34d6e23
children 3fd603eb6add
comparison
equal deleted inserted replaced
2212:8164e3f31638 2213:6f76a479ae51
174 174
175 vlog("# Running", cmd) 175 vlog("# Running", cmd)
176 ret, out = run(cmd) 176 ret, out = run(cmd)
177 vlog("# Ret was:", ret) 177 vlog("# Ret was:", ret)
178 178
179 if ret == 0: 179 diffret = 0
180 # If reference output file exists, check test output against it 180 # If reference output file exists, check test output against it
181 if os.path.exists(ref): 181 if os.path.exists(ref):
182 f = open(ref, "r") 182 f = open(ref, "r")
183 ref_out = f.read().splitlines() 183 ref_out = f.read().splitlines()
184 f.close() 184 f.close()
185 if out != ref_out: 185 if out != ref_out:
186 ret = 1 186 diffret = 1
187 print "\nERROR: %s output changed" % (test) 187 print "\nERROR: %s output changed" % (test)
188 show_diff(ref_out, out) 188 show_diff(ref_out, out)
189 else: 189 if ret:
190 print "\nERROR: %s failed with error code %d" % (test, ret) 190 print "\nERROR: %s failed with error code %d" % (test, ret)
191 elif diffret:
192 ret = diffret
191 193
192 if ret != 0: # Save errors to a file for diagnosis 194 if ret != 0: # Save errors to a file for diagnosis
193 f = open(err, "w") 195 f = open(err, "w")
194 for line in out: 196 for line in out:
195 f.write(line) 197 f.write(line)