| 652 | return None |
| 653 | |
| 654 | class ArgumentParser(object): |
| 655 | def __init__(self): |
| 656 | self.global_targets = set() |
| 657 | self.global_tests = set() |
| 658 | self.global_actions = set() |
| 659 | self.configs = {} |
| 660 | self.testrunner_args = [] |
| 661 | |
| 662 | def populate_configs(self, arches, modes, targets, tests, clean): |
| 663 | for a in arches: |
| 664 | for m in modes: |
| 665 | path = get_path(a, m) |
| 666 | if path not in self.configs: |
| 667 | self.configs[path] = ManagedConfig(a, m, targets, tests, clean, |
| 668 | self.testrunner_args) |
| 669 | else: |
| 670 | self.configs[path].extend(targets, tests) |
| 671 | |
| 672 | def process_global_actions(self): |
| 673 | have_configs = len(self.configs) > 0 |
| 674 | for action in self.global_actions: |
| 675 | impact = ACTIONS[action] |
| 676 | if (have_configs): |
| 677 | for c in self.configs: |
| 678 | self.configs[c].extend(**impact) |
| 679 | else: |
| 680 | self.populate_configs(DEFAULT_ARCHES, DEFAULT_MODES, **impact) |
| 681 | |
| 682 | def maybe_parse_builddir(self, argstring): |
| 683 | outdir_prefix = str(OUTDIR_BASENAME) + os.path.sep |
| 684 | # {argstring} must have the shape "out/x", and the 'x' part must be |
| 685 | # at least one character. |
| 686 | if not argstring.startswith(outdir_prefix): |
| 687 | return False |
| 688 | if len(argstring) <= len(outdir_prefix): |
| 689 | return False |
| 690 | # "out/foo.d8" -> path="out/foo", targets=["d8"] |
| 691 | # "out/d8.cctest" -> path="out/d8", targets=["cctest"] |
| 692 | # "out/x.y.d8.cctest" -> path="out/x.y", targets=["d8", "cctest"] |
| 693 | argstring = argstring.replace(outdir_prefix, "") |
| 694 | words = argstring.split('.') |
| 695 | path_end = len(words) |
| 696 | targets = [] |
| 697 | tests = [] |
| 698 | clean = False |
| 699 | while path_end > 1: |
| 700 | w = words[path_end - 1] |
| 701 | maybe_target = get_test_binary(w) |
| 702 | if w in TARGETS: |
| 703 | targets.append(w) |
| 704 | elif maybe_target is not None: |
| 705 | targets.append(maybe_target) |
| 706 | tests.append(w) |
| 707 | elif w == 'clean': |
| 708 | clean = True |
| 709 | else: |
| 710 | break |
| 711 | path_end -= 1 |
no outgoing calls
no test coverage detected
searching dependent graphs…