| 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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 def IsFailureOutput(self, output): | 354 def IsFailureOutput(self, output): |
| 355 return output.exit_code != 0 | 355 return output.exit_code != 0 |
| 356 | 356 |
| 357 def GetSource(self): | 357 def GetSource(self): |
| 358 return "(no source available)" | 358 return "(no source available)" |
| 359 | 359 |
| 360 def RunCommand(self, command): | 360 def RunCommand(self, command): |
| 361 full_command = self.context.processor(command) | 361 full_command = self.context.processor(command) |
| 362 output = Execute(full_command, | 362 output = Execute(full_command, |
| 363 self.context, | 363 self.context, |
| 364 self.context.GetTimeout(self.mode)) | 364 self.context.GetTimeout(self, self.mode)) |
| 365 self.Cleanup() | 365 self.Cleanup() |
| 366 return TestOutput(self, | 366 return TestOutput(self, |
| 367 full_command, | 367 full_command, |
| 368 output, | 368 output, |
| 369 self.context.store_unexpected_output) | 369 self.context.store_unexpected_output) |
| 370 | 370 |
| 371 def BeforeRun(self): | 371 def BeforeRun(self): |
| 372 pass | 372 pass |
| 373 | 373 |
| 374 def AfterRun(self, result): | 374 def AfterRun(self, result): |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 | 565 |
| 566 def __init__(self, name): | 566 def __init__(self, name): |
| 567 self.name = name | 567 self.name = name |
| 568 | 568 |
| 569 def GetName(self): | 569 def GetName(self): |
| 570 return self.name | 570 return self.name |
| 571 | 571 |
| 572 | 572 |
| 573 # Use this to run several variants of the tests, e.g.: | 573 # Use this to run several variants of the tests, e.g.: |
| 574 # VARIANT_FLAGS = [[], ['--always_compact', '--noflush_code']] | 574 # VARIANT_FLAGS = [[], ['--always_compact', '--noflush_code']] |
| 575 VARIANT_FLAGS = [[]] | 575 VARIANT_FLAGS = [[], ['--stress-opt', '--always-opt'], ['--nocrankshaft']] |
| 576 | 576 |
| 577 | 577 |
| 578 class TestRepository(TestSuite): | 578 class TestRepository(TestSuite): |
| 579 | 579 |
| 580 def __init__(self, path): | 580 def __init__(self, path): |
| 581 normalized_path = abspath(path) | 581 normalized_path = abspath(path) |
| 582 super(TestRepository, self).__init__(basename(normalized_path)) | 582 super(TestRepository, self).__init__(basename(normalized_path)) |
| 583 self.path = normalized_path | 583 self.path = normalized_path |
| 584 self.is_loaded = False | 584 self.is_loaded = False |
| 585 self.config = None | 585 self.config = None |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 669 if utils.IsWindows() and not name.endswith('.exe'): | 669 if utils.IsWindows() and not name.endswith('.exe'): |
| 670 name = name + '.exe' | 670 name = name + '.exe' |
| 671 return name | 671 return name |
| 672 | 672 |
| 673 def GetVmCommand(self, testcase, mode): | 673 def GetVmCommand(self, testcase, mode): |
| 674 return [self.GetVm(mode)] + self.GetVmFlags(testcase, mode) | 674 return [self.GetVm(mode)] + self.GetVmFlags(testcase, mode) |
| 675 | 675 |
| 676 def GetVmFlags(self, testcase, mode): | 676 def GetVmFlags(self, testcase, mode): |
| 677 return testcase.variant_flags + FLAGS[mode] | 677 return testcase.variant_flags + FLAGS[mode] |
| 678 | 678 |
| 679 def GetTimeout(self, mode): | 679 def GetTimeout(self, testcase, mode): |
| 680 return self.timeout * TIMEOUT_SCALEFACTOR[mode] | 680 result = self.timeout * TIMEOUT_SCALEFACTOR[mode] |
| 681 if '--stress-opt' in self.GetVmFlags(testcase, mode): |
| 682 return result * 2 |
| 683 else: |
| 684 return result |
| 681 | 685 |
| 682 def RunTestCases(cases_to_run, progress, tasks): | 686 def RunTestCases(cases_to_run, progress, tasks): |
| 683 progress = PROGRESS_INDICATORS[progress](cases_to_run) | 687 progress = PROGRESS_INDICATORS[progress](cases_to_run) |
| 684 return progress.Run(tasks) | 688 return progress.Run(tasks) |
| 685 | 689 |
| 686 | 690 |
| 687 def BuildRequirements(context, requirements, mode, scons_flags): | 691 def BuildRequirements(context, requirements, mode, scons_flags): |
| 688 command_line = (['scons', '-Y', context.workspace, 'mode=' + ",".join(mode)] | 692 command_line = (['scons', '-Y', context.workspace, 'mode=' + ",".join(mode)] |
| 689 + requirements | 693 + requirements |
| 690 + scons_flags) | 694 + scons_flags) |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1159 result.add_option("-j", help="The number of parallel tasks to run", | 1163 result.add_option("-j", help="The number of parallel tasks to run", |
| 1160 default=1, type="int") | 1164 default=1, type="int") |
| 1161 result.add_option("--time", help="Print timing information after running", | 1165 result.add_option("--time", help="Print timing information after running", |
| 1162 default=False, action="store_true") | 1166 default=False, action="store_true") |
| 1163 result.add_option("--suppress-dialogs", help="Suppress Windows dialogs for cra
shing tests", | 1167 result.add_option("--suppress-dialogs", help="Suppress Windows dialogs for cra
shing tests", |
| 1164 dest="suppress_dialogs", default=True, action="store_true") | 1168 dest="suppress_dialogs", default=True, action="store_true") |
| 1165 result.add_option("--no-suppress-dialogs", help="Display Windows dialogs for c
rashing tests", | 1169 result.add_option("--no-suppress-dialogs", help="Display Windows dialogs for c
rashing tests", |
| 1166 dest="suppress_dialogs", action="store_false") | 1170 dest="suppress_dialogs", action="store_false") |
| 1167 result.add_option("--shell", help="Path to V8 shell", default="shell") | 1171 result.add_option("--shell", help="Path to V8 shell", default="shell") |
| 1168 result.add_option("--isolates", help="Whether to test isolates", default=False
, action="store_true") | 1172 result.add_option("--isolates", help="Whether to test isolates", default=False
, action="store_true") |
| 1169 result.add_option("--store-unexpected-output", | 1173 result.add_option("--store-unexpected-output", |
| 1170 help="Store the temporary JS files from tests that fails", | 1174 help="Store the temporary JS files from tests that fails", |
| 1171 dest="store_unexpected_output", default=True, action="store_true") | 1175 dest="store_unexpected_output", default=True, action="store_true") |
| 1172 result.add_option("--no-store-unexpected-output", | 1176 result.add_option("--no-store-unexpected-output", |
| 1173 help="Deletes the temporary JS files from tests that fails", | 1177 help="Deletes the temporary JS files from tests that fails", |
| 1174 dest="store_unexpected_output", action="store_false") | 1178 dest="store_unexpected_output", action="store_false") |
| 1179 result.add_option("--stress-only", |
| 1180 help="Only run tests with --always-opt --stress-opt", |
| 1181 default=False, action="store_true") |
| 1182 result.add_option("--nostress", |
| 1183 help="Don't run crankshaft --always-opt --stress-op test", |
| 1184 default=False, action="store_true") |
| 1175 return result | 1185 return result |
| 1176 | 1186 |
| 1177 | 1187 |
| 1178 def ProcessOptions(options): | 1188 def ProcessOptions(options): |
| 1179 global VERBOSE | 1189 global VERBOSE |
| 1180 VERBOSE = options.verbose | 1190 VERBOSE = options.verbose |
| 1181 options.mode = options.mode.split(',') | 1191 options.mode = options.mode.split(',') |
| 1182 for mode in options.mode: | 1192 for mode in options.mode: |
| 1183 if not mode in ['debug', 'release']: | 1193 if not mode in ['debug', 'release']: |
| 1184 print "Unknown mode %s" % mode | 1194 print "Unknown mode %s" % mode |
| 1185 return False | 1195 return False |
| 1186 if options.simulator != 'none': | 1196 if options.simulator != 'none': |
| 1187 # Simulator argument was set. Make sure arch and simulator agree. | 1197 # Simulator argument was set. Make sure arch and simulator agree. |
| 1188 if options.simulator != options.arch: | 1198 if options.simulator != options.arch: |
| 1189 if options.arch == 'none': | 1199 if options.arch == 'none': |
| 1190 options.arch = options.simulator | 1200 options.arch = options.simulator |
| 1191 else: | 1201 else: |
| 1192 print "Architecture %s does not match sim %s" %(options.arch, options.si
mulator) | 1202 print "Architecture %s does not match sim %s" %(options.arch, options.si
mulator) |
| 1193 return False | 1203 return False |
| 1194 # Ensure that the simulator argument is handed down to scons. | 1204 # Ensure that the simulator argument is handed down to scons. |
| 1195 options.scons_flags.append("simulator=" + options.simulator) | 1205 options.scons_flags.append("simulator=" + options.simulator) |
| 1196 else: | 1206 else: |
| 1197 # If options.arch is not set by the command line and no simulator setting | 1207 # If options.arch is not set by the command line and no simulator setting |
| 1198 # was found, set the arch to the guess. | 1208 # was found, set the arch to the guess. |
| 1199 if options.arch == 'none': | 1209 if options.arch == 'none': |
| 1200 options.arch = ARCH_GUESS | 1210 options.arch = ARCH_GUESS |
| 1201 options.scons_flags.append("arch=" + options.arch) | 1211 options.scons_flags.append("arch=" + options.arch) |
| 1202 if options.snapshot: | 1212 if options.snapshot: |
| 1203 options.scons_flags.append("snapshot=on") | 1213 options.scons_flags.append("snapshot=on") |
| 1214 global VARIANT_FLAGS |
| 1215 if options.stress_only: |
| 1216 VARIANT_FLAGS = [['--stress-opt', '--always-opt']] |
| 1217 if options.nostress: |
| 1218 VARIANT_FLAGS = [[],['--nocrankshaft']] |
| 1204 return True | 1219 return True |
| 1205 | 1220 |
| 1206 | 1221 |
| 1207 REPORT_TEMPLATE = """\ | 1222 REPORT_TEMPLATE = """\ |
| 1208 Total: %(total)i tests | 1223 Total: %(total)i tests |
| 1209 * %(skipped)4d tests will be skipped | 1224 * %(skipped)4d tests will be skipped |
| 1210 * %(nocrash)4d tests are expected to be flaky but not crash | 1225 * %(nocrash)4d tests are expected to be flaky but not crash |
| 1211 * %(pass)4d tests are expected to pass | 1226 * %(pass)4d tests are expected to pass |
| 1212 * %(fail_ok)4d tests are expected to fail that we won't fix | 1227 * %(fail_ok)4d tests are expected to fail that we won't fix |
| 1213 * %(fail)4d tests are expected to fail that we should fix\ | 1228 * %(fail)4d tests are expected to fail that we should fix\ |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1415 for entry in timed_tests[:20]: | 1430 for entry in timed_tests[:20]: |
| 1416 t = FormatTime(entry.duration) | 1431 t = FormatTime(entry.duration) |
| 1417 sys.stderr.write("%4i (%s) %s\n" % (index, t, entry.GetLabel())) | 1432 sys.stderr.write("%4i (%s) %s\n" % (index, t, entry.GetLabel())) |
| 1418 index += 1 | 1433 index += 1 |
| 1419 | 1434 |
| 1420 return result | 1435 return result |
| 1421 | 1436 |
| 1422 | 1437 |
| 1423 if __name__ == '__main__': | 1438 if __name__ == '__main__': |
| 1424 sys.exit(Main()) | 1439 sys.exit(Main()) |
| OLD | NEW |