Commit Graph

6 Commits

Author SHA1 Message Date
David James
359d3e119d Simplify boilerplate common.sh code in src/scripts.
Currently, the scripts in src/scripts have multiple implementations
for handling when common.sh fails to load, some of which are buggy.
To simplify the boilerplate, these scripts now just exit if common.sh
fails to load. The shell itself will print the following message if
common.sh is not found:
  /usr/lib/crosutils/common.sh: No such file or directory

BUG=chromium-os:32442
TEST=Run these scripts with and without common.sh installed.

Change-Id: Ie54420b6c649774f9cb039c14c80f4cf6c6ebc07
Reviewed-on: https://gerrit.chromium.org/gerrit/27058
Reviewed-by: David James <davidjames@chromium.org>
Tested-by: David James <davidjames@chromium.org>
Commit-Ready: David James <davidjames@chromium.org>
2012-07-12 10:55:37 -07:00
Mike Frysinger
6b1abb2a6f fix up function style
The "function" keyword is superfluous, not in POSIX, is inconsistent
between bash files, and generally makes me angry.  So convert every
instance to the form:
	foo() {

BUG=None
TEST=`cbuildbot x86-generic-paladin` works

Change-Id: I97f5ca30a3edfef7222b1e08ac23917dc613b556
Reviewed-on: https://gerrit.chromium.org/gerrit/22467
Reviewed-by: David James <davidjames@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2012-05-11 14:10:38 -07:00
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
Thieu Le
8bfc4b5247 Support finding minidumps located deeper in the test results tree.
BUG=chromium-os:21383
TEST=Manual run of cros_generate_stacks_bvt against a test result that
has a minidump buried 6 levels deep

Change-Id: Iebb24f02d086c24feaae47603460ec83ded15800
Reviewed-on: http://gerrit.chromium.org/gerrit/8924
Tested-by: Thieu Le <thieule@chromium.org>
Reviewed-by: Chris Masone <cmasone@chromium.org>
Commit-Ready: Thieu Le <thieule@chromium.org>
2011-10-06 17:43:17 -07:00
Daniel Erat
056c3f53bd scripts: Make cros_generate_stacks_bvt user-friendlier.
This adds support for using debug tarballs located on the
local machine instead of only ones on remote servers.  (If
the first argument is a local file, we use it; otherwise, we
try to download it.)

It also makes us download the (tiny) minidumps before the
(huge) tarball so we can bail out quickly if the minidump
URL is wrong.

BUG=chromium-os:19565
TEST=manual: ran it successfully with both local and remote tarballs and checked that it fails early when given an invalid minidump path

Change-Id: Ie427b50e4b7e37c6c81a1137eb34a28e25f32c8e
Reviewed-on: http://gerrit.chromium.org/gerrit/8910
Tested-by: Daniel Erat <derat@chromium.org>
Reviewed-by: Steven Bennetts <stevenjb@chromium.org>
Reviewed-by: Thieu Le <thieule@chromium.org>
Commit-Ready: Daniel Erat <derat@chromium.org>
2011-10-06 15:45:33 -07:00
Thieu Le
73293cd578 New script to generate stack traces from BVT test failures.
BUG=chromium-os:19565
TEST=Manually ran script

Change-Id: I7f565ddd2e06f4b25aa5d47614cedf7bec786580
Reviewed-on: http://gerrit.chromium.org/gerrit/7093
Reviewed-by: Daniel Erat <derat@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Thieu Le <thieule@chromium.org>
2011-09-01 17:18:12 -07:00