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:
Anna Schumaker 2015-12-11 14:12:54 -05:00
parent 5b921e7277
commit 850af16c87
3 changed files with 15 additions and 30 deletions

View File

@ -7,14 +7,17 @@ core_objs = []
def CoreTest(name, source):
global core_objs
if os.path.exists("../../core/%s" % source):
core_objs += [ env.Object("../../core/%s" % source) ]
run = UnitTest("core/%s" % name, [ source ] + core_objs)
test = os.path.abspath(source)
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)
if len(res) > 0 and testing_group(["tests/core"]):
Depends(run, res[-1])
return run
Export("core_objs")
Export("core_objs", "CoreTest")
res += [ CoreTest("version", "version.c") ]
@ -23,19 +26,11 @@ res += [ CoreTest("random", "random.c") ]
res += [ CoreTest("file", "file.c") ]
res += [ CoreTest("date", "date.c") ]
tmp = SConscript("containers/Sconscript")
if testing_group(["tests/core"]):
Depends(tmp[0], res[-1])
res += tmp
res += SConscript("containers/Sconscript")
res += [ CoreTest("filter", "filter.c") ]
res += [ CoreTest("idle", "idle.c") ]
tmp = SConscript("tags/Sconscript")
if testing_group(["tests/core"]):
Depends(tmp[0], res[-1])
res += tmp
res += SConscript("tags/Sconscript")
res += [ CoreTest("queue", "queue.c") ]
res += [ CoreTest("playlist", "playlist.c") ]
res += [ CoreTest("collection", "collection.c") ]

View File

@ -1,17 +1,12 @@
#!/usr/bin/python
import os
Import("env", "UnitTest", "core_objs", "testing_group")
Import("CoreTest", "testing_group")
res = []
def ContainerTest(name, source):
global core_objs
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)
run = CoreTest("containers/%s" % name, source)
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])
return run

View File

@ -1,17 +1,12 @@
#!/usr/bin/python
import os
Import("env", "UnitTest", "core_objs", "testing_group")
Import("env", "CoreTest", "core_objs", "testing_group")
res = []
def TagTest(name, source):
global core_objs
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)
run = CoreTest("tags/%s" % name, source)
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])
return run