diff --git a/tests/core/Sconscript b/tests/core/Sconscript index 37f3a4fb..c2519f53 100644 --- a/tests/core/Sconscript +++ b/tests/core/Sconscript @@ -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") ] diff --git a/tests/core/containers/Sconscript b/tests/core/containers/Sconscript index 5a5b65c6..56df52b6 100644 --- a/tests/core/containers/Sconscript +++ b/tests/core/containers/Sconscript @@ -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 diff --git a/tests/core/tags/Sconscript b/tests/core/tags/Sconscript index 56a07c8d..c6520d29 100644 --- a/tests/core/tags/Sconscript +++ b/tests/core/tags/Sconscript @@ -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