[tools] Add clean action to gm.py
Now you can also clean build directories: x64.optdebug.clean Or clean and build: x64.release.clean.d8 No-Try: True Change-Id: I3df59416d4ce7db5306c0b09c9ee8293c7a345f9 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2964595 Commit-Queue: Camillo Bruni <cbruni@chromium.org> Reviewed-by: Jakob Kummerow <jkummerow@chromium.org> Cr-Commit-Position: refs/heads/master@{#75176}
This commit is contained in:
parent
9a311bcb34
commit
1baa7c1d3c
@ -63,10 +63,31 @@ DEFAULT_TESTS = ["cctest", "debugger", "intl", "message", "mjsunit",
|
||||
# These can be suffixed to any <arch>.<mode> combo, or used standalone,
|
||||
# or used as global modifiers (affecting all <arch>.<mode> combos).
|
||||
ACTIONS = {
|
||||
"all": {"targets": BUILD_TARGETS_ALL, "tests": []},
|
||||
"tests": {"targets": BUILD_TARGETS_TEST, "tests": []},
|
||||
"check": {"targets": BUILD_TARGETS_TEST, "tests": DEFAULT_TESTS},
|
||||
"checkall": {"targets": BUILD_TARGETS_ALL, "tests": ["ALL"]},
|
||||
"all": {
|
||||
"targets": BUILD_TARGETS_ALL,
|
||||
"tests": [],
|
||||
"clean": False
|
||||
},
|
||||
"tests": {
|
||||
"targets": BUILD_TARGETS_TEST,
|
||||
"tests": [],
|
||||
"clean": False
|
||||
},
|
||||
"check": {
|
||||
"targets": BUILD_TARGETS_TEST,
|
||||
"tests": DEFAULT_TESTS,
|
||||
"clean": False
|
||||
},
|
||||
"checkall": {
|
||||
"targets": BUILD_TARGETS_ALL,
|
||||
"tests": ["ALL"],
|
||||
"clean": False
|
||||
},
|
||||
"clean": {
|
||||
"targets": [],
|
||||
"tests": [],
|
||||
"clean": True
|
||||
},
|
||||
}
|
||||
|
||||
HELP = """<arch> can be any of: %(arches)s
|
||||
@ -247,16 +268,24 @@ def PrepareMksnapshotCmdline(orig_cmdline, path):
|
||||
return result
|
||||
|
||||
class Config(object):
|
||||
def __init__(self, arch, mode, targets, tests=[], testrunner_args=[]):
|
||||
def __init__(self,
|
||||
arch,
|
||||
mode,
|
||||
targets,
|
||||
tests=[],
|
||||
clean=False,
|
||||
testrunner_args=[]):
|
||||
self.arch = arch
|
||||
self.mode = mode
|
||||
self.targets = set(targets)
|
||||
self.tests = set(tests)
|
||||
self.testrunner_args = testrunner_args
|
||||
self.clean = clean
|
||||
|
||||
def Extend(self, targets, tests=[]):
|
||||
def Extend(self, targets, tests=[], clean=False):
|
||||
self.targets.update(targets)
|
||||
self.tests.update(tests)
|
||||
self.clean |= clean
|
||||
|
||||
def GetTargetCpu(self):
|
||||
cpu = "x86"
|
||||
@ -318,6 +347,9 @@ class Config(object):
|
||||
if not os.path.exists(build_ninja):
|
||||
code = _Call("gn gen %s" % path)
|
||||
if code != 0: return code
|
||||
elif self.clean:
|
||||
code = _Call("gn clean %s" % path)
|
||||
if code != 0: return code
|
||||
targets = " ".join(self.targets)
|
||||
# The implementation of mksnapshot failure detection relies on
|
||||
# the "pty" module and GDB presence, so skip it on non-Linux.
|
||||
@ -368,12 +400,12 @@ class ArgumentParser(object):
|
||||
self.configs = {}
|
||||
self.testrunner_args = []
|
||||
|
||||
def PopulateConfigs(self, arches, modes, targets, tests):
|
||||
def PopulateConfigs(self, arches, modes, targets, tests, clean):
|
||||
for a in arches:
|
||||
for m in modes:
|
||||
path = GetPath(a, m)
|
||||
if path not in self.configs:
|
||||
self.configs[path] = Config(a, m, targets, tests,
|
||||
self.configs[path] = Config(a, m, targets, tests, clean,
|
||||
self.testrunner_args)
|
||||
else:
|
||||
self.configs[path].Extend(targets, tests)
|
||||
@ -398,9 +430,10 @@ class ArgumentParser(object):
|
||||
targets = []
|
||||
actions = []
|
||||
tests = []
|
||||
clean = False
|
||||
# Special handling for "mkgrokdump": build it for x64.release.
|
||||
if argstring == "mkgrokdump":
|
||||
self.PopulateConfigs(["x64"], ["release"], ["mkgrokdump"], [])
|
||||
self.PopulateConfigs(["x64"], ["release"], ["mkgrokdump"], [], False)
|
||||
return
|
||||
# Specifying a single unit test looks like "unittests/Foo.Bar", test262
|
||||
# tests have names like "S15.4.4.7_A4_T1", don't split these.
|
||||
@ -445,12 +478,13 @@ class ArgumentParser(object):
|
||||
impact = ACTIONS[action]
|
||||
targets += impact["targets"]
|
||||
tests += impact["tests"]
|
||||
clean |= impact["clean"]
|
||||
# Fill in defaults for things that weren't specified.
|
||||
arches = arches or DEFAULT_ARCHES
|
||||
modes = modes or DEFAULT_MODES
|
||||
targets = targets or DEFAULT_TARGETS
|
||||
# Produce configs.
|
||||
self.PopulateConfigs(arches, modes, targets, tests)
|
||||
self.PopulateConfigs(arches, modes, targets, tests, clean)
|
||||
|
||||
def ParseArguments(self, argv):
|
||||
if len(argv) == 0:
|
||||
|
Loading…
Reference in New Issue
Block a user