scripts: Show an error if a symbol file is too big

If the symbol file to be uploaded to the symbol server is close to the limit
at which the symbol server will reject it, show an error so we can do
something about it before it's too late.  This also prints the special
"@@@STEP_WARNINGS@@@" line to make the buildbot show the step as orange.

BUG=chromium-os:19194
TEST=Manually ran upload_symbols to make sure it worked with/without an error

Change-Id: I7942ba20f7bc83d66036f9f9fe66403083b1a1f1
Reviewed-on: https://gerrit.chromium.org/gerrit/20664
Commit-Ready: Michael Krebs <mkrebs@chromium.org>
Tested-by: Michael Krebs <mkrebs@chromium.org>
Reviewed-by: David James <davidjames@chromium.org>
This commit is contained in:
Michael Krebs 2012-04-19 17:17:31 -07:00 committed by Gerrit
parent 44a3b35f44
commit c91d3ebb17

View File

@ -23,8 +23,8 @@ DEFINE_string board "$DEFAULT_BOARD" "The board to build packages for."
DEFINE_string breakpad_root "" "Root directory for breakpad symbols." DEFINE_string breakpad_root "" "Root directory for breakpad symbols."
DEFINE_boolean official_build ${FLAGS_FALSE} "Point to official symbol server." DEFINE_boolean official_build ${FLAGS_FALSE} "Point to official symbol server."
DEFINE_boolean regenerate ${FLAGS_FALSE} "Regenerate all symbols." DEFINE_boolean regenerate ${FLAGS_FALSE} "Regenerate all symbols."
# Default of 300MB is the current limit that the Crash server enforces. # Default of 290M is relative to current 300M limit the Crash server enforces.
DEFINE_integer strip_cfi 300000000 "Strip CFI data for files above this size." DEFINE_integer strip_cfi 290000000 "Strip CFI data for files above this size."
DEFINE_boolean testing ${FLAGS_FALSE} \ DEFINE_boolean testing ${FLAGS_FALSE} \
"Run in testing mode (should be first argument)." "Run in testing mode (should be first argument)."
DEFINE_boolean verbose ${FLAGS_FALSE} "Be verbose." DEFINE_boolean verbose ${FLAGS_FALSE} "Be verbose."
@ -100,6 +100,15 @@ ${FLAGS_strip_cfi}."
if [ ${FLAGS_verbose} -eq ${FLAGS_TRUE} ]; then if [ ${FLAGS_verbose} -eq ${FLAGS_TRUE} ]; then
info "Uploading ${symbol_file}" info "Uploading ${symbol_file}"
fi fi
local upload_size="$(stat -c%s ${upload_file})"
if [ ${upload_size} -gt ${FLAGS_strip_cfi} ]; then
# Emit an annotation in order to flag the current step in buildbots.
# NOTE: Must be on a line by itself.
echo "@@@STEP_WARNINGS@@@" >&2
error "Upload file ${upload_file} is awfully large, risking rejection by \
symbol server (${upload_size} > ${FLAGS_strip_cfi})"
let ++TOTAL_ERROR_COUNT
fi
# Upload the symbol file, allowing for ${MAX_RETRIES} number of retries # Upload the symbol file, allowing for ${MAX_RETRIES} number of retries
# before giving an error. However, don't retry if the total errors have # before giving an error. However, don't retry if the total errors have