Move tests out of tests/src/
... and just into the tests/ directory. I also reworked the Sconscript to compile everything using only the lib/ files that are needed. Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
1f19987c53
commit
34b0c56a70
|
@ -1,7 +1,6 @@
|
||||||
*.o
|
*.o
|
||||||
*.sw*
|
*.sw*
|
||||||
*.run
|
*.out
|
||||||
*.test
|
|
||||||
*.glade~
|
*.glade~
|
||||||
share/ocarina/#*
|
share/ocarina/#*
|
||||||
bin/
|
bin/
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
version
|
||||||
|
file
|
||||||
|
database
|
||||||
|
index
|
||||||
|
filter
|
||||||
|
idle
|
|
@ -2,6 +2,22 @@
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
Import("env")
|
Import("env")
|
||||||
|
tests = [
|
||||||
|
|
||||||
|
###
|
||||||
|
#
|
||||||
|
# (source.cpp, use collected lib_files?, [ other files ])
|
||||||
|
#
|
||||||
|
|
||||||
|
("version.cpp", False, []),
|
||||||
|
("file.cpp", True, []),
|
||||||
|
("database.cpp", True, []),
|
||||||
|
("index.cpp", True, []),
|
||||||
|
("filter.cpp", True, []),
|
||||||
|
("idle.cpp", False, [ "idle.cpp" ]),
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
check_depends = True
|
check_depends = True
|
||||||
|
|
||||||
|
@ -12,21 +28,50 @@ for arg in sys.argv:
|
||||||
check_depends = False
|
check_depends = False
|
||||||
break
|
break
|
||||||
|
|
||||||
src = SConscript("src/Sconscript")
|
def expand_files(extra_files):
|
||||||
|
res = []
|
||||||
|
for f in extra_files:
|
||||||
|
res += [ "../lib/%s" % f ]
|
||||||
|
return res
|
||||||
|
|
||||||
tests = [ "version" , "file", "database", "index", "filter", "idle" ]
|
def make_program(src, name, extra_files):
|
||||||
# "tag_db",
|
return env.Program("%s" % name, [ src ] + expand_files(extra_files))
|
||||||
# "queue" ]
|
|
||||||
#scripts = [ "playlist", "library", "deck", "audio", "gui" ]
|
|
||||||
|
|
||||||
prev = None
|
def make_test(src, name):
|
||||||
|
test = Command("%s.out" % name, [],
|
||||||
|
"./tests/%s | tee ./tests/%s.out" % (name, name))
|
||||||
|
Alias("tests/%s" % name, test)
|
||||||
|
AlwaysBuild(test)
|
||||||
|
return test
|
||||||
|
|
||||||
for test in tests:
|
def prepare_test(name, src, extra_files):
|
||||||
t = Command("%s.out" % test, [], "./tests/src/%s.run" % test)
|
exe = make_program(src, name, extra_files)
|
||||||
|
test = make_test(src, name)
|
||||||
|
Depends(test, exe)
|
||||||
|
return test
|
||||||
|
|
||||||
if prev and (check_depends == True):
|
res = []
|
||||||
Depends(t, prev)
|
lib_files = []
|
||||||
Depends(t, src)
|
|
||||||
AlwaysBuild(t)
|
ignore = open(".gitignore", 'w')
|
||||||
Alias("tests/%s" % test, t)
|
for src, lib, extra in tests:
|
||||||
prev = t
|
name = "%s" % src.rsplit(".")[0]
|
||||||
|
|
||||||
|
if lib == True:
|
||||||
|
lib_files += [ src ]
|
||||||
|
extra = lib_files + extra
|
||||||
|
|
||||||
|
test = prepare_test(name, src, extra)
|
||||||
|
if (check_depends == True) and (len(res) > 0):
|
||||||
|
Depends(test, res[len(res) - 1])
|
||||||
|
|
||||||
|
res += [ test ]
|
||||||
|
ignore.write(name + "\n")
|
||||||
|
ignore.close();
|
||||||
|
|
||||||
|
Return("res")
|
||||||
|
|
||||||
|
#tests = [ "version" , "file", "database", "index", "filter", "idle" ]
|
||||||
|
## "tag_db",
|
||||||
|
## "queue" ]
|
||||||
|
##scripts = [ "playlist", "library", "deck", "audio", "gui" ]
|
||||||
|
|
Loading…
Reference in New Issue