1# Copyright (c) 2012 ARM Limited 2# All rights reserved 3# 4# The license below extends only to copyright in the software and shall 5# not be construed as granting a license to any other intellectual 6# property including but not limited to intellectual property relating 7# to a hardware implementation of the functionality of the software 8# licensed hereunder. You may use the software subject to the license --- 163 unchanged lines hidden (view full) --- 172 if not file: 173 file = app 174 return joinpath(test_progs, app, 'input', file) 175 176def srcpath(path): 177 """Path to file in gem5's source tree""" 178 return joinpath(os.path.dirname(__file__), "..", path) 179 |
180def run_config(config, argv=None): 181 """Execute a configuration script that is external to the test system""" 182 183 src_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "../")) 184 abs_path = joinpath(src_root, config) 185 186 code = compile(open(abs_path, 'r').read(), abs_path, 'exec') 187 scope = { 188 '__file__' : config, 189 '__name__' : '__m5_main__', 190 } 191 192 # Set the working directory in case we are executing from 193 # outside gem5's source tree 194 os.chdir(src_root) 195 196 # gem5 normally adds the script's directory to the path to make 197 # script-relative imports work. 198 sys.path = [ os.path.dirname(abs_path), ] + sys.path 199 200 if argv is None: 201 sys.argv = [ config, ] 202 else: 203 sys.argv = argv 204 exec(code, scope) 205 |
206# build configuration 207sys.path.append(joinpath(tests_root, 'configs')) 208test_filename = config 209# for ruby configurations, remove the protocol name from the test filename 210if re.search('-ruby', test_filename): 211 test_filename = test_filename.split('-ruby')[0]+'-ruby' 212execfile(joinpath(tests_root, 'configs', test_filename + '.py')) 213 --- 36 unchanged lines hidden --- |