changeset d372458be20f in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=d372458be20f
description:
tests: Enable test running outside of gem5's source tree
The learning gem5 scripts currently assumes that the current working
directory is the root of gem5's source tree. This isn't necessarily
the case when running the tests using gem5's new test runner.
Change-Id: Ief569bbe77b1b3e2b0fb0e6c575fb0705bbba9b3
Signed-off-by: Andreas Sandberg <[email protected]>
Reviewed-by: Curtis Dunham <[email protected]>
diffstat:
tests/configs/learning-gem5-p1-simple.py | 7 ++++++-
tests/configs/learning-gem5-p1-two-level.py | 8 +++++++-
tests/configs/memcheck.py | 7 ++++++-
tests/run.py | 4 ++++
4 files changed, 23 insertions(+), 3 deletions(-)
diffs (72 lines):
diff -r a22c4bac7e15 -r d372458be20f tests/configs/learning-gem5-p1-simple.py
--- a/tests/configs/learning-gem5-p1-simple.py Sat May 07 14:43:06 2016 -0400
+++ b/tests/configs/learning-gem5-p1-simple.py Mon May 09 11:32:07 2016 +0100
@@ -35,5 +35,10 @@
def run_test(root):
# Called from tests/run.py
+ # Set the working directory in case we are executing from
+ # outside gem5's source tree
+ import os
+ os.chdir(os.path.join(os.path.dirname(__file__), "../"))
+
# Execute the script we are wrapping
- execfile('configs/learning_gem5/part1/simple.py')
+ execfile(srcpath('configs/learning_gem5/part1/simple.py'))
diff -r a22c4bac7e15 -r d372458be20f tests/configs/learning-gem5-p1-two-level.py
--- a/tests/configs/learning-gem5-p1-two-level.py Sat May 07 14:43:06
2016 -0400
+++ b/tests/configs/learning-gem5-p1-two-level.py Mon May 09 11:32:07
2016 +0100
@@ -37,6 +37,12 @@
def run_test(root):
# Called from tests/run.py
+
+ # Set the working directory in case we are executing from
+ # outside gem5's source tree
+ import os
+ os.chdir(os.path.join(os.path.dirname(__file__), "../"))
+
# Add paths that we need
m5.util.addToPath('../configs/learning_gem5/part1')
m5.util.addToPath('../configs/common')
@@ -49,4 +55,4 @@
# For instance, sys.argv.append('--l2_size=512kB')
# Execute the script we are wrapping
- execfile('configs/learning_gem5/part1/two_level.py')
+ execfile(srcpath('configs/learning_gem5/part1/two_level.py'))
diff -r a22c4bac7e15 -r d372458be20f tests/configs/memcheck.py
--- a/tests/configs/memcheck.py Sat May 07 14:43:06 2016 -0400
+++ b/tests/configs/memcheck.py Mon May 09 11:32:07 2016 +0100
@@ -47,6 +47,11 @@
def run_test(root):
# Called from tests/run.py
+ # Set the working directory in case we are executing from
+ # outside gem5's source tree
+ import os
+ os.chdir(os.path.join(os.path.dirname(__file__), "../"))
+
# The path to this script is the only parameter. Delete it so
# we can execute the script that we want to execute.
import sys
@@ -56,4 +61,4 @@
sys.argv.append('-m %d' % maxtick)
# Execute the script we are wrapping
- execfile('configs/example/memcheck.py', globals())
+ execfile(srcpath('configs/example/memcheck.py'), globals())
diff -r a22c4bac7e15 -r d372458be20f tests/run.py
--- a/tests/run.py Sat May 07 14:43:06 2016 -0400
+++ b/tests/run.py Mon May 09 11:32:07 2016 +0100
@@ -171,6 +171,10 @@
file = app
return joinpath(test_progs, app, 'input', file)
+def srcpath(path):
+ """Path to file in gem5's source tree"""
+ return joinpath(os.path.dirname(__file__), "..", path)
+
# build configuration
sys.path.append(joinpath(tests_root, 'configs'))
test_filename = config
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev