run.py revision 6007
14977Ssaidi@eecs.umich.edu# Copyright (c) 2006-2007 The Regents of The University of Michigan 22997Sstever@eecs.umich.edu# All rights reserved. 32997Sstever@eecs.umich.edu# 42997Sstever@eecs.umich.edu# Redistribution and use in source and binary forms, with or without 52997Sstever@eecs.umich.edu# modification, are permitted provided that the following conditions are 62997Sstever@eecs.umich.edu# met: redistributions of source code must retain the above copyright 72997Sstever@eecs.umich.edu# notice, this list of conditions and the following disclaimer; 82997Sstever@eecs.umich.edu# redistributions in binary form must reproduce the above copyright 92997Sstever@eecs.umich.edu# notice, this list of conditions and the following disclaimer in the 102997Sstever@eecs.umich.edu# documentation and/or other materials provided with the distribution; 112997Sstever@eecs.umich.edu# neither the name of the copyright holders nor the names of its 122997Sstever@eecs.umich.edu# contributors may be used to endorse or promote products derived from 132997Sstever@eecs.umich.edu# this software without specific prior written permission. 142997Sstever@eecs.umich.edu# 152997Sstever@eecs.umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 162997Sstever@eecs.umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 172997Sstever@eecs.umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 182997Sstever@eecs.umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 192997Sstever@eecs.umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 202997Sstever@eecs.umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 212997Sstever@eecs.umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 222997Sstever@eecs.umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 232997Sstever@eecs.umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 242997Sstever@eecs.umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 252997Sstever@eecs.umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 262997Sstever@eecs.umich.edu# 272997Sstever@eecs.umich.edu# Authors: Steve Reinhardt 282997Sstever@eecs.umich.edu 295523Snate@binkert.orgimport os 305523Snate@binkert.orgimport sys 315523Snate@binkert.orgimport m5 325523Snate@binkert.org 335523Snate@binkert.org# Since we're in batch mode, dont allow tcp socket connections 345523Snate@binkert.orgm5.disableAllListeners() 352997Sstever@eecs.umich.edu 362997Sstever@eecs.umich.edu# single "path" arg encodes everything we need to know about test 376007Ssteve.reinhardt@amd.com(category, name, isa, opsys, config) = sys.argv[1].split('/')[-5:] 382997Sstever@eecs.umich.edu 392997Sstever@eecs.umich.edu# find path to directory containing this file 402997Sstever@eecs.umich.edutests_root = os.path.dirname(__file__) 414977Ssaidi@eecs.umich.eduif os.path.isdir('/dist/m5/regression/test-progs'): 424977Ssaidi@eecs.umich.edu test_progs = '/dist/m5/regression/test-progs' 434977Ssaidi@eecs.umich.eduelse: 444977Ssaidi@eecs.umich.edu test_progs = os.path.join(tests_root, 'test-progs') 452998Sstever@eecs.umich.edu 462998Sstever@eecs.umich.edu# generate path to binary file 472998Sstever@eecs.umich.edudef binpath(app, file=None): 482998Sstever@eecs.umich.edu # executable has same name as app unless specified otherwise 492998Sstever@eecs.umich.edu if not file: 502998Sstever@eecs.umich.edu file = app 512998Sstever@eecs.umich.edu return os.path.join(test_progs, app, 'bin', isa, opsys, file) 522997Sstever@eecs.umich.edu 533475Sktlim@umich.edu# generate path to input file 543475Sktlim@umich.edudef inputpath(app, file=None): 553475Sktlim@umich.edu # input file has same name as app unless specified otherwise 563475Sktlim@umich.edu if not file: 573475Sktlim@umich.edu file = app 583475Sktlim@umich.edu return os.path.join(test_progs, app, 'input', file) 593475Sktlim@umich.edu 602997Sstever@eecs.umich.edu# build configuration 613005Sstever@eecs.umich.eduexecfile(os.path.join(tests_root, 'configs', config + '.py')) 622997Sstever@eecs.umich.edu 632997Sstever@eecs.umich.edu# set default maxtick... script can override 642998Sstever@eecs.umich.edu# -1 means run forever 655523Snate@binkert.orgmaxtick = m5.MaxTick 662997Sstever@eecs.umich.edu 672997Sstever@eecs.umich.edu# tweak configuration for specific test 682997Sstever@eecs.umich.edu 692997Sstever@eecs.umich.eduexecfile(os.path.join(tests_root, category, name, 'test.py')) 702997Sstever@eecs.umich.edu 712997Sstever@eecs.umich.edu# instantiate configuration 722997Sstever@eecs.umich.edum5.instantiate(root) 732997Sstever@eecs.umich.edu 742997Sstever@eecs.umich.edu# simulate until program terminates 752997Sstever@eecs.umich.eduexit_event = m5.simulate(maxtick) 762997Sstever@eecs.umich.edu 772997Sstever@eecs.umich.eduprint 'Exiting @ tick', m5.curTick(), 'because', exit_event.getCause() 78