v8/tools/run.py
Bruce Dawson cad1845ab7 Show failure codes in run.py
If mksnapshot fails then all that is printed is
    "FAILED: gen/v8/embedded.S snapshot_blob.bin"
and the command line. That complicates the investigation. Printing the
error code in run.py can help. The printing code handles large negative
numbers specially so that special Windows failure codes like 0xC0000005
are recognizable.

This code was tested by adding this early-out to main in mksnapshot.cc.

  if (argc < 1000)
    return 0xc0000005;

Bug: Chromium:1095767
Change-Id: I5dc81d368beaa339f0c519ce1c01bd13cdb18d93
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2249518
Auto-Submit: Bruce Dawson <brucedawson@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68395}
2020-06-17 17:16:22 +00:00

24 lines
718 B
Python
Executable File

#!/usr/bin/env python
# Copyright 2014 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""This program wraps an arbitrary command since gn currently can only execute
scripts."""
from __future__ import print_function
import subprocess
import sys
result = subprocess.call(sys.argv[1:])
if result != 0:
# Windows error codes such as 0xC0000005 and 0xC0000409 are much easier
# to recognize and differentiate in hex.
if result < -100:
# Print negative hex numbers as positive by adding 2^32.
print('Return code is %08X' % (result + 2**32))
else:
print('Return code is %d' % result)
sys.exit(result)