Commit b6bfb8bc authored by Daniel Brown's avatar Daniel Brown
Browse files

adding exception check for test server

parent 29c767af
...@@ -363,55 +363,59 @@ class FinesseTestProcess(Thread): ...@@ -363,55 +363,59 @@ class FinesseTestProcess(Thread):
self.cancelCheck() self.cancelCheck()
self.running_kat = out self.running_kat = out
ref_file = os.path.join(REF_DIR,out) try:
out_file = os.path.join(SUITE_PATH,out) ref_file = os.path.join(REF_DIR,out)
out_file = os.path.join(SUITE_PATH,out)
if not os.path.exists(ref_file): if not os.path.exists(ref_file):
raise DiffException("Reference file doesn't exist for " + out, out) raise DiffException("Reference file doesn't exist for " + out, out)
ref_arr = np.loadtxt(ref_file, dtype=np.float64) ref_arr = np.loadtxt(ref_file, dtype=np.float64)
out_arr = np.loadtxt(out_file, dtype=np.float64) out_arr = np.loadtxt(out_file, dtype=np.float64)
if ref_arr.shape != out_arr.shape: if ref_arr.shape != out_arr.shape:
raise DiffException("Reference and output are different shapes", out) raise DiffException("Reference and output are different shapes", out)
# for computing relative errors we need to make sure we # for computing relative errors we need to make sure we
# have no zeros in the data # have no zeros in the data
nzix = (ref_arr != 0) nzix = (ref_arr != 0)
rel_diff = np.abs(out_arr-ref_arr) rel_diff = np.abs(out_arr-ref_arr)
# only compute rel diff for non zero values # only compute rel diff for non zero values
rel_diff[nzix] = np.divide(rel_diff[nzix], np.abs(ref_arr[nzix])) rel_diff[nzix] = np.divide(rel_diff[nzix], np.abs(ref_arr[nzix]))
diff = np.any(rel_diff >= self.diff_rel_eps) diff = np.any(rel_diff >= self.diff_rel_eps)
if diff: if diff:
self.diffFound = True self.diffFound = True
# store the rows which are different # store the rows which are different
ix = np.where(rel_diff >= self.diff_rel_eps)[0][0] ix = np.where(rel_diff >= self.diff_rel_eps)[0][0]
self.output_differences[suite][out] = (True, self.output_differences[suite][out] = (True,
ref_arr[ix], ref_arr[ix],
out_arr[ix], out_arr[ix],
np.max(rel_diff)) np.max(rel_diff))
else: else:
max = np.max(rel_diff) max = np.max(rel_diff)
self.output_differences[suite][out] = (False, max) self.output_differences[suite][out] = (False, max)
# compress the data # compress the data
f_in = open(out_file, 'rb') f_in = open(out_file, 'rb')
f_out = gzip.open(out_file + ".gz", 'wb') f_out = gzip.open(out_file + ".gz", 'wb')
f_out.writelines(f_in) f_out.writelines(f_in)
f_out.close() f_out.close()
f_in.close() f_in.close()
print "removing out file ", out_file
os.remove(out_file)
print "removing out file ", out_file
os.remove(out_file)
except DiffException as ex:
print(str(ex), "output =", out)
self.done_kats.value += 1 self.done_kats.value += 1
print "Finished diffing..." print "Finished diffing..."
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment