| 1469 | |
| 1470 | |
| 1471 | def ProcessOptions(options): |
| 1472 | global VERBOSE |
| 1473 | VERBOSE = options.verbose |
| 1474 | options.arch = options.arch.split(',') |
| 1475 | options.mode = options.mode.split(',') |
| 1476 | options.run = options.run.split(',') |
| 1477 | # Split at commas and filter out all the empty strings. |
| 1478 | options.skip_tests = [test for test in options.skip_tests.split(',') if test] |
| 1479 | if options.run == [""]: |
| 1480 | options.run = None |
| 1481 | elif len(options.run) != 2: |
| 1482 | print("The run argument must be two comma-separated integers.") |
| 1483 | return False |
| 1484 | else: |
| 1485 | try: |
| 1486 | options.run = [int(level) for level in options.run] |
| 1487 | except ValueError: |
| 1488 | print("Could not parse the integers from the run argument.") |
| 1489 | return False |
| 1490 | if options.run[0] < 0 or options.run[1] < 0: |
| 1491 | print("The run argument cannot have negative integers.") |
| 1492 | return False |
| 1493 | if options.run[0] >= options.run[1]: |
| 1494 | print("The test group to run (n) must be smaller than number of groups (m).") |
| 1495 | return False |
| 1496 | if options.j == 0: |
| 1497 | # inherit JOBS from environment if provided. some virtualised systems |
| 1498 | # tends to exaggerate the number of available cpus/cores. |
| 1499 | cores = os.environ.get('JOBS') |
| 1500 | options.j = int(cores) if cores is not None else multiprocessing.cpu_count() |
| 1501 | elif options.J: |
| 1502 | # If someone uses -j and legacy -J, let them know that we will be respecting |
| 1503 | # -j and ignoring -J, which is the opposite of what we used to do before -J |
| 1504 | # became a legacy no-op. |
| 1505 | print('Warning: Legacy -J option is ignored. Using the -j option.') |
| 1506 | if options.flaky_tests not in [RUN, SKIP, DONTCARE, KEEP_RETRYING]: |
| 1507 | print("Unknown flaky-tests mode %s" % options.flaky_tests) |
| 1508 | return False |
| 1509 | return True |
| 1510 | |
| 1511 | |
| 1512 | REPORT_TEMPLATE = """\ |