tests.py (11482:2ca1efb451e4) | tests.py (11543:b5435e0310c7) |
---|---|
1#!/usr/bin/env python 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 --- 227 unchanged lines hidden (view full) --- 236 parser.add_argument("result", type=argparse.FileType("rb"), nargs="*", 237 help="Pickled test results") 238 239def _show(args): 240 formatter = _create_formatter(args) 241 suites = sum([ pickle.load(f) for f in args.result ], []) 242 formatter.dump_suites(suites) 243 | 1#!/usr/bin/env python 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 --- 227 unchanged lines hidden (view full) --- 236 parser.add_argument("result", type=argparse.FileType("rb"), nargs="*", 237 help="Pickled test results") 238 239def _show(args): 240 formatter = _create_formatter(args) 241 suites = sum([ pickle.load(f) for f in args.result ], []) 242 formatter.dump_suites(suites) 243 |
244def _test_args(subparsers): 245 parser = subparsers.add_parser( 246 "test", 247 formatter_class=ParagraphHelpFormatter, 248 help='Probe test results and set exit code', 249 epilog=""" 250 251 Load one or more pickled test file and return an exit code 252 corresponding to the test outcome. The following exit codes 253 can be returned: 254 255 0: All tests were successful or skipped. 256 257 1: General fault in the script such as incorrect parameters or 258 failing to parse a pickle file. 259 260 2: At least one test failed to run. This is what the summary 261 formatter usually shows as a 'FAILED'. 262 263 3: All tests ran correctly, but at least one failed to 264 verify its output. When displaying test output using the 265 summary formatter, such a test would show up as 'CHANGED'. 266 """) 267 268 _add_format_args(parser) 269 270 parser.add_argument("result", type=argparse.FileType("rb"), nargs="*", 271 help="Pickled test results") 272 273def _test(args): 274 suites = sum([ pickle.load(f) for f in args.result ], []) 275 276 if all(s for s in suites): 277 sys.exit(0) 278 elif any([ s.failed_run() for s in suites ]): 279 sys.exit(2) 280 elif any([ s.changed() for s in suites ]): 281 sys.exit(3) 282 else: 283 assert False, "Unexpected return status from test" 284 |
|
244_commands = { 245 "list" : (_list_tests, _list_tests_args), 246 "run" : (_run_tests, _run_tests_args), 247 "show" : (_show, _show_args), | 285_commands = { 286 "list" : (_list_tests, _list_tests_args), 287 "run" : (_run_tests, _run_tests_args), 288 "show" : (_show, _show_args), |
289 "test" : (_test, _test_args), |
|
248} 249 250def main(): 251 parser = argparse.ArgumentParser( 252 formatter_class=ParagraphHelpFormatter, 253 description="""gem5 testing multi tool.""", 254 epilog=""" 255 This tool provides an interface to gem5's test framework that --- 32 unchanged lines hidden --- | 290} 291 292def main(): 293 parser = argparse.ArgumentParser( 294 formatter_class=ParagraphHelpFormatter, 295 description="""gem5 testing multi tool.""", 296 epilog=""" 297 This tool provides an interface to gem5's test framework that --- 32 unchanged lines hidden --- |