Commit c2e4935e authored by Matthew P. Russell's avatar Matthew P. Russell
Browse files

Update unit_test

parent b884e04a
......@@ -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:
......
Markdown is supported
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