Commit f17b0d26 authored by Igor Sheludko's avatar Igor Sheludko Committed by Commit Bot

[gm.py] Allow arbitrary mode suffixes

which will allow gm to work for more directories than just [<arch>].[<mode>]:
  gm.py ia32.release-nosnap.check
  gm.py x64.optdebug-ptr-compr cctest unittests

Basically the new usage is:
  gm.py [<arch>].[<mode>[-<suffix>]].[<target>] [testname...]

Once default gn configuration is created based on <arch> and <mode> the script user
may change it and then use gm as usual.

Bug: v8:8238
Change-Id: I9659b87073e815e0e4754f0a2f1056f3403c149c
Reviewed-on: https://chromium-review.googlesource.com/c/1323734Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57328}
parent 83f6e468
...@@ -10,10 +10,10 @@ Uses Goma by default if it is detected (at output directory setup time). ...@@ -10,10 +10,10 @@ Uses Goma by default if it is detected (at output directory setup time).
Expects to be run from the root of a V8 checkout. Expects to be run from the root of a V8 checkout.
Usage: Usage:
gm.py [<arch>].[<mode>].[<target>] [testname...] gm.py [<arch>].[<mode>[-<suffix>]].[<target>] [testname...]
All arguments are optional. Most combinations should work, e.g.: All arguments are optional. Most combinations should work, e.g.:
gm.py ia32.debug x64.release d8 gm.py ia32.debug x64.release x64.release-my-custom-opts d8
gm.py android_arm.release.check gm.py android_arm.release.check
gm.py x64 mjsunit/foo cctest/test-bar/* gm.py x64 mjsunit/foo cctest/test-bar/*
""" """
...@@ -236,7 +236,9 @@ class Config(object): ...@@ -236,7 +236,9 @@ class Config(object):
return "" return ""
def GetGnArgs(self): def GetGnArgs(self):
template = ARGS_TEMPLATES[self.mode] # Use only substring before first '-' as the actual mode
mode = re.match("([^-]+)", self.mode).group(1)
template = ARGS_TEMPLATES[mode]
arch_specific = (self.GetTargetCpu() + self.GetV8TargetCpu() + arch_specific = (self.GetTargetCpu() + self.GetV8TargetCpu() +
self.GetTargetOS()) self.GetTargetOS())
return template % arch_specific return template % arch_specific
...@@ -364,6 +366,8 @@ class ArgumentParser(object): ...@@ -364,6 +366,8 @@ class ArgumentParser(object):
targets.append(word) targets.append(word)
elif word in ACTIONS: elif word in ACTIONS:
actions.append(word) actions.append(word)
elif any(map(lambda x: word.startswith(x + "-"), MODES)):
modes.append(word)
else: else:
print("Didn't understand: %s" % word) print("Didn't understand: %s" % word)
sys.exit(1) sys.exit(1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment