Discussion:
[gem5-dev] Change in gem5/gem5[master]: systemc: Run the systemc tests directly from their build directories.
(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/+/14519


Change subject: systemc: Run the systemc tests directly from their build
directories.
......................................................................

systemc: Run the systemc tests directly from their build directories.

We were previously running them from the current directory to start
with, and then having the config script switch to the build directory.
That worked, except when output streams might be opened as part of the
global constructors which would run before the config script.

This change makes us start from the build directory directly, making
the switch in the config script unnecessary and ensuring that no files
leak outside of the build when running tests.

Change-Id: I484168793bfc5abc4e5631fb3468733fb9d829af
---
M src/systemc/tests/verify.py
1 file changed, 3 insertions(+), 7 deletions(-)



diff --git a/src/systemc/tests/verify.py b/src/systemc/tests/verify.py
index c9ede77..def0fdc 100755
--- a/src/systemc/tests/verify.py
+++ b/src/systemc/tests/verify.py
@@ -153,30 +153,26 @@
'--kill-after', str(args.timeout * 2),
str(args.timeout)
]
- curdir = os.getcwd()
def run_test(test):
cmd = []
if args.timeout:
cmd.extend(timeout_cmd)
cmd.extend([
- test.full_path(),
+ os.path.abspath(test.full_path()),
'-rd', os.path.abspath(test.m5out_dir()),
'--listener-mode=off',
'--quiet',
- config_path,
- '--working-dir',
- os.path.dirname(test.dir())
+ os.path.abspath(config_path),
])
# Ensure the output directory exists.
if not os.path.exists(test.m5out_dir()):
os.makedirs(test.m5out_dir())
try:
- subprocess.check_call(cmd)
+ subprocess.check_call(cmd, cwd=os.path.dirname(test.dir()))
except subprocess.CalledProcessError, error:
returncode = error.returncode
else:
returncode = 0
- os.chdir(curdir)
with open(test.returncode_file(), 'w') as rc:
rc.write('%d\n' % returncode)
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/14519
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: I484168793bfc5abc4e5631fb3468733fb9d829af
Gerrit-Change-Number: 14519
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <***@google.com>
Gerrit-MessageType: newchange
Gabe Black (Gerrit)
2018-11-29 01:23:12 UTC
Permalink
Gabe Black has submitted this change and it was merged. (
https://gem5-review.googlesource.com/c/public/gem5/+/14519 )

Change subject: systemc: Run the systemc tests directly from their build
directories.
......................................................................

systemc: Run the systemc tests directly from their build directories.

We were previously running them from the current directory to start
with, and then having the config script switch to the build directory.
That worked, except when output streams might be opened as part of the
global constructors which would run before the config script.

This change makes us start from the build directory directly, making
the switch in the config script unnecessary and ensuring that no files
leak outside of the build when running tests.

Change-Id: I484168793bfc5abc4e5631fb3468733fb9d829af
Reviewed-on: https://gem5-review.googlesource.com/c/14519
Reviewed-by: Gabe Black <***@google.com>
Maintainer: Gabe Black <***@google.com>
---
M src/systemc/tests/verify.py
1 file changed, 3 insertions(+), 7 deletions(-)

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



diff --git a/src/systemc/tests/verify.py b/src/systemc/tests/verify.py
index c9ede77..def0fdc 100755
--- a/src/systemc/tests/verify.py
+++ b/src/systemc/tests/verify.py
@@ -153,30 +153,26 @@
'--kill-after', str(args.timeout * 2),
str(args.timeout)
]
- curdir = os.getcwd()
def run_test(test):
cmd = []
if args.timeout:
cmd.extend(timeout_cmd)
cmd.extend([
- test.full_path(),
+ os.path.abspath(test.full_path()),
'-rd', os.path.abspath(test.m5out_dir()),
'--listener-mode=off',
'--quiet',
- config_path,
- '--working-dir',
- os.path.dirname(test.dir())
+ os.path.abspath(config_path),
])
# Ensure the output directory exists.
if not os.path.exists(test.m5out_dir()):
os.makedirs(test.m5out_dir())
try:
- subprocess.check_call(cmd)
+ subprocess.check_call(cmd, cwd=os.path.dirname(test.dir()))
except subprocess.CalledProcessError, error:
returncode = error.returncode
else:
returncode = 0
- os.chdir(curdir)
with open(test.returncode_file(), 'w') as rc:
rc.write('%d\n' % returncode)
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/14519
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: I484168793bfc5abc4e5631fb3468733fb9d829af
Gerrit-Change-Number: 14519
Gerrit-PatchSet: 3
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...