OLD | NEW |
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 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 self.timeout = timeout | 632 self.timeout = timeout |
633 self.processor = processor | 633 self.processor = processor |
634 self.suppress_dialogs = suppress_dialogs | 634 self.suppress_dialogs = suppress_dialogs |
635 | 635 |
636 def GetVm(self, mode): | 636 def GetVm(self, mode): |
637 name = self.vm_root + SUFFIX[mode] | 637 name = self.vm_root + SUFFIX[mode] |
638 if utils.IsWindows() and not name.endswith('.exe'): | 638 if utils.IsWindows() and not name.endswith('.exe'): |
639 name = name + '.exe' | 639 name = name + '.exe' |
640 return name | 640 return name |
641 | 641 |
642 def RunTestCases(all_cases, progress, tasks): | 642 def RunTestCases(cases_to_run, progress, tasks): |
643 def DoSkip(case): | |
644 return SKIP in c.outcomes or SLOW in c.outcomes | |
645 cases_to_run = [ c for c in all_cases if not DoSkip(c) ] | |
646 progress = PROGRESS_INDICATORS[progress](cases_to_run) | 643 progress = PROGRESS_INDICATORS[progress](cases_to_run) |
647 return progress.Run(tasks) | 644 return progress.Run(tasks) |
648 | 645 |
649 | 646 |
650 def BuildRequirements(context, requirements, mode, scons_flags): | 647 def BuildRequirements(context, requirements, mode, scons_flags): |
651 command_line = (['scons', '-Y', context.workspace, 'mode=' + ",".join(mode)] | 648 command_line = (['scons', '-Y', context.workspace, 'mode=' + ",".join(mode)] |
652 + requirements | 649 + requirements |
653 + scons_flags) | 650 + scons_flags) |
654 output = ExecuteNoCapture(command_line, context) | 651 output = ExecuteNoCapture(command_line, context) |
655 return output.exit_code == 0 | 652 return output.exit_code == 0 |
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1328 return 0 | 1325 return 0 |
1329 | 1326 |
1330 if options.warn_unused: | 1327 if options.warn_unused: |
1331 for rule in globally_unused_rules: | 1328 for rule in globally_unused_rules: |
1332 print "Rule for '%s' was not used." % '/'.join([str(s) for s in rule.path]
) | 1329 print "Rule for '%s' was not used." % '/'.join([str(s) for s in rule.path]
) |
1333 | 1330 |
1334 if options.report: | 1331 if options.report: |
1335 PrintReport(all_cases) | 1332 PrintReport(all_cases) |
1336 | 1333 |
1337 result = None | 1334 result = None |
1338 if len(all_cases) == 0: | 1335 def DoSkip(case): |
| 1336 return SKIP in case.outcomes or SLOW in case.outcomes |
| 1337 cases_to_run = [ c for c in all_cases if not DoSkip(c) ] |
| 1338 if len(cases_to_run) == 0: |
1339 print "No tests to run." | 1339 print "No tests to run." |
1340 return 0 | 1340 return 0 |
1341 else: | 1341 else: |
1342 try: | 1342 try: |
1343 start = time.time() | 1343 start = time.time() |
1344 if RunTestCases(all_cases, options.progress, options.j): | 1344 if RunTestCases(cases_to_run, options.progress, options.j): |
1345 result = 0 | 1345 result = 0 |
1346 else: | 1346 else: |
1347 result = 1 | 1347 result = 1 |
1348 duration = time.time() - start | 1348 duration = time.time() - start |
1349 except KeyboardInterrupt: | 1349 except KeyboardInterrupt: |
1350 print "Interrupted" | 1350 print "Interrupted" |
1351 return 1 | 1351 return 1 |
1352 | 1352 |
1353 if options.time: | 1353 if options.time: |
1354 # Write the times to stderr to make it easy to separate from the | 1354 # Write the times to stderr to make it easy to separate from the |
1355 # test output. | 1355 # test output. |
1356 print | 1356 print |
1357 sys.stderr.write("--- Total time: %s ---\n" % FormatTime(duration)) | 1357 sys.stderr.write("--- Total time: %s ---\n" % FormatTime(duration)) |
1358 timed_tests = [ t.case for t in all_cases if not t.case.duration is None ] | 1358 timed_tests = [ t.case for t in cases_to_run if not t.case.duration is None
] |
1359 timed_tests.sort(lambda a, b: a.CompareTime(b)) | 1359 timed_tests.sort(lambda a, b: a.CompareTime(b)) |
1360 index = 1 | 1360 index = 1 |
1361 for entry in timed_tests[:20]: | 1361 for entry in timed_tests[:20]: |
1362 t = FormatTime(entry.duration) | 1362 t = FormatTime(entry.duration) |
1363 sys.stderr.write("%4i (%s) %s\n" % (index, t, entry.GetLabel())) | 1363 sys.stderr.write("%4i (%s) %s\n" % (index, t, entry.GetLabel())) |
1364 index += 1 | 1364 index += 1 |
1365 | 1365 |
1366 return result | 1366 return result |
1367 | 1367 |
1368 | 1368 |
1369 if __name__ == '__main__': | 1369 if __name__ == '__main__': |
1370 sys.exit(Main()) | 1370 sys.exit(Main()) |
OLD | NEW |