Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
finesse
pykat
Commits
b6bfb8bc
Commit
b6bfb8bc
authored
May 26, 2015
by
Daniel Brown
Browse files
adding exception check for test server
parent
29c767af
Changes
1
Hide whitespace changes
Inline
Side-by-side
pykat/testing/test.py
View file @
b6bfb8bc
...
...
@@ -363,55 +363,59 @@ class FinesseTestProcess(Thread):
self
.
cancelCheck
()
self
.
running_kat
=
out
ref_file
=
os
.
path
.
join
(
REF_DIR
,
out
)
out_file
=
os
.
path
.
join
(
SUITE_PATH
,
out
)
try
:
ref_file
=
os
.
path
.
join
(
REF_DIR
,
out
)
out_file
=
os
.
path
.
join
(
SUITE_PATH
,
out
)
if
not
os
.
path
.
exists
(
ref_file
):
raise
DiffException
(
"Reference file doesn't exist for "
+
out
,
out
)
if
not
os
.
path
.
exists
(
ref_file
):
raise
DiffException
(
"Reference file doesn't exist for "
+
out
,
out
)
ref_arr
=
np
.
loadtxt
(
ref_file
,
dtype
=
np
.
float64
)
out_arr
=
np
.
loadtxt
(
out_file
,
dtype
=
np
.
float64
)
ref_arr
=
np
.
loadtxt
(
ref_file
,
dtype
=
np
.
float64
)
out_arr
=
np
.
loadtxt
(
out_file
,
dtype
=
np
.
float64
)
if
ref_arr
.
shape
!=
out_arr
.
shape
:
raise
DiffException
(
"Reference and output are different shapes"
,
out
)
if
ref_arr
.
shape
!=
out_arr
.
shape
:
raise
DiffException
(
"Reference and output are different shapes"
,
out
)
# for computing relative errors we need to make sure we
# have no zeros in the data
nzix
=
(
ref_arr
!=
0
)
# for computing relative errors we need to make sure we
# have no zeros in the data
nzix
=
(
ref_arr
!=
0
)
rel_diff
=
np
.
abs
(
out_arr
-
ref_arr
)
# only compute rel diff for non zero values
rel_diff
[
nzix
]
=
np
.
divide
(
rel_diff
[
nzix
],
np
.
abs
(
ref_arr
[
nzix
]))
rel_diff
=
np
.
abs
(
out_arr
-
ref_arr
)
# only compute rel diff for non zero values
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
:
self
.
diffFound
=
True
if
diff
:
self
.
diffFound
=
True
# store the rows which are different
ix
=
np
.
where
(
rel_diff
>=
self
.
diff_rel_eps
)[
0
][
0
]
# store the rows which are different
ix
=
np
.
where
(
rel_diff
>=
self
.
diff_rel_eps
)[
0
][
0
]
self
.
output_differences
[
suite
][
out
]
=
(
True
,
ref_arr
[
ix
],
out_arr
[
ix
],
np
.
max
(
rel_diff
))
else
:
max
=
np
.
max
(
rel_diff
)
self
.
output_differences
[
suite
][
out
]
=
(
True
,
ref_arr
[
ix
],
out_arr
[
ix
],
np
.
max
(
rel_diff
))
else
:
max
=
np
.
max
(
rel_diff
)
self
.
output_differences
[
suite
][
out
]
=
(
False
,
max
)
self
.
output_differences
[
suite
][
out
]
=
(
False
,
max
)
# compress the data
f_in
=
open
(
out_file
,
'rb'
)
f_out
=
gzip
.
open
(
out_file
+
".gz"
,
'wb'
)
f_out
.
writelines
(
f_in
)
f_out
.
close
()
f_in
.
close
()
print
"removing out file "
,
out_file
os
.
remove
(
out_file
)
# compress the data
f_in
=
open
(
out_file
,
'rb'
)
f_out
=
gzip
.
open
(
out_file
+
".gz"
,
'wb'
)
f_out
.
writelines
(
f_in
)
f_out
.
close
()
f_in
.
close
()
print
"removing out file "
,
out_file
os
.
remove
(
out_file
)
except
DiffException
as
ex
:
print
(
str
(
ex
),
"output ="
,
out
)
self
.
done_kats
.
value
+=
1
print
"Finished diffing..."
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment