Commit Graph

5 Commits

Author SHA1 Message Date
Brian Harring
7f175a59e1 common.sh: output a backtrace and debug information on failure.
Currently, if set -e spots a nonzero exit we basically have
no real debug information- it just stops immediately without stating
where or why.  This forces our scripts to be stupidly verbose so
we can track roughly where they were, thus when they fail we can
use that information to localize the rough exit point.

Instead we should be traping that set -e induced exit and
outputing necessary debug information to run it down.  This includes
outputing the relevant stack trace, or at least what we can get of
it.

The 'die' function is now enhanced to automatically dump the trace
that lead to it.  For most consumers this is desired- however for
commandline parsing induced dies ("--board is missing" for example),
the trace is noise.  For those cases, a 'die_notrace' function was
added that retains the original non-backtrace behaviour.

Example output via instrumenting cros_generate_breakpad_symbols
w/ the failing command '/bin/false' (nonzero exit code).

Before:
./cros_generate_breakpad_symbols  monkeys --board=x86-alex
<no output at all, just exit code 1>

With this CL:
./cros_generate_breakpad_symbols  monkeys --board=x86-alex
ERROR   : script called: ./cros_generate_breakpad_symbols 'monkeys' '--board=x86-alex'
ERROR   : Backtrace:  (most recent call is last)
ERROR   :   file cros_generate_breakpad_symbols, line 207, called: main 'monkeys' '--board=x86-alex'
ERROR   :   file cros_generate_breakpad_symbols, line 163, called: die_err_trap '/bin/false' '1'
ERROR   :
ERROR   : Command failed:
ERROR   :   Command '/bin/false' exited with nonzero code: 1

BUG=chromium-os:30598
TEST=inject a failing command into a script, verify the output.
TEST=inject a 'command not found', verify the output
TEST=cbuildbot x86-generic-full --remote
TEST=cbuildbot arm-tegra2-full --remote
TEST=cbuildbot chromiumos-sdk --remote

Change-Id: I517ffde4d1bb7e2310a74f5a6455b53ba2dea86c
Reviewed-on: https://gerrit.chromium.org/gerrit/17225
Reviewed-by: Brian Harring <ferringb@chromium.org>
Tested-by: Brian Harring <ferringb@chromium.org>
Commit-Ready: Brian Harring <ferringb@chromium.org>
2012-05-07 17:19:41 -07:00
Anush Elangovan
2d7d6fd17b Enhance build_image to support new grub2 1.99+
BUG=chromium-os:21244
TEST=./build_image works with both old and new grub

Change-Id: Idca80f777b7da72da1690bc374a156f910d487b0
Reviewed-on: https://gerrit.chromium.org/gerrit/11876
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Anush Elangovan <anush@chromium.org>
Commit-Ready: Anush Elangovan <anush@chromium.org>
2011-11-18 16:21:35 -08:00
Sonny Rao
3163cf0605 Change script style for ARCH comparisons to double-bracket bash style
BUG=none
TEST=test setup_board, build_packages, build_image, image_to_vm,
on x86-generic and amd64-generic

Change-Id: I43d9d8e6e0e48cbce4d0086b78721ed86b120d4a
Reviewed-on: http://gerrit.chromium.org/gerrit/10209
Reviewed-by: Vince Laviano <vlaviano@chromium.org>
Commit-Ready: Sonny Rao <sonnyrao@chromium.org>
Tested-by: Sonny Rao <sonnyrao@chromium.org>
2011-10-17 17:53:48 -07:00
Sonny Rao
3494498738 Add amd64 recognition create_legacy_bootloader_templates.sh
This causes the script to treat amd64 the same as x86.

BUG=chromium-os:21284
TEST=./build_image for amd64-generic shouldn't generate an invalid
    architecture error

Change-Id: I37284def3cb2f0b16ece20a74d65bdb8e0116cff
Reviewed-on: http://gerrit.chromium.org/gerrit/9962
Reviewed-by: Vince Laviano <vlaviano@chromium.org>
Commit-Ready: Sonny Rao <sonnyrao@chromium.org>
Tested-by: Sonny Rao <sonnyrao@chromium.org>
2011-10-12 15:14:00 -07:00
J. Richard Barnette
f2206118f3 Isolate scripts and files that are used only in build_image
A modest number of different scripts and files have a usage
restricted to build_image.  Move those files to build_library,
to prevent them accumulating unwanted clients.

BUG=chromium-os:17390
TEST=build_image
TEST=grep relevant sources for references to all the files

Change-Id: I3e9f6447ec34c09ea2d61f29ac343386a1e122b9
Reviewed-on: http://gerrit.chromium.org/gerrit/4762
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Tested-by: Richard Barnette <jrbarnette@chromium.org>
2011-07-27 08:46:01 -07:00