Discussion:
[gem5-dev] Change in gem5/gem5[master]: systemc: Make verify.py recognize a DEPS file in test dirs.
(too old to reply)
Gabe Black (Gerrit)
2018-11-22 02:00:35 UTC
Permalink
Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/14516


Change subject: systemc: Make verify.py recognize a DEPS file in test dirs.
......................................................................

systemc: Make verify.py recognize a DEPS file in test dirs.

This file lists additional files beyond the sources that the test
relies on, like files it uses when running.

Change-Id: Ifc4958b26eed08689e0e72bd87f84388dbcf1898
---
M src/systemc/tests/SConscript
1 file changed, 24 insertions(+), 10 deletions(-)



diff --git a/src/systemc/tests/SConscript b/src/systemc/tests/SConscript
index 0ecd6ad..7450610 100644
--- a/src/systemc/tests/SConscript
+++ b/src/systemc/tests/SConscript
@@ -44,6 +44,7 @@
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 @@
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 @@
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 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 @@
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)
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/14516
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: Ifc4958b26eed08689e0e72bd87f84388dbcf1898
Gerrit-Change-Number: 14516
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <***@google.com>
Gerrit-MessageType: newchange
Gabe Black (Gerrit)
2018-11-29 01:21:07 UTC
Permalink
Gabe Black has submitted this change and it was merged. (
https://gem5-review.googlesource.com/c/public/gem5/+/14516 )

Change subject: systemc: Make verify.py recognize a DEPS file in test dirs.
......................................................................

systemc: Make verify.py recognize a DEPS file in test dirs.

This file lists additional files beyond the sources that the test
relies on, like files it uses when running.

Change-Id: Ifc4958b26eed08689e0e72bd87f84388dbcf1898
Reviewed-on: https://gem5-review.googlesource.com/c/14516
Reviewed-by: Gabe Black <***@google.com>
Maintainer: Gabe Black <***@google.com>
---
M src/systemc/tests/SConscript
1 file changed, 24 insertions(+), 10 deletions(-)

Approvals:
Gabe Black: Looks good to me, approved; Looks good to me, approved



diff --git a/src/systemc/tests/SConscript b/src/systemc/tests/SConscript
index 0ecd6ad..7450610 100644
--- a/src/systemc/tests/SConscript
+++ b/src/systemc/tests/SConscript
@@ -44,6 +44,7 @@
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 @@
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 @@
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 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 @@
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)
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/14516
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: Ifc4958b26eed08689e0e72bd87f84388dbcf1898
Gerrit-Change-Number: 14516
Gerrit-PatchSet: 2
Gerrit-Owner: Gabe Black <***@google.com>
Gerrit-Reviewer: Andreas Sandberg <***@arm.com>
Gerrit-Reviewer: Gabe Black <***@google.com>
Gerrit-Reviewer: Giacomo Travaglini <***@arm.com>
Gerrit-Reviewer: Jason Lowe-Power <***@lowepower.com>
Gerrit-Reviewer: Matthias Jung <***@eit.uni-kl.de>
Gerrit-MessageType: merged
Continue reading on narkive:
Loading...