tests: Clean up how the sanity test is scheduled

I created a new function for checking if a group of tests is running to
help determine if the sanity test needs to run before anything else.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
Anna Schumaker 2015-12-11 10:44:16 -05:00
parent fef3ef3353
commit bc0437b3fe
1 changed files with 12 additions and 6 deletions

View File

@ -3,16 +3,22 @@ import sys, os
Import("env") Import("env")
tests = [] tests = []
check_sanity = False
for arg in sys.argv[1:]: for arg in sys.argv[1:]:
if arg.find("tests") == 0: if arg.find("tests") == 0:
tests += [ arg ] tests += [ arg ]
if arg in set(["tests", "tests/", "tests/sanity"]):
check_sanity = True
if len(tests) == 0: if len(tests) == 0:
Return() Return()
def testing_group(group):
group = [ "tests" ] + group
for arg in tests:
if arg in set(group + [ g + "/" for g in group]):
return True
return False
check_sanity = testing_group([])
env.Append(CCFLAGS = "-DCONFIG_TESTING") env.Append(CCFLAGS = "-DCONFIG_TESTING")
env.UsePackage("glib-2.0") env.UsePackage("glib-2.0")
test_o = env.Object("test", "test.c") test_o = env.Object("test", "test.c")
@ -24,14 +30,14 @@ def UnitTest(test, sources):
Depends(run, make) Depends(run, make)
Alias("tests/%s" % test, run) Alias("tests/%s" % test, run)
return run return run
Export("UnitTest") Export("UnitTest", "testing_group")
#Generate empty audio files #Generate empty audio files
SConscript("Music/Sconscript") SConscript("Music/Sconscript")
res = SConscript("core/Sconscript") res = UnitTest("sanity", [ "sanity.c" ])
res += SConscript("core/Sconscript")
if check_sanity == True: if check_sanity == True:
res = [ UnitTest("sanity", [ "sanity.c" ]) ] + res
for t in res[1:]: for t in res[1:]:
Depends(t, res[0]) Depends(t, res[0])