@@ -1272,6 +1272,9 @@ def BuildOptions(): |
1272 | 1272 | result.add_option("--no-store-unexpected-output", |
1273 | 1273 | help="Deletes the temporary JS files from tests that fails", |
1274 | 1274 | dest="store_unexpected_output", action="store_false") |
| 1275 | + result.add_option("-r", "--run", |
| 1276 | + help="Divide the tests in m groups (interleaved) and run tests from group n (--run=n,m with n < m)", |
| 1277 | + default="") |
1275 | 1278 | return result |
1276 | 1279 |
|
1277 | 1280 |
|
@@ -1280,6 +1283,24 @@ def ProcessOptions(options): |
1280 | 1283 | VERBOSE = options.verbose |
1281 | 1284 | options.arch = options.arch.split(',') |
1282 | 1285 | options.mode = options.mode.split(',') |
| 1286 | + options.run = options.run.split(',') |
| 1287 | + if options.run == [""]: |
| 1288 | + options.run = None |
| 1289 | + elif len(options.run) != 2: |
| 1290 | + print "The run argument must be two comma-separated integers." |
| 1291 | + return False |
| 1292 | + else: |
| 1293 | + try: |
| 1294 | + options.run = map(int, options.run) |
| 1295 | + except ValueError: |
| 1296 | + print "Could not parse the integers from the run argument." |
| 1297 | + return False |
| 1298 | + if options.run[0] < 0 or options.run[1] < 0: |
| 1299 | + print "The run argument cannot have negative integers." |
| 1300 | + return False |
| 1301 | + if options.run[0] >= options.run[1]: |
| 1302 | + print "The test group to run (n) must be smaller than number of groups (m)." |
| 1303 | + return False |
1283 | 1304 | if options.J: |
1284 | 1305 | options.j = multiprocessing.cpu_count() |
1285 | 1306 | return True |
@@ -1486,6 +1507,15 @@ def Main(): |
1486 | 1507 | def DoSkip(case): |
1487 | 1508 | return SKIP in case.outcomes or SLOW in case.outcomes |
1488 | 1509 | cases_to_run = [ c for c in all_cases if not DoSkip(c) ] |
| 1510 | + if options.run is not None: |
| 1511 | + # Must ensure the list of tests is sorted before selecting, to avoid |
| 1512 | + # silent errors if this file is changed to list the tests in a way that |
| 1513 | + # can be different in different machines |
| 1514 | + cases_to_run.sort(key=lambda c: (c.case.arch, c.case.mode, c.case.file)) |
| 1515 | + cases_to_run = [ cases_to_run[i] for i |
| 1516 | + in xrange(options.run[0], |
| 1517 | + len(cases_to_run), |
| 1518 | + options.run[1]) ] |
1489 | 1519 | if len(cases_to_run) == 0: |
1490 | 1520 | print "No tests to run." |
1491 | 1521 | return 1 |
|