From c91d3ebb17a0ace718ac5beef2944baab9aeb88e Mon Sep 17 00:00:00 2001 From: Michael Krebs Date: Thu, 19 Apr 2012 17:17:31 -0700 Subject: [PATCH] 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 Tested-by: Michael Krebs Reviewed-by: David James --- upload_symbols | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/upload_symbols b/upload_symbols index 5a3249a0d8..77de602eac 100755 --- a/upload_symbols +++ b/upload_symbols @@ -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_boolean official_build ${FLAGS_FALSE} "Point to official symbol server." DEFINE_boolean regenerate ${FLAGS_FALSE} "Regenerate all symbols." -# Default of 300MB is the current limit that the Crash server enforces. -DEFINE_integer strip_cfi 300000000 "Strip CFI data for files above this size." +# Default of 290M is relative to current 300M limit the Crash server enforces. +DEFINE_integer strip_cfi 290000000 "Strip CFI data for files above this size." DEFINE_boolean testing ${FLAGS_FALSE} \ "Run in testing mode (should be first argument)." DEFINE_boolean verbose ${FLAGS_FALSE} "Be verbose." @@ -100,6 +100,15 @@ ${FLAGS_strip_cfi}." if [ ${FLAGS_verbose} -eq ${FLAGS_TRUE} ]; then info "Uploading ${symbol_file}" 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 # before giving an error. However, don't retry if the total errors have