From 2d1723acd31e1c935341e5d27307804039ede56d Mon Sep 17 00:00:00 2001 From: Andreas Sandberg <andreas.sandberg@arm.com> Date: Mon, 28 Jan 2019 16:50:35 +0000 Subject: 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> --- tests/configs/learning-gem5-p1-simple.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'tests/configs/learning-gem5-p1-simple.py') diff --git a/tests/configs/learning-gem5-p1-simple.py b/tests/configs/learning-gem5-p1-simple.py index 9ad70854e..aba538a7e 100644 --- a/tests/configs/learning-gem5-p1-simple.py +++ b/tests/configs/learning-gem5-p1-simple.py @@ -33,12 +33,4 @@ root = None 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(srcpath('configs/learning_gem5/part1/simple.py')) + run_config('configs/learning_gem5/part1/simple.py') -- cgit v1.2.3