Remove test_env

I want to make the scons files simpler, so I have decided to drop down
to only one test environment.  This patch disables
tests/core/Sconscript, but I'll add this back in as I make other changes
throughout the codebase.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
Anna Schumaker 2015-08-19 00:49:52 -04:00
parent 1a02bd5aff
commit 34a15d58c4
3 changed files with 32 additions and 17 deletions

View File

@ -23,8 +23,7 @@ class OEnvironment(Environment):
self.ParseConfig("pkg-config --cflags --libs %s" % name)
env = OEnvironment()
test_env = OEnvironment( CONFIG_CCFLAGS + [ "-DCONFIG_TEST" ] )
Export("env", "test_env")
Export("env")
include = SConscript("include/Sconscript")

View File

@ -1,6 +1,6 @@
#!/usr/bin/python
import subprocess
Import("env", "test_env")
Import("env")
version = str(env.Version)
if env.Debug == True:
@ -15,5 +15,4 @@ try:
except:
pass
for e in (env, test_env):
e.Append( CCFLAGS = [ "-DCONFIG_VERSION='\"%s\"'" % version ] )
env.Append( CCFLAGS = [ "-DCONFIG_VERSION='\"%s\"'" % version ] )

View File

@ -1,9 +1,35 @@
#!/usr/bin/python
import sys, os
Import("test_env")
Import("env")
tests = []
for arg in sys.argv[1:]:
if arg.find("tests") == 0:
tests += [ arg ]
if len(tests) == 0:
Return()
env.Append(CCFLAGS = "-DCONFIG_TEST")
env.UsePackage("glib-2.0")
class UnitTest:
def __init__(self, test, sources):
name = os.path.basename(test)
make = env.Program(name, sources)
run = Command("%s.fake" % name, [], "tests/%s" % test)
Depends(run, make)
Alias("tests/%s" % test, run)
res = UnitTest("sanity", [ "sanity.cpp", "test.cpp" ])
Return("res")
res = []
def all_tests_enabled(dir):
for arg in sys.argv[1:]:
arg = os.path.normpath(arg)
@ -26,8 +52,6 @@ def get_test_obj(name, dir):
return test_env.Object("%s.cpp-%s" % (name, dir), src)
return None
test_lib = test_env.Object("test.cpp");
def generic_test(name, dir, objs, extra):
global test_obj;
obj = get_test_obj(name, dir)
@ -47,14 +71,7 @@ def generic_test(name, dir, objs, extra):
Export("get_test_obj", "generic_test")
test_env.UsePackage("glib-2.0")
exe = test_env.Program("sanity", [ "sanity.cpp", test_lib ])
test = Command("sanity.fake", [], "tests/sanity")
Alias("tests/sanity", test)
Depends(test, exe)
add_test(test, "")
SConscript("core/Sconscript")
#SConscript("core/Sconscript")
Return("res")