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:
parent
1a02bd5aff
commit
34a15d58c4
|
@ -23,8 +23,7 @@ class OEnvironment(Environment):
|
||||||
self.ParseConfig("pkg-config --cflags --libs %s" % name)
|
self.ParseConfig("pkg-config --cflags --libs %s" % name)
|
||||||
|
|
||||||
env = OEnvironment()
|
env = OEnvironment()
|
||||||
test_env = OEnvironment( CONFIG_CCFLAGS + [ "-DCONFIG_TEST" ] )
|
Export("env")
|
||||||
Export("env", "test_env")
|
|
||||||
|
|
||||||
|
|
||||||
include = SConscript("include/Sconscript")
|
include = SConscript("include/Sconscript")
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
import subprocess
|
import subprocess
|
||||||
Import("env", "test_env")
|
Import("env")
|
||||||
|
|
||||||
version = str(env.Version)
|
version = str(env.Version)
|
||||||
if env.Debug == True:
|
if env.Debug == True:
|
||||||
|
@ -15,5 +15,4 @@ try:
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
for e in (env, test_env):
|
env.Append( CCFLAGS = [ "-DCONFIG_VERSION='\"%s\"'" % version ] )
|
||||||
e.Append( CCFLAGS = [ "-DCONFIG_VERSION='\"%s\"'" % version ] )
|
|
||||||
|
|
|
@ -1,9 +1,35 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
import sys, os
|
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 = []
|
res = []
|
||||||
|
|
||||||
def all_tests_enabled(dir):
|
def all_tests_enabled(dir):
|
||||||
for arg in sys.argv[1:]:
|
for arg in sys.argv[1:]:
|
||||||
arg = os.path.normpath(arg)
|
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 test_env.Object("%s.cpp-%s" % (name, dir), src)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
test_lib = test_env.Object("test.cpp");
|
|
||||||
|
|
||||||
def generic_test(name, dir, objs, extra):
|
def generic_test(name, dir, objs, extra):
|
||||||
global test_obj;
|
global test_obj;
|
||||||
obj = get_test_obj(name, dir)
|
obj = get_test_obj(name, dir)
|
||||||
|
@ -47,14 +71,7 @@ def generic_test(name, dir, objs, extra):
|
||||||
|
|
||||||
Export("get_test_obj", "generic_test")
|
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")
|
Return("res")
|
||||||
|
|
Loading…
Reference in New Issue