build: Improve aliasing for tests
scons tests - Compile all tests scons tests/basic - Compile basic tests scons tests/basic/print - Compile text printing test Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
parent
d8c8ea1bbf
commit
38c074d898
|
@ -3,7 +3,6 @@
|
|||
config = SConscript("config")
|
||||
|
||||
|
||||
|
||||
#import os, sys
|
||||
#import config
|
||||
#
|
||||
|
|
1
config
1
config
|
@ -28,3 +28,4 @@ Export("release", "debug", "env")
|
|||
# Import SConscript files
|
||||
include = SConscript("include/Sconscript")
|
||||
tests = SConscript("tests/Sconscript")
|
||||
Alias("tests", tests)
|
||||
|
|
|
@ -1,8 +1,21 @@
|
|||
#!/usr/bin/python
|
||||
Import("VERSION", "DEBUG")
|
||||
|
||||
text = [ "#ifndef OCARINA_VERSION_H",
|
||||
vers = str(VERSION)
|
||||
if DEBUG == True:
|
||||
vers += "-debug"
|
||||
|
||||
text = [ "/*",
|
||||
" * Automatically generated by include/Sconscript",
|
||||
" */",
|
||||
"",
|
||||
"#ifndef OCARINA_VERSION_H",
|
||||
"#define OCARINA_VERSION_H",
|
||||
"",
|
||||
"static inline const char *get_version() {",
|
||||
" return \"%s\";" % vers,
|
||||
"}",
|
||||
"",
|
||||
"#endif /* OCARINA_VERSION_H */"
|
||||
]
|
||||
|
||||
|
@ -10,5 +23,3 @@ f = open("version.h", 'w')
|
|||
for line in text:
|
||||
f.write("%s\n" % line)
|
||||
f.close()
|
||||
|
||||
Clean(True, "version.h")
|
||||
|
|
|
@ -1,17 +1,20 @@
|
|||
#!/usr/bin/python
|
||||
Import("release", "debug")
|
||||
|
||||
def make_test(env, name, src):
|
||||
def make_test(group, src, name, env):
|
||||
o = env.StaticObject(name, src)
|
||||
p = env.Program("%s.test" % name, o)
|
||||
Alias("tests", [o, p])
|
||||
Alias("tests/%s" % group, [o, p])
|
||||
Alias("tests/%s/%s" % (group, name), [o, p])
|
||||
|
||||
def make_tests(tests):
|
||||
for src in tests:
|
||||
def Test(group, src):
|
||||
name, extension = src.rsplit(".", 1)
|
||||
make_test(release, name, src)
|
||||
make_test(debug, "%s-debug" % name, src)
|
||||
make_test(group, src, name, release)
|
||||
make_test(group, src, "%s-debug" % name, debug)
|
||||
|
||||
Export("make_tests")
|
||||
|
||||
Export("Test")
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
#!/usr/bin/python
|
||||
Import("Test")
|
||||
|
||||
tests = [ "print.cpp" ]
|
||||
|
||||
Import("make_tests")
|
||||
make_tests(tests)
|
||||
Test("basic", "print.cpp")
|
||||
|
|
Loading…
Reference in New Issue