tests: Reenable valgrind support
This lets me remove the unused OTest class which I was keeping around for reference. Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
97733aa40a
commit
159f6098f3
|
@ -19,8 +19,9 @@ for arg in sys.argv:
|
|||
check_depends = False
|
||||
break
|
||||
|
||||
|
||||
valgrind = "valgrind -q --leak-check=full --error-exitcode=42"
|
||||
valgrind = ""
|
||||
if test_env.Valgrind == True:
|
||||
valgrind = "valgrind -q --leak-check=full --error-exitcode=42"
|
||||
gcov = "gcov -r tests/%s/*.gcda"
|
||||
res = []
|
||||
|
||||
|
@ -48,6 +49,8 @@ def get_test_obj(name, dir):
|
|||
return None
|
||||
|
||||
def generic_test(name, dir, objs, extra):
|
||||
global valgrind
|
||||
|
||||
obj = get_test_obj(name, dir)
|
||||
if obj != None:
|
||||
objs += [ obj ]
|
||||
|
@ -56,7 +59,7 @@ def generic_test(name, dir, objs, extra):
|
|||
test_objs = extra
|
||||
|
||||
exe = test_env.Program(name, [ "%s.cpp" % name ] + test_objs)
|
||||
test = Command("%s.fake" % name, [], "tests/%s/%s" % (dir, name));
|
||||
test = Command("%s.fake" % name, [], "%s tests/%s/%s" % (valgrind, dir, name));
|
||||
Alias("tests/%s/%s" % (dir, name), test)
|
||||
Depends(test, exe)
|
||||
add_test(test, dir)
|
||||
|
@ -64,38 +67,6 @@ def generic_test(name, dir, objs, extra):
|
|||
|
||||
|
||||
|
||||
class OTest:
|
||||
Prev = None
|
||||
Env = test_env
|
||||
|
||||
def __init__(self, src, pkg = None):
|
||||
self.Name = src.rsplit(".")[0]
|
||||
self.Src = src
|
||||
if pkg != None:
|
||||
test_env.UsePackage(pkg)
|
||||
|
||||
def get_program(self):
|
||||
return test_env.Program(self.Name, self.Src)
|
||||
|
||||
def prepare(self, subdir):
|
||||
prog = self.get_program()
|
||||
|
||||
path = "./tests/%s/%s" % (subdir, self.Name)
|
||||
cmd = "%s | tee %s.out" % (path, path)
|
||||
if test_env.Valgrind == True:
|
||||
cmd = "%s %s" % (valgrind, cmd)
|
||||
test = test_env.Command("%s.out" % self.Name, [], "set -x; set -o pipefail; %s" % cmd)
|
||||
|
||||
Depends(test, prog)
|
||||
if (check_depends == True) and (OTest.Prev != None):
|
||||
Depends(test, OTest.Prev)
|
||||
Alias("tests/%s" % subdir, test)
|
||||
Alias("tests/%s/%s" % (subdir, self.Name), test)
|
||||
AlwaysBuild(test)
|
||||
OTest.Prev = test
|
||||
return test
|
||||
|
||||
|
||||
class TestList:
|
||||
def __init__(self, subdir, tests):
|
||||
self.subdir = subdir
|
||||
|
|
Loading…
Reference in New Issue