tests.py (11836:3195e72010da) tests.py (11917:6b5cded90c35)
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

--- 228 unchanged lines hidden (view full) ---

237 pickle file.""")
238
239 _add_format_args(parser)
240
241 parser.add_argument("result", type=argparse.FileType("rb"), nargs="*",
242 help="Pickled test results")
243
244def _show(args):
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

--- 228 unchanged lines hidden (view full) ---

237 pickle file.""")
238
239 _add_format_args(parser)
240
241 parser.add_argument("result", type=argparse.FileType("rb"), nargs="*",
242 help="Pickled test results")
243
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:
252 print >> sys.stderr, 'Could not read file %s' % f.name
253 return []
254
245 formatter = _create_formatter(args)
255 formatter = _create_formatter(args)
246 suites = sum([ pickle.load(f) for f in args.result ], [])
256 suites = sum([ _load(f) for f in args.result ], [])
247 formatter.dump_suites(suites)
248
249def _test_args(subparsers):
250 parser = subparsers.add_parser(
251 "test",
252 formatter_class=ParagraphHelpFormatter,
253 help='Probe test results and set exit code',
254 epilog="""

--- 16 unchanged lines hidden (view full) ---

271 """)
272
273 _add_format_args(parser)
274
275 parser.add_argument("result", type=argparse.FileType("rb"), nargs="*",
276 help="Pickled test results")
277
278def _test(args):
257 formatter.dump_suites(suites)
258
259def _test_args(subparsers):
260 parser = subparsers.add_parser(
261 "test",
262 formatter_class=ParagraphHelpFormatter,
263 help='Probe test results and set exit code',
264 epilog="""

--- 16 unchanged lines hidden (view full) ---

281 """)
282
283 _add_format_args(parser)
284
285 parser.add_argument("result", type=argparse.FileType("rb"), nargs="*",
286 help="Pickled test results")
287
288def _test(args):
279 suites = sum([ pickle.load(f) for f in args.result ], [])
289 try:
290 suites = sum([ pickle.load(f) for f in args.result ], [])
291 except EOFError:
292 print >> sys.stderr, 'Could not read all files'
293 sys.exit(2)
280
281 if all(s for s in suites):
282 sys.exit(0)
283 elif any([ s.failed_run() for s in suites ]):
284 sys.exit(2)
285 elif any([ s.changed() for s in suites ]):
286 sys.exit(3)
287 else:

--- 47 unchanged lines hidden ---
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)
301 else:

--- 47 unchanged lines hidden ---