tests/core: Containers and Tags can call CoreTest
CoreTest will do most of the setup for us, so let's not duplicate code. Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
5b921e7277
commit
850af16c87
|
@ -7,14 +7,17 @@ core_objs = []
|
||||||
|
|
||||||
def CoreTest(name, source):
|
def CoreTest(name, source):
|
||||||
global core_objs
|
global core_objs
|
||||||
if os.path.exists("../../core/%s" % source):
|
|
||||||
core_objs += [ env.Object("../../core/%s" % source) ]
|
test = os.path.abspath(source)
|
||||||
run = UnitTest("core/%s" % name, [ source ] + core_objs)
|
core = os.path.sep.join([x for x in test.split("/") if x != "tests"])
|
||||||
|
if os.path.exists(core):
|
||||||
|
core_objs += [ env.Object(core) ]
|
||||||
|
run = UnitTest("core/%s" % name, [ test ] + core_objs)
|
||||||
Alias("tests/core", run)
|
Alias("tests/core", run)
|
||||||
if len(res) > 0 and testing_group(["tests/core"]):
|
if len(res) > 0 and testing_group(["tests/core"]):
|
||||||
Depends(run, res[-1])
|
Depends(run, res[-1])
|
||||||
return run
|
return run
|
||||||
Export("core_objs")
|
Export("core_objs", "CoreTest")
|
||||||
|
|
||||||
|
|
||||||
res += [ CoreTest("version", "version.c") ]
|
res += [ CoreTest("version", "version.c") ]
|
||||||
|
@ -23,19 +26,11 @@ res += [ CoreTest("random", "random.c") ]
|
||||||
res += [ CoreTest("file", "file.c") ]
|
res += [ CoreTest("file", "file.c") ]
|
||||||
res += [ CoreTest("date", "date.c") ]
|
res += [ CoreTest("date", "date.c") ]
|
||||||
|
|
||||||
tmp = SConscript("containers/Sconscript")
|
res += SConscript("containers/Sconscript")
|
||||||
if testing_group(["tests/core"]):
|
|
||||||
Depends(tmp[0], res[-1])
|
|
||||||
res += tmp
|
|
||||||
|
|
||||||
res += [ CoreTest("filter", "filter.c") ]
|
res += [ CoreTest("filter", "filter.c") ]
|
||||||
res += [ CoreTest("idle", "idle.c") ]
|
res += [ CoreTest("idle", "idle.c") ]
|
||||||
|
|
||||||
tmp = SConscript("tags/Sconscript")
|
res += SConscript("tags/Sconscript")
|
||||||
if testing_group(["tests/core"]):
|
|
||||||
Depends(tmp[0], res[-1])
|
|
||||||
res += tmp
|
|
||||||
|
|
||||||
res += [ CoreTest("queue", "queue.c") ]
|
res += [ CoreTest("queue", "queue.c") ]
|
||||||
res += [ CoreTest("playlist", "playlist.c") ]
|
res += [ CoreTest("playlist", "playlist.c") ]
|
||||||
res += [ CoreTest("collection", "collection.c") ]
|
res += [ CoreTest("collection", "collection.c") ]
|
||||||
|
|
|
@ -1,17 +1,12 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
import os
|
Import("CoreTest", "testing_group")
|
||||||
Import("env", "UnitTest", "core_objs", "testing_group")
|
|
||||||
|
|
||||||
res = []
|
res = []
|
||||||
|
|
||||||
def ContainerTest(name, source):
|
def ContainerTest(name, source):
|
||||||
global core_objs
|
run = CoreTest("containers/%s" % name, source)
|
||||||
if os.path.exists("../../../core/containers/%s" % source):
|
|
||||||
core_objs += [ env.Object("../../../core/containers/%s" % source) ]
|
|
||||||
run = UnitTest("core/containers/%s" % name, [ source ] + core_objs)
|
|
||||||
Alias("tests/core", run)
|
|
||||||
Alias("tests/core/containers", run)
|
Alias("tests/core/containers", run)
|
||||||
if len(res) > 0 and testing_group(["tests/core", "tests/core/containers"]):
|
if len(res) > 0 and testing_group([ "tests/core/containers" ]):
|
||||||
Depends(run, res[-1])
|
Depends(run, res[-1])
|
||||||
return run
|
return run
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,12 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
import os
|
Import("env", "CoreTest", "core_objs", "testing_group")
|
||||||
Import("env", "UnitTest", "core_objs", "testing_group")
|
|
||||||
|
|
||||||
res = []
|
res = []
|
||||||
|
|
||||||
def TagTest(name, source):
|
def TagTest(name, source):
|
||||||
global core_objs
|
run = CoreTest("tags/%s" % name, source)
|
||||||
if os.path.exists("../../../core/tags/%s" % source):
|
|
||||||
core_objs += [ env.Object("../../../core/tags/%s" % source) ]
|
|
||||||
run = UnitTest("core/tags/%s" % name, [ source ] + core_objs)
|
|
||||||
Alias("tests/core", run)
|
|
||||||
Alias("tests/core/tags", run)
|
Alias("tests/core/tags", run)
|
||||||
if len(res) > 0 and testing_group(["tests/core", "tests/core/tags"]):
|
if len(res) > 0 and testing_group([ "tests/core/tags" ]):
|
||||||
Depends(run, res[-1])
|
Depends(run, res[-1])
|
||||||
return run
|
return run
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue