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>
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>
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>
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>