MCPcopy Create free account
hub / github.com/nodejs/node / parse_arg

Method parse_arg

deps/v8/tools/dev/gm.py:726–807  ·  view source on GitHub ↗
(self, argstring)

Source from the content-addressed store, hash-verified

724 return True
725
726 def parse_arg(self, argstring):
727 if argstring in ("-h", "--help", "help"):
728 print_help_and_exit()
729 if argstring == "--print-completions":
730 print_completions_and_exit()
731 if argstring == "quiet":
732 global QUIET
733 QUIET = True
734 return
735 arches = []
736 modes = []
737 targets = []
738 actions = []
739 tests = []
740 clean = False
741 # Special handling for "mkgrokdump": build it for (arm64|x64).release.
742 if argstring == "mkgrokdump":
743 arch = "x64"
744 if _get_machine() in ("aarch64", "arm64"):
745 arch = "arm64"
746 self.populate_configs([arch], ["release"], ["mkgrokdump"], [], False)
747 return
748 if argstring.startswith("--"):
749 # Pass all other flags to test runner.
750 self.testrunner_args.append(argstring)
751 return
752 # Specifying a directory like "out/foo" enters "manual mode".
753 if self.maybe_parse_builddir(argstring):
754 return
755 # Specifying a single unit test looks like "unittests/Foo.Bar", test262
756 # tests have names like "S15.4.4.7_A4_T1", don't split these.
757 if (argstring.startswith("unittests/") or
758 argstring.startswith("test262/") or argstring.startswith("fuzzer/") or
759 argstring.startswith("wasm-api-tests/")):
760 words = [argstring]
761 else:
762 # Assume it's a word like "x64.release" -> split at the dot.
763 words = argstring.split('.')
764 if len(words) == 1:
765 word = words[0]
766 if word in ACTIONS:
767 self.global_actions.add(word)
768 return
769 if word in TARGETS:
770 self.global_targets.add(word)
771 return
772 maybe_target = get_test_binary(word)
773 if maybe_target is not None:
774 self.global_tests.add(word)
775 self.global_targets.add(maybe_target)
776 return
777 for word in words:
778 if word in ARCHES:
779 arches.append(word)
780 elif word in MODES:
781 modes.append(MODES[word])
782 elif word in TARGETS:
783 targets.append(word)

Callers 1

parse_argumentsMethod · 0.95

Calls 12

populate_configsMethod · 0.95
maybe_parse_builddirMethod · 0.95
print_help_and_exitFunction · 0.85
_get_machineFunction · 0.85
get_test_binaryFunction · 0.85
addMethod · 0.65
keysMethod · 0.65
printFunction · 0.50
appendMethod · 0.45
splitMethod · 0.45
exitMethod · 0.45

Tested by

no test coverage detected