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

Side by Side Diff: tools/test.py

Issue 6127003: Enable sharding of individual testsuites in tools/test.py... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 11 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 | « test/mjsunit/testcfg.py ('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 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after
1174 dest="store_unexpected_output", action="store_false") 1174 dest="store_unexpected_output", action="store_false")
1175 result.add_option("--stress-only", 1175 result.add_option("--stress-only",
1176 help="Only run tests with --always-opt --stress-opt", 1176 help="Only run tests with --always-opt --stress-opt",
1177 default=False, action="store_true") 1177 default=False, action="store_true")
1178 result.add_option("--nostress", 1178 result.add_option("--nostress",
1179 help="Don't run crankshaft --always-opt --stress-op test", 1179 help="Don't run crankshaft --always-opt --stress-op test",
1180 default=False, action="store_true") 1180 default=False, action="store_true")
1181 result.add_option("--crankshaft", 1181 result.add_option("--crankshaft",
1182 help="Run with the --crankshaft flag", 1182 help="Run with the --crankshaft flag",
1183 default=False, action="store_true") 1183 default=False, action="store_true")
1184 result.add_option("--shard-count", help="Split testsuites into this number of shards",
Mads Ager (chromium) 2011/01/10 13:51:12 Split over more lines like the other options?
Rico 2011/01/10 13:54:24 Done.
1185 default=1, type="int")
1186 result.add_option("--shard-run", help="Run this shard from the split up tests. ",
1187 default=1, type="int")
1184 result.add_option("--noprof", help="Disable profiling support", 1188 result.add_option("--noprof", help="Disable profiling support",
1185 default=False) 1189 default=False)
1186 return result 1190 return result
1187 1191
1188 1192
1189 def ProcessOptions(options): 1193 def ProcessOptions(options):
1190 global VERBOSE 1194 global VERBOSE
1191 VERBOSE = options.verbose 1195 VERBOSE = options.verbose
1192 options.mode = options.mode.split(',') 1196 options.mode = options.mode.split(',')
1193 for mode in options.mode: 1197 for mode in options.mode:
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1295 def GetSuites(test_root): 1299 def GetSuites(test_root):
1296 def IsSuite(path): 1300 def IsSuite(path):
1297 return isdir(path) and exists(join(path, 'testcfg.py')) 1301 return isdir(path) and exists(join(path, 'testcfg.py'))
1298 return [ f for f in os.listdir(test_root) if IsSuite(join(test_root, f)) ] 1302 return [ f for f in os.listdir(test_root) if IsSuite(join(test_root, f)) ]
1299 1303
1300 1304
1301 def FormatTime(d): 1305 def FormatTime(d):
1302 millis = round(d * 1000) % 1000 1306 millis = round(d * 1000) % 1000
1303 return time.strftime("%M:%S.", time.gmtime(d)) + ("%03i" % millis) 1307 return time.strftime("%M:%S.", time.gmtime(d)) + ("%03i" % millis)
1304 1308
1309 def ShardTests(tests, options):
1310 if options.shard_count < 2:
1311 return tests
1312 if options.shard_run < 1 or options.shard_run > options.shard_count:
1313 print "shard-run not a valid number, should be in [1:shard-count]"
1314 print "defaulting back to running all tests"
1315 return tests
1316 count = 0;
1317 shard = []
1318 for test in tests:
1319 if count % options.shard_count == options.shard_run - 1:
1320 shard.append(test);
1321 count += 1
1322 return shard
1305 1323
1306 def Main(): 1324 def Main():
1307 parser = BuildOptions() 1325 parser = BuildOptions()
1308 (options, args) = parser.parse_args() 1326 (options, args) = parser.parse_args()
1309 if not ProcessOptions(options): 1327 if not ProcessOptions(options):
1310 parser.print_help() 1328 parser.print_help()
1311 return 1 1329 return 1
1312 1330
1313 workspace = abspath(join(dirname(sys.argv[0]), '..')) 1331 workspace = abspath(join(dirname(sys.argv[0]), '..'))
1314 suites = GetSuites(join(workspace, 'test')) 1332 suites = GetSuites(join(workspace, 'test'))
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1373 continue 1391 continue
1374 env = { 1392 env = {
1375 'mode': mode, 1393 'mode': mode,
1376 'system': utils.GuessOS(), 1394 'system': utils.GuessOS(),
1377 'arch': options.arch, 1395 'arch': options.arch,
1378 'simulator': options.simulator, 1396 'simulator': options.simulator,
1379 'crankshaft': options.crankshaft 1397 'crankshaft': options.crankshaft
1380 } 1398 }
1381 test_list = root.ListTests([], path, context, mode) 1399 test_list = root.ListTests([], path, context, mode)
1382 unclassified_tests += test_list 1400 unclassified_tests += test_list
1401
1383 (cases, unused_rules, all_outcomes) = config.ClassifyTests(test_list, env) 1402 (cases, unused_rules, all_outcomes) = config.ClassifyTests(test_list, env)
1384 if globally_unused_rules is None: 1403 if globally_unused_rules is None:
1385 globally_unused_rules = set(unused_rules) 1404 globally_unused_rules = set(unused_rules)
1386 else: 1405 else:
1387 globally_unused_rules = globally_unused_rules.intersection(unused_rules) 1406 globally_unused_rules = globally_unused_rules.intersection(unused_rules)
1388 all_cases += cases 1407 all_cases += ShardTests(cases, options)
1389 all_unused.append(unused_rules) 1408 all_unused.append(unused_rules)
1390 1409
1391 if options.cat: 1410 if options.cat:
1392 visited = set() 1411 visited = set()
1393 for test in unclassified_tests: 1412 for test in unclassified_tests:
1394 key = tuple(test.path) 1413 key = tuple(test.path)
1395 if key in visited: 1414 if key in visited:
1396 continue 1415 continue
1397 visited.add(key) 1416 visited.add(key)
1398 print "--- begin source: %s ---" % test.GetLabel() 1417 print "--- begin source: %s ---" % test.GetLabel()
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1438 for entry in timed_tests[:20]: 1457 for entry in timed_tests[:20]:
1439 t = FormatTime(entry.duration) 1458 t = FormatTime(entry.duration)
1440 sys.stderr.write("%4i (%s) %s\n" % (index, t, entry.GetLabel())) 1459 sys.stderr.write("%4i (%s) %s\n" % (index, t, entry.GetLabel()))
1441 index += 1 1460 index += 1
1442 1461
1443 return result 1462 return result
1444 1463
1445 1464
1446 if __name__ == '__main__': 1465 if __name__ == '__main__':
1447 sys.exit(Main()) 1466 sys.exit(Main())
OLDNEW
« no previous file with comments | « test/mjsunit/testcfg.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698