| 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 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1181 dest="store_unexpected_output", action="store_false") | 1181 dest="store_unexpected_output", action="store_false") |
| 1182 result.add_option("--stress-only", | 1182 result.add_option("--stress-only", |
| 1183 help="Only run tests with --always-opt --stress-opt", | 1183 help="Only run tests with --always-opt --stress-opt", |
| 1184 default=False, action="store_true") | 1184 default=False, action="store_true") |
| 1185 result.add_option("--nostress", | 1185 result.add_option("--nostress", |
| 1186 help="Don't run crankshaft --always-opt --stress-op test", | 1186 help="Don't run crankshaft --always-opt --stress-op test", |
| 1187 default=False, action="store_true") | 1187 default=False, action="store_true") |
| 1188 result.add_option("--crankshaft", | 1188 result.add_option("--crankshaft", |
| 1189 help="Run with the --crankshaft flag", | 1189 help="Run with the --crankshaft flag", |
| 1190 default=False, action="store_true") | 1190 default=False, action="store_true") |
| 1191 result.add_option("--shard-count", |
| 1192 help="Split testsuites into this number of shards", |
| 1193 default=1, type="int") |
| 1194 result.add_option("--shard-run", |
| 1195 help="Run this shard from the split up tests.", |
| 1196 default=1, type="int") |
| 1191 result.add_option("--noprof", help="Disable profiling support", | 1197 result.add_option("--noprof", help="Disable profiling support", |
| 1192 default=False) | 1198 default=False) |
| 1193 return result | 1199 return result |
| 1194 | 1200 |
| 1195 | 1201 |
| 1196 def ProcessOptions(options): | 1202 def ProcessOptions(options): |
| 1197 global VERBOSE | 1203 global VERBOSE |
| 1198 VERBOSE = options.verbose | 1204 VERBOSE = options.verbose |
| 1199 options.mode = options.mode.split(',') | 1205 options.mode = options.mode.split(',') |
| 1200 for mode in options.mode: | 1206 for mode in options.mode: |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1302 def GetSuites(test_root): | 1308 def GetSuites(test_root): |
| 1303 def IsSuite(path): | 1309 def IsSuite(path): |
| 1304 return isdir(path) and exists(join(path, 'testcfg.py')) | 1310 return isdir(path) and exists(join(path, 'testcfg.py')) |
| 1305 return [ f for f in os.listdir(test_root) if IsSuite(join(test_root, f)) ] | 1311 return [ f for f in os.listdir(test_root) if IsSuite(join(test_root, f)) ] |
| 1306 | 1312 |
| 1307 | 1313 |
| 1308 def FormatTime(d): | 1314 def FormatTime(d): |
| 1309 millis = round(d * 1000) % 1000 | 1315 millis = round(d * 1000) % 1000 |
| 1310 return time.strftime("%M:%S.", time.gmtime(d)) + ("%03i" % millis) | 1316 return time.strftime("%M:%S.", time.gmtime(d)) + ("%03i" % millis) |
| 1311 | 1317 |
| 1318 def ShardTests(tests, options): |
| 1319 if options.shard_count < 2: |
| 1320 return tests |
| 1321 if options.shard_run < 1 or options.shard_run > options.shard_count: |
| 1322 print "shard-run not a valid number, should be in [1:shard-count]" |
| 1323 print "defaulting back to running all tests" |
| 1324 return tests |
| 1325 count = 0; |
| 1326 shard = [] |
| 1327 for test in tests: |
| 1328 if count % options.shard_count == options.shard_run - 1: |
| 1329 shard.append(test); |
| 1330 count += 1 |
| 1331 return shard |
| 1312 | 1332 |
| 1313 def Main(): | 1333 def Main(): |
| 1314 parser = BuildOptions() | 1334 parser = BuildOptions() |
| 1315 (options, args) = parser.parse_args() | 1335 (options, args) = parser.parse_args() |
| 1316 if not ProcessOptions(options): | 1336 if not ProcessOptions(options): |
| 1317 parser.print_help() | 1337 parser.print_help() |
| 1318 return 1 | 1338 return 1 |
| 1319 | 1339 |
| 1320 workspace = abspath(join(dirname(sys.argv[0]), '..')) | 1340 workspace = abspath(join(dirname(sys.argv[0]), '..')) |
| 1321 suites = GetSuites(join(workspace, 'test')) | 1341 suites = GetSuites(join(workspace, 'test')) |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1385 'simulator': options.simulator, | 1405 'simulator': options.simulator, |
| 1386 'crankshaft': options.crankshaft | 1406 'crankshaft': options.crankshaft |
| 1387 } | 1407 } |
| 1388 test_list = root.ListTests([], path, context, mode) | 1408 test_list = root.ListTests([], path, context, mode) |
| 1389 unclassified_tests += test_list | 1409 unclassified_tests += test_list |
| 1390 (cases, unused_rules, all_outcomes) = config.ClassifyTests(test_list, env) | 1410 (cases, unused_rules, all_outcomes) = config.ClassifyTests(test_list, env) |
| 1391 if globally_unused_rules is None: | 1411 if globally_unused_rules is None: |
| 1392 globally_unused_rules = set(unused_rules) | 1412 globally_unused_rules = set(unused_rules) |
| 1393 else: | 1413 else: |
| 1394 globally_unused_rules = globally_unused_rules.intersection(unused_rules) | 1414 globally_unused_rules = globally_unused_rules.intersection(unused_rules) |
| 1395 all_cases += cases | 1415 all_cases += ShardTests(cases, options) |
| 1396 all_unused.append(unused_rules) | 1416 all_unused.append(unused_rules) |
| 1397 | 1417 |
| 1398 if options.cat: | 1418 if options.cat: |
| 1399 visited = set() | 1419 visited = set() |
| 1400 for test in unclassified_tests: | 1420 for test in unclassified_tests: |
| 1401 key = tuple(test.path) | 1421 key = tuple(test.path) |
| 1402 if key in visited: | 1422 if key in visited: |
| 1403 continue | 1423 continue |
| 1404 visited.add(key) | 1424 visited.add(key) |
| 1405 print "--- begin source: %s ---" % test.GetLabel() | 1425 print "--- begin source: %s ---" % test.GetLabel() |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1447 for entry in timed_tests[:20]: | 1467 for entry in timed_tests[:20]: |
| 1448 t = FormatTime(entry.duration) | 1468 t = FormatTime(entry.duration) |
| 1449 sys.stderr.write("%4i (%s) %s\n" % (index, t, entry.GetLabel())) | 1469 sys.stderr.write("%4i (%s) %s\n" % (index, t, entry.GetLabel())) |
| 1450 index += 1 | 1470 index += 1 |
| 1451 | 1471 |
| 1452 return result | 1472 return result |
| 1453 | 1473 |
| 1454 | 1474 |
| 1455 if __name__ == '__main__': | 1475 if __name__ == '__main__': |
| 1456 sys.exit(Main()) | 1476 sys.exit(Main()) |
| OLD | NEW |