diff options
author | Andreas Sandberg <andreas.sandberg@arm.com> | 2019-01-28 16:50:35 +0000 |
---|---|---|
committer | Andreas Sandberg <andreas.sandberg@arm.com> | 2019-01-31 17:31:54 +0000 |
commit | 2d1723acd31e1c935341e5d27307804039ede56d (patch) | |
tree | a24ab22629fa5c17d71da601a308dd89d544648d /tests/configs/learning-gem5-p1-two-level.py | |
parent | cc5981597573146fe32e0d2abf83b17dcbb325cb (diff) | |
download | gem5-2d1723acd31e1c935341e5d27307804039ede56d.tar.xz |
tests: Add a helper to run external scripts
Some tests are really just a wrapper around a test script in
configs/. Add a helper method to wrap these scripts to make sure they
are executed in a consistent environment. This wrapper sets up a
global environment that is identical to that created by main() when it
executes the script. Unlike the old wrappers, it updates the module
search path to make relative imports work correctly in Python 3.
Change-Id: Ie9f81ec4e2689aa8cf5ecb9fc8025d3534b5c9ca
Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/15976
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>
Diffstat (limited to 'tests/configs/learning-gem5-p1-two-level.py')
-rw-r--r-- | tests/configs/learning-gem5-p1-two-level.py | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/tests/configs/learning-gem5-p1-two-level.py b/tests/configs/learning-gem5-p1-two-level.py index c0a1e4662..0c355e838 100644 --- a/tests/configs/learning-gem5-p1-two-level.py +++ b/tests/configs/learning-gem5-p1-two-level.py @@ -32,27 +32,5 @@ # For some reason, this is implicitly needed by run.py root = None -import m5 - 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/') - - # The path to this script is the only parameter. Delete it so we can - # execute the script that we want to execute. - import sys - del sys.argv[1:] - # Note: at this point, we could add options we want to test. - # For instance, sys.argv.append('--l2_size=512kB') - - # Execute the script we are wrapping - execfile(srcpath('configs/learning_gem5/part1/two_level.py')) + run_config('configs/learning_gem5/part1/two_level.py') |