Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Side by Side Diff: tools/test.py

Issue 8695: Added crash detection to tests on Linux.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/mozilla/mozilla.status ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2008 the V8 project authors. All rights reserved. 3 # Copyright 2008 the V8 project authors. All rights reserved.
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 } 307 }
308 308
309 309
310 # ------------------------- 310 # -------------------------
311 # --- F r a m e w o r k --- 311 # --- F r a m e w o r k ---
312 # ------------------------- 312 # -------------------------
313 313
314 314
315 class CommandOutput(object): 315 class CommandOutput(object):
316 316
317 def __init__(self, exit_code, stdout, stderr): 317 def __init__(self, exit_code, timed_out, stdout, stderr):
318 self.exit_code = exit_code 318 self.exit_code = exit_code
319 self.timed_out = timed_out
319 self.stdout = stdout 320 self.stdout = stdout
320 self.stderr = stderr 321 self.stderr = stderr
321 322
322 323
323 class TestCase(object): 324 class TestCase(object):
324 325
325 def __init__(self, context, path): 326 def __init__(self, context, path):
326 self.path = path 327 self.path = path
327 self.context = context 328 self.context = context
328 self.failed = None 329 self.failed = None
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 elif self.HasFailed(): 366 elif self.HasFailed():
366 outcome = FAIL 367 outcome = FAIL
367 else: 368 else:
368 outcome = PASS 369 outcome = PASS
369 return not outcome in self.test.outcomes 370 return not outcome in self.test.outcomes
370 371
371 def HasCrashed(self): 372 def HasCrashed(self):
372 if platform.system() == 'Windows': 373 if platform.system() == 'Windows':
373 return 0x80000000 & self.output.exit_code and not (0x3FFFFF00 & self.outpu t.exit_code) 374 return 0x80000000 & self.output.exit_code and not (0x3FFFFF00 & self.outpu t.exit_code)
374 else: 375 else:
375 return False 376 # Timed out tests will have exit_code -signal.SIGTERM.
377 if self.output.timed_out:
378 return False
379 return self.output.exit_code < 0 and \
380 self.output.exit_code != -signal.SIGABRT
376 381
377 def HasFailed(self): 382 def HasFailed(self):
378 execution_failed = self.test.DidFail(self.output) 383 execution_failed = self.test.DidFail(self.output)
379 if self.test.IsNegative(): 384 if self.test.IsNegative():
380 return not execution_failed 385 return not execution_failed
381 else: 386 else:
382 return execution_failed 387 return execution_failed
383 388
384 389
385 def KillProcessWithID(pid): 390 def KillProcessWithID(pid):
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 os.close(fd_err) 469 os.close(fd_err)
465 output = file(outname).read() 470 output = file(outname).read()
466 errors = file(errname).read() 471 errors = file(errname).read()
467 def CheckedUnlink(name): 472 def CheckedUnlink(name):
468 try: 473 try:
469 os.unlink(name) 474 os.unlink(name)
470 except OSError, e: 475 except OSError, e:
471 PrintError(str(e)) 476 PrintError(str(e))
472 CheckedUnlink(outname) 477 CheckedUnlink(outname)
473 CheckedUnlink(errname) 478 CheckedUnlink(errname)
474 return CommandOutput(exit_code, output, errors) 479 return CommandOutput(exit_code, timed_out, output, errors)
475 480
476 481
477 def ExecuteNoCapture(args, context, timeout=None): 482 def ExecuteNoCapture(args, context, timeout=None):
478 (process, exit_code, timed_out) = RunProcess( 483 (process, exit_code, timed_out) = RunProcess(
479 context, 484 context,
480 timeout, 485 timeout,
481 args = args, 486 args = args,
482 ) 487 )
483 return CommandOutput(exit_code, "", "") 488 return CommandOutput(exit_code, False, "", "")
484 489
485 490
486 def CarCdr(path): 491 def CarCdr(path):
487 if len(path) == 0: 492 if len(path) == 0:
488 return (None, [ ]) 493 return (None, [ ])
489 else: 494 else:
490 return (path[0], path[1:]) 495 return (path[0], path[1:])
491 496
492 497
493 class TestConfiguration(object): 498 class TestConfiguration(object):
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after
1293 for entry in timed_tests[:20]: 1298 for entry in timed_tests[:20]:
1294 t = FormatTime(entry.duration) 1299 t = FormatTime(entry.duration)
1295 sys.stderr.write("%4i (%s) %s\n" % (index, t, entry.GetLabel())) 1300 sys.stderr.write("%4i (%s) %s\n" % (index, t, entry.GetLabel()))
1296 index += 1 1301 index += 1
1297 1302
1298 return result 1303 return result
1299 1304
1300 1305
1301 if __name__ == '__main__': 1306 if __name__ == '__main__':
1302 sys.exit(Main()) 1307 sys.exit(Main())
OLDNEW
« no previous file with comments | « test/mozilla/mozilla.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698