ocarina/tests/Sconscript
Anna Schumaker 63769c9c0b Convert unit test framework to C
I commented out most of the file and directory modification code while I
was at it.  I'll re-add these as I convert more files to C.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-07 08:19:37 -04:00

37 lines
794 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")
res = []
#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")