regress revision 6928:5bd33f7c26ea
16019Shines@cs.fsu.edu#! /usr/bin/env python 210037SARM gem5 Developers# Copyright (c) 2005-2007 The Regents of The University of Michigan 37093Sgblack@eecs.umich.edu# All rights reserved. 47093Sgblack@eecs.umich.edu# 57093Sgblack@eecs.umich.edu# Redistribution and use in source and binary forms, with or without 67093Sgblack@eecs.umich.edu# modification, are permitted provided that the following conditions are 77093Sgblack@eecs.umich.edu# met: redistributions of source code must retain the above copyright 87093Sgblack@eecs.umich.edu# notice, this list of conditions and the following disclaimer; 97093Sgblack@eecs.umich.edu# redistributions in binary form must reproduce the above copyright 107093Sgblack@eecs.umich.edu# notice, this list of conditions and the following disclaimer in the 117093Sgblack@eecs.umich.edu# documentation and/or other materials provided with the distribution; 127093Sgblack@eecs.umich.edu# neither the name of the copyright holders nor the names of its 137093Sgblack@eecs.umich.edu# contributors may be used to endorse or promote products derived from 146019Shines@cs.fsu.edu# this software without specific prior written permission. 156019Shines@cs.fsu.edu# 166019Shines@cs.fsu.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 176019Shines@cs.fsu.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 186019Shines@cs.fsu.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 196019Shines@cs.fsu.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 206019Shines@cs.fsu.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 216019Shines@cs.fsu.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 226019Shines@cs.fsu.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 236019Shines@cs.fsu.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 246019Shines@cs.fsu.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 256019Shines@cs.fsu.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 266019Shines@cs.fsu.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 276019Shines@cs.fsu.edu# 286019Shines@cs.fsu.edu# Authors: Steve Reinhardt 296019Shines@cs.fsu.edu 306019Shines@cs.fsu.eduimport sys 316019Shines@cs.fsu.eduimport os 326019Shines@cs.fsu.eduimport optparse 336019Shines@cs.fsu.eduimport datetime 346019Shines@cs.fsu.edufrom subprocess import call 356019Shines@cs.fsu.edu 366019Shines@cs.fsu.eduprogname = os.path.basename(sys.argv[0]) 376019Shines@cs.fsu.edu 386019Shines@cs.fsu.eduoptparser = optparse.OptionParser() 396019Shines@cs.fsu.eduoptparser.add_option('-v', '--verbose', dest='verbose', action='store_true', 407399SAli.Saidi@ARM.com default=False, 417399SAli.Saidi@ARM.com help='echo commands before executing') 426019Shines@cs.fsu.eduoptparser.add_option('--builds', dest='builds', 436019Shines@cs.fsu.edu default='ALPHA_SE,ALPHA_SE_MOESI_hammer,' \ 446019Shines@cs.fsu.edu 'ALPHA_SE_MESI_CMP_directory,' \ 4510474Sandreas.hansson@arm.com 'ALPHA_SE_MOESI_CMP_directory,' \ 466019Shines@cs.fsu.edu 'ALPHA_SE_MOESI_CMP_token,' \ 476019Shines@cs.fsu.edu 'ALPHA_FS,MIPS_SE,' \ 486019Shines@cs.fsu.edu 'POWER_SE,SPARC_SE,SPARC_FS,X86_SE,ARM_SE', 496116Snate@binkert.org help='comma-separated list of build targets to test ' 506019Shines@cs.fsu.edu " (default: '%default')" ) 518782Sgblack@eecs.umich.eduoptparser.add_option('--variants', dest='variants', 528756Sgblack@eecs.umich.edu default='fast', 5310037SARM gem5 Developers help='comma-separated list of build variants to test ' 5410037SARM gem5 Developers " (default: '%default')" ) 556019Shines@cs.fsu.eduoptparser.add_option('--scons-opts', dest='scons_opts', default='', 566019Shines@cs.fsu.edu help='scons options', metavar='OPTS') 576019Shines@cs.fsu.eduoptparser.add_option('-j', '--jobs', type='int', default=1, 586019Shines@cs.fsu.edu help='number of parallel jobs to use') 596019Shines@cs.fsu.eduoptparser.add_option('-k', '--keep-going', action='store_true', 6010024Sdam.sunwoo@arm.com help='keep going after errors') 616019Shines@cs.fsu.edu 628232Snate@binkert.org(options, tests) = optparser.parse_args() 638232Snate@binkert.org 648232Snate@binkert.org 656116Snate@binkert.org# split list options on ',' to get Python lists 666116Snate@binkert.orgbuilds = options.builds.split(',') 678756Sgblack@eecs.umich.eduvariants = options.variants.split(',') 686019Shines@cs.fsu.edu 696019Shines@cs.fsu.edu# Call os.system() and raise exception if return status is non-zero 706019Shines@cs.fsu.edudef system(cmd): 716019Shines@cs.fsu.edu try: 726019Shines@cs.fsu.edu retcode = call(cmd, shell=True) 7310037SARM gem5 Developers if retcode < 0: 7410037SARM gem5 Developers print >>sys.stderr, "Child was terminated by signal", -retcode 7510418Sandreas.hansson@arm.com print >>sys.stderr, "When attemping to execute: %s" % cmd 7610418Sandreas.hansson@arm.com sys.exit(1) 7710418Sandreas.hansson@arm.com elif retcode > 0: 7810537Sandreas.hansson@arm.com print >>sys.stderr, "Child returned", retcode 7910537Sandreas.hansson@arm.com print >>sys.stderr, "When attemping to execute: %s" % cmd 8010418Sandreas.hansson@arm.com sys.exit(1) 816019Shines@cs.fsu.edu except OSError, e: 8210037SARM gem5 Developers print >>sys.stderr, "Execution failed:", e 837399SAli.Saidi@ARM.com print >>sys.stderr, "When attemping to execute: %s" % cmd 8410037SARM gem5 Developers sys.exit(1) 8510037SARM gem5 Developers 8610037SARM gem5 Developers# Quote string s so it can be passed as a shell arg 8710037SARM gem5 Developersdef shellquote(s): 886019Shines@cs.fsu.edu if ' ' in s: 896019Shines@cs.fsu.edu s = "'%s'" % s 906019Shines@cs.fsu.edu return s 916019Shines@cs.fsu.edu 9210037SARM gem5 Developersif not tests: 9310037SARM gem5 Developers print "No tests specified, just building binaries." 9410037SARM gem5 Developers targets = ['build/%s/m5.%s' % (build, variant) 9510037SARM gem5 Developers for build in builds 9610037SARM gem5 Developers for variant in variants] 9710037SARM gem5 Developerselif 'all' in tests: 9810037SARM gem5 Developers targets = ['build/%s/tests/%s' % (build, variant) 9910037SARM gem5 Developers for build in builds 10010037SARM gem5 Developers for variant in variants] 10110037SARM gem5 Developerselse: 10210037SARM gem5 Developers # Ugly! Since we don't have any quick SPARC_FS tests remove the SPARC_FS target 10310717Sandreas.hansson@arm.com # If we ever get a quick SPARC_FS test, this code should be removed 10410037SARM gem5 Developers if 'quick' in tests and 'SPARC_FS' in builds: 10510037SARM gem5 Developers builds.remove('SPARC_FS') 10610717Sandreas.hansson@arm.com targets = ['build/%s/tests/%s/%s' % (build, variant, test) 1076019Shines@cs.fsu.edu for build in builds 1086019Shines@cs.fsu.edu for variant in variants 1097694SAli.Saidi@ARM.com for test in tests] 1107694SAli.Saidi@ARM.com 1117694SAli.Saidi@ARM.comscons_opts = options.scons_opts 11210037SARM gem5 Developersif options.jobs != 1: 11310037SARM gem5 Developers scons_opts += ' -j %d' % options.jobs 11410037SARM gem5 Developersif options.keep_going: 11510037SARM gem5 Developers scons_opts += ' -k' 11610037SARM gem5 Developers 11710037SARM gem5 Developerssystem('scons IGNORE_STYLE=True %s %s' % (scons_opts, ' '.join(targets))) 11810037SARM gem5 Developers 11910037SARM gem5 Developerssys.exit(0) 12010037SARM gem5 Developers