Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Matthew P. Russell
unit_test
Commits
c2e4935e
Commit
c2e4935e
authored
Jan 06, 2021
by
Matthew P. Russell
Browse files
Update unit_test
parent
b884e04a
Changes
1
Hide whitespace changes
Inline
Side-by-side
bin/unit_test
View file @
c2e4935e
...
...
@@ -9,7 +9,6 @@ unit_test - a frictionless C++ unit testing framework.
details relating to this script can be found in the README
"""
import
subprocess
import
sys
import
re
...
...
@@ -17,7 +16,6 @@ import os
import
shutil
from
math
import
ceil
#-----------------------------------------------------------------------------#
# initial setup #
#-----------------------------------------------------------------------------#
...
...
@@ -43,7 +41,6 @@ def inform(s, color=INFO, linebreak=False):
if
linebreak
:
sys
.
stderr
.
write
(
"-----------------------------------
\n
"
)
def
std_out
(
s
,
color
=
OSTREAM
,
linebreak
=
False
):
sys
.
stderr
.
write
(
"
\n\033
[1;"
+
color
+
"m"
+
s
+
"
\033
[0m
\n
"
)
...
...
@@ -51,7 +48,6 @@ def std_out(s, color=OSTREAM, linebreak=False):
if
linebreak
:
sys
.
stderr
.
write
(
"------
\n
"
)
# cleanup removes the copied driver
def
cleanup
():
os
.
remove
(
DRIVERFILE
)
...
...
@@ -202,10 +198,10 @@ for test in test_names:
if
VALGRIND_RESULT
.
returncode
!=
0
:
valgrind_passed
=
False
else
:
valgrind_passed
=
True
#
Assume True, and
set to False if leaks are present
valgrind_passed
=
True
#
only
set to False if leaks are present
valgrind_
passphrase
=
"All heap blocks were freed -- no leaks are possible"
if
valgrind_
passphrase
not
in
VALGRIND_RESULT
.
stderr
:
passphrase
=
"All heap blocks were freed -- no leaks are possible"
if
passphrase
not
in
VALGRIND_RESULT
.
stderr
:
# only capture the part after "LEAK SUMMARY"
VALGRIND_INFO
=
VALGRIND_RESULT
.
stderr
.
split
(
"LEAK SUMMARY"
)[
1
]
...
...
@@ -220,7 +216,7 @@ for test in test_names:
inform
(
"valgrind passed"
,
color
=
SUCCESS
)
score
+=
valgrind_test_max
else
:
inform
(
"valgrind failed"
,
color
=
FAILURE
,
linebreak
=
True
)
inform
(
"valgrind failed"
,
color
=
FAILURE
)
inform
(
VALGRIND_RESULT
.
stderr
,
color
=
FAILURE
)
# if here, then the regular test failed
...
...
@@ -229,7 +225,6 @@ for test in test_names:
if
abs
(
test_result
.
returncode
)
==
11
:
inform
(
"segmentation fault!"
,
color
=
FAILURE
)
inform
(
"valgrind failed by default"
,
color
=
FAILURE
)
# print output streams if they exist in test
if
test_result
.
stdout
:
...
...
Write
Preview
Markdown
is supported
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