Commit 0685745c authored by Jakob Kummerow's avatar Jakob Kummerow Committed by Commit Bot

[gm.py] Improve mksnapshot failure detection

Dynamically process the arguments instead of hardcoding them,
which is brittle when they change.

Change-Id: I08f603dc6df6e3ed34518326b67da15f6a6d6102
Reviewed-on: https://chromium-review.googlesource.com/c/1405312
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58733}
parent fd49c8bb
......@@ -206,6 +206,16 @@ def GetPath(arch, mode):
subdir = "%s.%s" % (arch, mode)
return os.path.join(OUTDIR, subdir)
def PrepareMksnapshotCmdline(orig_cmdline, path):
result = "gdb --args %s/mksnapshot " % path
for w in orig_cmdline.split(" "):
if w.startswith("gen/") or w.startswith("snapshot_blob"):
result += ("%(path)s%(sep)s%(arg)s " %
{"path": path, "sep": os.sep, "arg": w})
else:
result += "%s " % w
return result
class Config(object):
def __init__(self, arch, mode, targets, tests=[]):
self.arch = arch
......@@ -266,32 +276,16 @@ class Config(object):
return_code, output = _CallWithOutput("autoninja -C %s %s" %
(path, targets))
if return_code != 0 and "FAILED: snapshot_blob.bin" in output:
csa_trap = re.compile("Specify option( --csa-trap-on-node=[^ ]*)")
match = csa_trap.search(output)
extra_opt = match.group(1) if match else ""
_Notify("V8 build requires your attention",
"Detected mksnapshot failure, re-running in GDB...")
_Call("gdb -args %(path)s/mksnapshot "
"--startup_src %(path)s/gen/snapshot.cc "
"--random-seed 314159265 "
"--startup-blob %(path)s/snapshot_blob.bin"
"%(extra)s"% {"path": path, "extra": extra_opt})
if (return_code != 0 and
"FAILED: gen/embedded.cc snapshot_blob.bin" in output):
if return_code != 0 and "FAILED:" in output and "snapshot_blob" in output:
csa_trap = re.compile("Specify option( --csa-trap-on-node=[^ ]*)")
match = csa_trap.search(output)
extra_opt = match.group(1) if match else ""
cmdline = re.compile("python ../../tools/run.py ./mksnapshot (.*)")
match = cmdline.search(output)
cmdline = PrepareMksnapshotCmdline(match.group(1), path) + extra_opt
_Notify("V8 build requires your attention",
"Detected mksnapshot failure, re-running in GDB...")
_Call("gdb -args %(path)s/mksnapshot "
"--turbo-instruction-scheduling "
"--embedded_src %(path)s/gen/embedded.cc "
"--embedded_variant Default "
"--startup_src %(path)s/gen/snapshot.cc "
"--random-seed 314159265 "
"--startup-blob %(path)s/snapshot_blob.bin"
"%(extra)s"% {"path": path, "extra": extra_opt})
_Call(cmdline)
return return_code
def RunTests(self):
......
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