OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 # Script to upload all debug symbols required for crash reporting | 6 # Script to upload all debug symbols required for crash reporting |
7 # purposes. This script need only be used to upload release builds | 7 # purposes. This script need only be used to upload release builds |
8 # symbols or to debug crashes on non-release builds (in which case try | 8 # symbols or to debug crashes on non-release builds (in which case try |
9 # to only upload the symbols for those executables involved). | 9 # to only upload the symbols for those executables involved). |
10 # | 10 # |
(...skipping 14 matching lines...) Expand all Loading... |
25 DEFINE_string breakpad_root "" "Root directory for breakpad symbols." | 25 DEFINE_string breakpad_root "" "Root directory for breakpad symbols." |
26 DEFINE_boolean official_build ${FLAGS_FALSE} "Point to official symbol server." | 26 DEFINE_boolean official_build ${FLAGS_FALSE} "Point to official symbol server." |
27 DEFINE_boolean regenerate ${FLAGS_FALSE} "Regenerate all symbols." | 27 DEFINE_boolean regenerate ${FLAGS_FALSE} "Regenerate all symbols." |
28 DEFINE_boolean verbose ${FLAGS_FALSE} "Be verbose." | 28 DEFINE_boolean verbose ${FLAGS_FALSE} "Be verbose." |
29 DEFINE_boolean yes ${FLAGS_FALSE} "Answer yes to all prompts." | 29 DEFINE_boolean yes ${FLAGS_FALSE} "Answer yes to all prompts." |
30 | 30 |
31 SYM_UPLOAD="sym_upload" | 31 SYM_UPLOAD="sym_upload" |
32 | 32 |
33 ANY_ERRORS=0 | 33 ANY_ERRORS=0 |
34 | 34 |
35 ERR_FILE=$(mktemp "/tmp/err.XXXX") | 35 OUT_DIR=$(mktemp -d "/tmp/err.XXXX") |
36 | 36 |
37 function cleanup() { | 37 function cleanup() { |
38 rm -f "${ERR_FILE}" | 38 rm -rf "${OUT_DIR}" |
39 } | 39 } |
40 | 40 |
41 function really_upload() { | 41 function really_upload() { |
42 if [ ${FLAGS_yes} -eq ${FLAGS_TRUE} ]; then | 42 if [ ${FLAGS_yes} -eq ${FLAGS_TRUE} ]; then |
43 return 0 | 43 return 0 |
44 fi | 44 fi |
45 echo "Uploading symbols for an entire Chromium OS build is really only " | 45 echo "Uploading symbols for an entire Chromium OS build is really only " |
46 echo "necessary for release builds and in a few cases for developers " | 46 echo "necessary for release builds and in a few cases for developers " |
47 echo "to debug problems. It will take considerable time to run. For " | 47 echo "to debug problems. It will take considerable time to run. For " |
48 echo "developer debugging purposes, consider instead passing specific files " | 48 echo "developer debugging purposes, consider instead passing specific files " |
49 echo "to upload." | 49 echo "to upload." |
50 read -p "Are you sure you want to upload all build symbols (y/N)? " SURE | 50 read -p "Are you sure you want to upload all build symbols (y/N)? " SURE |
51 SURE="${SURE:0:1}" # Get just the first character | 51 SURE="${SURE:0:1}" # Get just the first character |
52 if [ "${SURE}" != "y" ]; then | 52 if [ "${SURE}" != "y" ]; then |
53 echo "Ok, better safe than sorry." | 53 echo "Ok, better safe than sorry." |
54 return 1 | 54 return 1 |
55 fi | 55 fi |
56 return 0 | 56 return 0 |
57 } | 57 } |
58 | 58 |
59 # Upload the given symbol file to given URL. | 59 # Upload the given symbol file to given URL. |
60 function upload_file() { | 60 function upload_file() { |
61 local upload_file="$1" | 61 local upload_file="$1" |
62 local upload_url="$2" | 62 local upload_url="$2" |
63 if [ ${FLAGS_verbose} -eq ${FLAGS_TRUE} ]; then | 63 if [ ${FLAGS_verbose} -eq ${FLAGS_TRUE} ]; then |
64 info "Uploading ${upload_file}" | 64 info "Uploading ${upload_file}" |
65 fi | 65 fi |
66 if ! "${SYM_UPLOAD}" "${upload_file}" "${upload_url}" > /dev/null \ | 66 "${SYM_UPLOAD}" "${upload_file}" "${upload_url}" > "${OUT_DIR}/stdout" \ |
67 2> "${ERR_FILE}"; then | 67 2> "${OUT_DIR}/stderr" |
| 68 if ! grep -q "Successfully sent the symbol file." "${OUT_DIR}/stdout"; then |
68 error "Unable to upload symbols in ${upload_file}:" | 69 error "Unable to upload symbols in ${upload_file}:" |
69 cat "${ERR_FILE}" | 70 cat "${OUT_DIR}/stderr" |
70 ANY_ERRORS=1 | 71 ANY_ERRORS=1 |
71 return 1 | 72 return 1 |
72 fi | 73 fi |
73 if [ ${FLAGS_verbose} -eq ${FLAGS_TRUE} ]; then | 74 if [ ${FLAGS_verbose} -eq ${FLAGS_TRUE} ]; then |
74 size=$(wc -c "${upload_file}" | cut -d' ' -f1) | 75 size=$(wc -c "${upload_file}" | cut -d' ' -f1) |
75 info "Successfully uploaded ${size}B." | 76 info "Successfully uploaded ${size}B." |
76 fi | 77 fi |
77 return 0 | 78 return 0 |
78 } | 79 } |
79 | 80 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 done | 132 done |
132 else | 133 else |
133 error "Unexpected args ${FLAGS_ARGV}" | 134 error "Unexpected args ${FLAGS_ARGV}" |
134 fi | 135 fi |
135 | 136 |
136 [ ${ANY_ERRORS} -ne 0 ] && die "Encountered problems" | 137 [ ${ANY_ERRORS} -ne 0 ] && die "Encountered problems" |
137 return 0 | 138 return 0 |
138 } | 139 } |
139 | 140 |
140 main "$@" | 141 main "$@" |
OLD | NEW |