Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/16562

Change subject: systemc: Make the verify.py script work when run from different dirs.
......................................................................

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
---
M src/systemc/tests/verify.py
1 file changed, 11 insertions(+), 2 deletions(-)



diff --git a/src/systemc/tests/verify.py b/src/systemc/tests/verify.py
index 503c11d..2bb6d33 100755
--- a/src/systemc/tests/verify.py
+++ b/src/systemc/tests/verify.py
@@ -45,6 +45,10 @@
 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 @@
         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 @@
                     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 @@
 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)

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/16562
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: I9f033d6dd30e0c2992b7f3102c573b34ea9c49e0
Gerrit-Change-Number: 16562
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to