diff options
-rw-r--r-- | src/systemc/tests/SConscript | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/src/systemc/tests/SConscript b/src/systemc/tests/SConscript index 0ecd6ad4a..745061020 100644 --- a/src/systemc/tests/SConscript +++ b/src/systemc/tests/SConscript @@ -44,6 +44,7 @@ if env['USE_SYSTEMC']: self.reldir = os.path.relpath(dirname, src) self.target = os.path.join(self.reldir, name) self.sources = [] + self.deps = [] self.compile_only = False @@ -58,13 +59,16 @@ if env['USE_SYSTEMC']: return { 'name' : self.name, 'path' : self.reldir, - 'compile_only' : self.compile_only + 'compile_only' : self.compile_only, + 'deps' : self.deps } test_dir = Dir('.') class SystemCTestBin(Executable): def __init__(self, test): super(SystemCTestBin, self).__init__(test.target, *test.sources) + self.reldir = test.reldir + self.test_deps = test.deps @classmethod def declare_all(cls, env): @@ -95,7 +99,11 @@ if env['USE_SYSTEMC']: self.path(env).dir.abspath) env.Append(LINKFLAGS=Split('-z origin')) env.Append(RPATH=env.Literal(os.path.join('\\$$ORIGIN', relpath))) - return super(SystemCTestBin, self).declare(env, objs) + test_bin = super(SystemCTestBin, self).declare(env, objs) + test_dir = self.dir.Dir(self.reldir) + for dep in self.test_deps: + env.Depends(test_bin, test_dir.File(dep)) + return test_bin tests = [] def new_test(dirname, name): @@ -118,6 +126,15 @@ if env['USE_SYSTEMC']: if not cpps: return + def get_entries(fname): + with open(os.path.join(dirname, fname)) as content: + lines = content.readlines + # Get rid of leading and trailing whitespace. + lines = map(lambda x: x.strip(), content.readlines()) + # Get rid of blank lines. + lines = filter(lambda x: x, lines) + return lines + # If there's only one source file, then that files name is the test # name, and it's the source for that test. if len(cpps) == 1: @@ -140,18 +157,15 @@ if env['USE_SYSTEMC']: f = fs[0] test = new_test(dirname, os.path.splitext(f)[0]) - with open(os.path.join(dirname, f)) as content: - lines = content.readlines - # Get rid of leading and trailing whitespace. - lines = map(lambda x: x.strip(), content.readlines()) - # Get rid of blank lines. - lines = filter(lambda x: x, lines) - # Add all the sources to this test. - test.add_sources(lines) + # Add all the sources to this test. + test.add_sources(get_entries(f)) if 'COMPILE' in names: test.compile_only = True + if 'DEPS' in names: + test.deps = get_entries('DEPS') + subdir_src = Dir('.').srcdir.Dir(subdir) os.path.walk(str(subdir_src), visitor, None) |