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

Side by Side Diff: tools/test.py

Issue 6685088: Merge isolates to bleeding_edge. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 9 months 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 | « tools/gyp/v8.gyp ('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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 333
334 def __init__(self, context, path, mode): 334 def __init__(self, context, path, mode):
335 self.path = path 335 self.path = path
336 self.context = context 336 self.context = context
337 self.duration = None 337 self.duration = None
338 self.mode = mode 338 self.mode = mode
339 339
340 def IsNegative(self): 340 def IsNegative(self):
341 return False 341 return False
342 342
343 def TestsIsolates(self):
344 return False
345
343 def CompareTime(self, other): 346 def CompareTime(self, other):
344 return cmp(other.duration, self.duration) 347 return cmp(other.duration, self.duration)
345 348
346 def DidFail(self, output): 349 def DidFail(self, output):
347 if output.failed is None: 350 if output.failed is None:
348 output.failed = self.IsFailureOutput(output) 351 output.failed = self.IsFailureOutput(output)
349 return output.failed 352 return output.failed
350 353
351 def IsFailureOutput(self, output): 354 def IsFailureOutput(self, output):
352 return output.exit_code != 0 355 return output.exit_code != 0
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 sleep_time = MAX_SLEEP_TIME 498 sleep_time = MAX_SLEEP_TIME
496 return (process, exit_code, timed_out) 499 return (process, exit_code, timed_out)
497 500
498 501
499 def PrintError(str): 502 def PrintError(str):
500 sys.stderr.write(str) 503 sys.stderr.write(str)
501 sys.stderr.write('\n') 504 sys.stderr.write('\n')
502 505
503 506
504 def CheckedUnlink(name): 507 def CheckedUnlink(name):
505 try: 508 # On Windows, when run with -jN in parallel processes,
506 os.unlink(name) 509 # OS often fails to unlink the temp file. Not sure why.
507 except OSError, e: 510 # Need to retry.
508 PrintError("os.unlink() " + str(e)) 511 # Idea from https://bugs.webkit.org/attachment.cgi?id=75982&action=prettypatch
509 512 retry_count = 0
513 while retry_count < 30:
514 try:
515 os.unlink(name)
516 return
517 except OSError, e:
518 retry_count += 1;
519 time.sleep(retry_count * 0.1)
520 PrintError("os.unlink() " + str(e))
510 521
511 def Execute(args, context, timeout=None): 522 def Execute(args, context, timeout=None):
512 (fd_out, outname) = tempfile.mkstemp() 523 (fd_out, outname) = tempfile.mkstemp()
513 (fd_err, errname) = tempfile.mkstemp() 524 (fd_err, errname) = tempfile.mkstemp()
514 (process, exit_code, timed_out) = RunProcess( 525 (process, exit_code, timed_out) = RunProcess(
515 context, 526 context,
516 timeout, 527 timeout,
517 args = args, 528 args = args,
518 stdout = fd_out, 529 stdout = fd_out,
519 stderr = fd_err, 530 stderr = fd_err,
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 return None 1017 return None
1007 return ast 1018 return ast
1008 1019
1009 1020
1010 class ClassifiedTest(object): 1021 class ClassifiedTest(object):
1011 1022
1012 def __init__(self, case, outcomes): 1023 def __init__(self, case, outcomes):
1013 self.case = case 1024 self.case = case
1014 self.outcomes = outcomes 1025 self.outcomes = outcomes
1015 1026
1027 def TestsIsolates(self):
1028 return self.case.TestsIsolates()
1029
1016 1030
1017 class Configuration(object): 1031 class Configuration(object):
1018 """The parsed contents of a configuration file""" 1032 """The parsed contents of a configuration file"""
1019 1033
1020 def __init__(self, sections, defs): 1034 def __init__(self, sections, defs):
1021 self.sections = sections 1035 self.sections = sections
1022 self.defs = defs 1036 self.defs = defs
1023 1037
1024 def ClassifyTests(self, cases, env): 1038 def ClassifyTests(self, cases, env):
1025 sections = [s for s in self.sections if s.condition.Evaluate(env, self.defs) ] 1039 sections = [s for s in self.sections if s.condition.Evaluate(env, self.defs) ]
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1165 default=False, action="store_true") 1179 default=False, action="store_true")
1166 result.add_option("-j", help="The number of parallel tasks to run", 1180 result.add_option("-j", help="The number of parallel tasks to run",
1167 default=1, type="int") 1181 default=1, type="int")
1168 result.add_option("--time", help="Print timing information after running", 1182 result.add_option("--time", help="Print timing information after running",
1169 default=False, action="store_true") 1183 default=False, action="store_true")
1170 result.add_option("--suppress-dialogs", help="Suppress Windows dialogs for cra shing tests", 1184 result.add_option("--suppress-dialogs", help="Suppress Windows dialogs for cra shing tests",
1171 dest="suppress_dialogs", default=True, action="store_true") 1185 dest="suppress_dialogs", default=True, action="store_true")
1172 result.add_option("--no-suppress-dialogs", help="Display Windows dialogs for c rashing tests", 1186 result.add_option("--no-suppress-dialogs", help="Display Windows dialogs for c rashing tests",
1173 dest="suppress_dialogs", action="store_false") 1187 dest="suppress_dialogs", action="store_false")
1174 result.add_option("--shell", help="Path to V8 shell", default="shell") 1188 result.add_option("--shell", help="Path to V8 shell", default="shell")
1189 result.add_option("--isolates", help="Whether to test isolates", default=False , action="store_true")
1175 result.add_option("--store-unexpected-output", 1190 result.add_option("--store-unexpected-output",
1176 help="Store the temporary JS files from tests that fails", 1191 help="Store the temporary JS files from tests that fails",
1177 dest="store_unexpected_output", default=True, action="store_true") 1192 dest="store_unexpected_output", default=True, action="store_true")
1178 result.add_option("--no-store-unexpected-output", 1193 result.add_option("--no-store-unexpected-output",
1179 help="Deletes the temporary JS files from tests that fails", 1194 help="Deletes the temporary JS files from tests that fails",
1180 dest="store_unexpected_output", action="store_false") 1195 dest="store_unexpected_output", action="store_false")
1181 result.add_option("--stress-only", 1196 result.add_option("--stress-only",
1182 help="Only run tests with --always-opt --stress-opt", 1197 help="Only run tests with --always-opt --stress-opt",
1183 default=False, action="store_true") 1198 default=False, action="store_true")
1184 result.add_option("--nostress", 1199 result.add_option("--nostress",
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
1431 for rule in globally_unused_rules: 1446 for rule in globally_unused_rules:
1432 print "Rule for '%s' was not used." % '/'.join([str(s) for s in rule.path] ) 1447 print "Rule for '%s' was not used." % '/'.join([str(s) for s in rule.path] )
1433 1448
1434 if options.report: 1449 if options.report:
1435 PrintReport(all_cases) 1450 PrintReport(all_cases)
1436 1451
1437 result = None 1452 result = None
1438 def DoSkip(case): 1453 def DoSkip(case):
1439 return SKIP in case.outcomes or SLOW in case.outcomes 1454 return SKIP in case.outcomes or SLOW in case.outcomes
1440 cases_to_run = [ c for c in all_cases if not DoSkip(c) ] 1455 cases_to_run = [ c for c in all_cases if not DoSkip(c) ]
1456 if not options.isolates:
1457 cases_to_run = [c for c in cases_to_run if not c.TestsIsolates()]
1441 if len(cases_to_run) == 0: 1458 if len(cases_to_run) == 0:
1442 print "No tests to run." 1459 print "No tests to run."
1443 return 0 1460 return 0
1444 else: 1461 else:
1445 try: 1462 try:
1446 start = time.time() 1463 start = time.time()
1447 if RunTestCases(cases_to_run, options.progress, options.j): 1464 if RunTestCases(cases_to_run, options.progress, options.j):
1448 result = 0 1465 result = 0
1449 else: 1466 else:
1450 result = 1 1467 result = 1
(...skipping 13 matching lines...) Expand all
1464 for entry in timed_tests[:20]: 1481 for entry in timed_tests[:20]:
1465 t = FormatTime(entry.duration) 1482 t = FormatTime(entry.duration)
1466 sys.stderr.write("%4i (%s) %s\n" % (index, t, entry.GetLabel())) 1483 sys.stderr.write("%4i (%s) %s\n" % (index, t, entry.GetLabel()))
1467 index += 1 1484 index += 1
1468 1485
1469 return result 1486 return result
1470 1487
1471 1488
1472 if __name__ == '__main__': 1489 if __name__ == '__main__':
1473 sys.exit(Main()) 1490 sys.exit(Main())
OLDNEW
« no previous file with comments | « tools/gyp/v8.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698