summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2019-02-20 16:08:50 -0800
committerGabe Black <gabeblack@google.com>2019-02-21 22:36:33 +0000
commit84a9094ef7fd8e322c2e532a54a37d8fae332724 (patch)
treead23a31d44dd4dc4ebb7799de8ff4e97e984f6cf /src
parent36a5473537205da5d4b26266fb1db46006aed5e4 (diff)
downloadgem5-84a9094ef7fd8e322c2e532a54a37d8fae332724.tar.xz
systemc: Make the verify.py script work when run from different dirs.
The verify.py script ran scons from the CWD, and that would fail if there wasn't a SConstruct in that directory, ie if it wasn't from the source of the checkout. This change makes verify.py use scons' --directory option to run from where the SConstruct is, or at least the SConstruct which was checked out alongside that copy of verify.py. That location can be overridden using the new -C or --scons-dir options. Change-Id: I9f033d6dd30e0c2992b7f3102c573b34ea9c49e0 Reviewed-on: https://gem5-review.googlesource.com/c/16562 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src')
-rwxr-xr-xsrc/systemc/tests/verify.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/systemc/tests/verify.py b/src/systemc/tests/verify.py
index 503c11d8b..2bb6d3357 100755
--- a/src/systemc/tests/verify.py
+++ b/src/systemc/tests/verify.py
@@ -45,6 +45,10 @@ import sys
script_path = os.path.abspath(inspect.getfile(inspect.currentframe()))
script_dir = os.path.dirname(script_path)
config_path = os.path.join(script_dir, 'config.py')
+# Parent directories if checked out as part of gem5.
+systemc_dir = os.path.dirname(script_dir)
+src_dir = os.path.dirname(systemc_dir)
+checkout_dir = os.path.dirname(src_dir)
systemc_rel_path = 'systemc'
tests_rel_path = os.path.join(systemc_rel_path, 'tests')
@@ -131,7 +135,8 @@ class CompilePhase(TestPhaseBase):
if args.j == 0:
self.args = ('-j', str(self.main_args.j)) + self.args
- scons_args = [ 'USE_SYSTEMC=1' ] + list(self.args) + targets
+ scons_args = [ '--directory', self.main_args.scons_dir,
+ 'USE_SYSTEMC=1' ] + list(self.args) + targets
scons(*scons_args)
class RunPhase(TestPhaseBase):
@@ -512,6 +517,10 @@ parser.add_argument('-j', type=int, default=1,
help='Default level of parallelism, can be overriden '
'for individual stages')
+parser.add_argument('-C', '--scons-dir', metavar='SCONS_DIR',
+ default=checkout_dir,
+ help='Directory to run scons from')
+
filter_opts = parser.add_mutually_exclusive_group()
filter_opts.add_argument('--filter', default='True',
help='Python expression which filters tests based '
@@ -549,7 +558,7 @@ if len(phases) == 0:
json_path = os.path.join(main_args.build_dir, json_rel_path)
if main_args.update_json:
- scons(os.path.join(json_path))
+ scons('--directory', main_args.scons_dir, os.path.join(json_path))
with open(json_path) as f:
test_data = json.load(f)