49 lines
1.0 KiB
Python
49 lines
1.0 KiB
Python
#!/usr/bin/python
|
|
import sys, os
|
|
Import("env")
|
|
|
|
tests = []
|
|
|
|
for arg in sys.argv[1:]:
|
|
if arg.find("tests") == 0:
|
|
tests += [ arg ]
|
|
|
|
if len(tests) == 0:
|
|
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.UsePackage("glib-2.0")
|
|
test_o = env.Object("test", "test.c")
|
|
|
|
def UnitTest(test, sources):
|
|
name = os.path.basename(test)
|
|
make = env.Program(name, sources + [ test_o ])
|
|
run = Command("%s.fake" % name, [], "tests/%s" % test, ENV = os.environ)
|
|
Depends(run, make)
|
|
Alias("tests/%s" % test, run)
|
|
return run
|
|
Export("UnitTest", "testing_group")
|
|
|
|
#Generate empty audio files
|
|
SConscript("Music/Sconscript")
|
|
|
|
res = UnitTest("sanity", [ "sanity.c" ])
|
|
res += SConscript("core/Sconscript")
|
|
|
|
if "DISPLAY" in os.environ.keys():
|
|
res += SConscript("gui/Sconscript")
|
|
|
|
if check_sanity == True:
|
|
for t in res[1:]:
|
|
Depends(t, res[0])
|
|
|
|
Return("res")
|