tests.py (11976:d1f151ee0e08) | tests.py (12575:16ada03839d9) |
---|---|
1#!/usr/bin/env python2 2# 3# Copyright (c) 2016 ARM Limited 4# All rights reserved 5# 6# The license below extends only to copyright in the software and shall 7# not be construed as granting a license to any other intellectual 8# property including but not limited to intellectual property relating --- 23 unchanged lines hidden (view full) --- 32# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 33# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 34# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 36# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37# 38# Authors: Andreas Sandberg 39 | 1#!/usr/bin/env python2 2# 3# Copyright (c) 2016 ARM Limited 4# All rights reserved 5# 6# The license below extends only to copyright in the software and shall 7# not be construed as granting a license to any other intellectual 8# property including but not limited to intellectual property relating --- 23 unchanged lines hidden (view full) --- 32# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 33# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 34# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 36# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37# 38# Authors: Andreas Sandberg 39 |
40from __future__ import print_function 41 |
|
40import argparse 41import sys 42import os 43import pickle 44 45from testing.tests import * 46import testing.results 47 --- 73 unchanged lines hidden (view full) --- 121 122def _list_tests(args): 123 for isa, categories, modes in \ 124 ( parse_test_filter(f) for f in args.list_filter ): 125 126 for test in get_tests(isa, categories=categories, modes=modes, 127 ruby_protocol=args.ruby_protocol, 128 gpu_isa=args.gpu_isa): | 42import argparse 43import sys 44import os 45import pickle 46 47from testing.tests import * 48import testing.results 49 --- 73 unchanged lines hidden (view full) --- 123 124def _list_tests(args): 125 for isa, categories, modes in \ 126 ( parse_test_filter(f) for f in args.list_filter ): 127 128 for test in get_tests(isa, categories=categories, modes=modes, 129 ruby_protocol=args.ruby_protocol, 130 gpu_isa=args.gpu_isa): |
129 print "/".join(test) | 131 print("/".join(test)) |
130 sys.exit(0) 131 132def _run_tests_args(subparsers): 133 parser = subparsers.add_parser( 134 "run", 135 formatter_class=ParagraphHelpFormatter, 136 help='Run one or more tests', 137 description="Run one or more tests.", --- 32 unchanged lines hidden (view full) --- 170 171 parser.add_argument("--skip-diff-stat", action="store_true", 172 help="Skip stat diffing stage") 173 174 _add_format_args(parser) 175 176def _run_tests(args): 177 if not os.path.isfile(args.gem5) or not os.access(args.gem5, os.X_OK): | 132 sys.exit(0) 133 134def _run_tests_args(subparsers): 135 parser = subparsers.add_parser( 136 "run", 137 formatter_class=ParagraphHelpFormatter, 138 help='Run one or more tests', 139 description="Run one or more tests.", --- 32 unchanged lines hidden (view full) --- 172 173 parser.add_argument("--skip-diff-stat", action="store_true", 174 help="Skip stat diffing stage") 175 176 _add_format_args(parser) 177 178def _run_tests(args): 179 if not os.path.isfile(args.gem5) or not os.access(args.gem5, os.X_OK): |
178 print >> sys.stderr, \ 179 "gem5 binary '%s' not an executable file" % args.gem5 | 180 print("gem5 binary '%s' not an executable file" % args.gem5, 181 file=sys.stderr) |
180 sys.exit(2) 181 182 formatter = _create_formatter(args) 183 184 out_base = os.path.abspath(args.directory) 185 if not os.path.exists(out_base): 186 os.mkdir(out_base) 187 tests = [] 188 for test_name in args.test: 189 config = ClassicConfig(*test_name.split("/")) 190 out_dir = os.path.join(out_base, "/".join(config)) 191 tests.append( 192 ClassicTest(args.gem5, out_dir, config, 193 timeout=args.timeout, 194 skip_diff_stat=args.skip_diff_stat, 195 skip_diff_out=args.skip_diff_out)) 196 197 all_results = [] | 182 sys.exit(2) 183 184 formatter = _create_formatter(args) 185 186 out_base = os.path.abspath(args.directory) 187 if not os.path.exists(out_base): 188 os.mkdir(out_base) 189 tests = [] 190 for test_name in args.test: 191 config = ClassicConfig(*test_name.split("/")) 192 out_dir = os.path.join(out_base, "/".join(config)) 193 tests.append( 194 ClassicTest(args.gem5, out_dir, config, 195 timeout=args.timeout, 196 skip_diff_stat=args.skip_diff_stat, 197 skip_diff_out=args.skip_diff_out)) 198 199 all_results = [] |
198 print "Running %i tests" % len(tests) | 200 print("Running %i tests" % len(tests)) |
199 for testno, test in enumerate(tests): | 201 for testno, test in enumerate(tests): |
200 print "%i: Running '%s'..." % (testno, test) | 202 print("%i: Running '%s'..." % (testno, test)) |
201 202 all_results.append(test.run()) 203 204 formatter.dump_suites(all_results) 205 206def _show_args(subparsers): 207 parser = subparsers.add_parser( 208 "show", --- 35 unchanged lines hidden (view full) --- 244def _show(args): 245 def _load(f): 246 # Load the pickled status file, sometimes e.g., when a 247 # regression is still running the status file might be 248 # incomplete. 249 try: 250 return pickle.load(f) 251 except EOFError: | 203 204 all_results.append(test.run()) 205 206 formatter.dump_suites(all_results) 207 208def _show_args(subparsers): 209 parser = subparsers.add_parser( 210 "show", --- 35 unchanged lines hidden (view full) --- 246def _show(args): 247 def _load(f): 248 # Load the pickled status file, sometimes e.g., when a 249 # regression is still running the status file might be 250 # incomplete. 251 try: 252 return pickle.load(f) 253 except EOFError: |
252 print >> sys.stderr, 'Could not read file %s' % f.name | 254 print('Could not read file %s' % f.name, file=sys.stderr) |
253 return [] 254 255 formatter = _create_formatter(args) 256 suites = sum([ _load(f) for f in args.result ], []) 257 formatter.dump_suites(suites) 258 259def _test_args(subparsers): 260 parser = subparsers.add_parser( --- 21 unchanged lines hidden (view full) --- 282 283 parser.add_argument("result", type=argparse.FileType("rb"), nargs="*", 284 help="Pickled test results") 285 286def _test(args): 287 try: 288 suites = sum([ pickle.load(f) for f in args.result ], []) 289 except EOFError: | 255 return [] 256 257 formatter = _create_formatter(args) 258 suites = sum([ _load(f) for f in args.result ], []) 259 formatter.dump_suites(suites) 260 261def _test_args(subparsers): 262 parser = subparsers.add_parser( --- 21 unchanged lines hidden (view full) --- 284 285 parser.add_argument("result", type=argparse.FileType("rb"), nargs="*", 286 help="Pickled test results") 287 288def _test(args): 289 try: 290 suites = sum([ pickle.load(f) for f in args.result ], []) 291 except EOFError: |
290 print >> sys.stderr, 'Could not read all files' | 292 print('Could not read all files', file=sys.stderr) |
291 sys.exit(2) 292 293 if all(s for s in suites): 294 sys.exit(0) 295 elif any([ s.failed_run() for s in suites ]): 296 sys.exit(2) 297 elif any([ s.changed() for s in suites ]): 298 sys.exit(3) --- 48 unchanged lines hidden --- | 293 sys.exit(2) 294 295 if all(s for s in suites): 296 sys.exit(0) 297 elif any([ s.failed_run() for s in suites ]): 298 sys.exit(2) 299 elif any([ s.changed() for s in suites ]): 300 sys.exit(3) --- 48 unchanged lines hidden --- |