ocarina/tests/Sconscript

39 lines
844 B
Python

#!/usr/bin/python
import sys, os
Import("env")
tests = []
check_sanity = False
for arg in sys.argv[1:]:
if arg.find("tests") == 0:
tests += [ arg ]
if arg in set(["tests", "tests/", "tests/sanity"]):
check_sanity = True
if len(tests) == 0:
Return()
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)
Depends(run, make)
Alias("tests/%s" % test, run)
return run
Export("UnitTest")
#Generate empty audio files
SConscript("Music/Sconscript")
res = SConscript("core/Sconscript")
if check_sanity == True:
res = [ UnitTest("sanity", [ "sanity.c" ]) ] + res
for t in res[1:]:
Depends(t, res[0])
Return("res")