run.py revision 2998:1d5ea4e433f5
12199SN/A# Copyright (c) 2006 The Regents of The University of Michigan 22199SN/A# All rights reserved. 32199SN/A# 42199SN/A# Redistribution and use in source and binary forms, with or without 52199SN/A# modification, are permitted provided that the following conditions are 62199SN/A# met: redistributions of source code must retain the above copyright 72199SN/A# notice, this list of conditions and the following disclaimer; 82199SN/A# redistributions in binary form must reproduce the above copyright 92199SN/A# notice, this list of conditions and the following disclaimer in the 102199SN/A# documentation and/or other materials provided with the distribution; 112199SN/A# neither the name of the copyright holders nor the names of its 122199SN/A# contributors may be used to endorse or promote products derived from 132199SN/A# this software without specific prior written permission. 142199SN/A# 152199SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 162199SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 172199SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 182199SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 192199SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 202199SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 212199SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 222199SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 232199SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 242199SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 252199SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 262199SN/A# 272665Ssaidi@eecs.umich.edu# Authors: Steve Reinhardt 282665Ssaidi@eecs.umich.edu 292199SN/Aimport os, sys 302199SN/A 312202SN/A# single "path" arg encodes everything we need to know about test 322202SN/A(category, name, isa, opsys, config) = sys.argv[1].split('/') 332199SN/A 342584SN/A# find path to directory containing this file 352980Sgblack@eecs.umich.edutests_root = os.path.dirname(__file__) 362474SN/Atest_progs = os.path.join(tests_root, 'test-progs') 372199SN/A 382199SN/A# generate path to binary file 392474SN/Adef binpath(app, file=None): 402199SN/A # executable has same name as app unless specified otherwise 414111Sgblack@eecs.umich.edu if not file: 424111Sgblack@eecs.umich.edu file = app 434111Sgblack@eecs.umich.edu return os.path.join(test_progs, app, 'bin', isa, opsys, file) 444111Sgblack@eecs.umich.edu 454111Sgblack@eecs.umich.edu# build configuration 464111Sgblack@eecs.umich.eduexecfile(os.path.join(tests_root, config + '.py')) 474111Sgblack@eecs.umich.edu 484111Sgblack@eecs.umich.edu# set default maxtick... script can override 494111Sgblack@eecs.umich.edu# -1 means run forever 504111Sgblack@eecs.umich.edumaxtick = -1 514111Sgblack@eecs.umich.edu 524188Sgblack@eecs.umich.edu# tweak configuration for specific test 534188Sgblack@eecs.umich.edu 544188Sgblack@eecs.umich.eduexecfile(os.path.join(tests_root, category, name, 'test.py')) 554188Sgblack@eecs.umich.edu 564111Sgblack@eecs.umich.edu# instantiate configuration 574188Sgblack@eecs.umich.edum5.instantiate(root) 584111Sgblack@eecs.umich.edu 594111Sgblack@eecs.umich.edu# simulate until program terminates 604188Sgblack@eecs.umich.eduexit_event = m5.simulate(maxtick) 614111Sgblack@eecs.umich.edu 624111Sgblack@eecs.umich.eduprint 'Exiting @ tick', m5.curTick(), 'because', exit_event.getCause() 632202SN/A