run-checks.sh 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556
  1. #!/bin/sh
  2. # Copyright (c) 2012 Google Inc.
  3. # All rights reserved.
  4. #
  5. # Redistribution and use in source and binary forms, with or without
  6. # modification, are permitted provided that the following conditions are
  7. # met:
  8. #
  9. # * Redistributions of source code must retain the above copyright
  10. # notice, this list of conditions and the following disclaimer.
  11. # * Redistributions in binary form must reproduce the above
  12. # copyright notice, this list of conditions and the following disclaimer
  13. # in the documentation and/or other materials provided with the
  14. # distribution.
  15. # * Neither the name of Google Inc. nor the names of its
  16. # contributors may be used to endorse or promote products derived from
  17. # this software without specific prior written permission.
  18. #
  19. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  20. # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  21. # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  22. # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  23. # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  24. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  25. # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  26. # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  27. # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  28. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  29. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  30. # Sanitize the environment
  31. export LANG=C
  32. export LC_ALL=C
  33. if [ "$BASH_VERSION" ]; then
  34. set -o posix
  35. fi
  36. PROGDIR=$(dirname "$0")
  37. PROGDIR=$(cd "$PROGDIR" && pwd)
  38. PROGNAME=$(basename "$0")
  39. . $PROGDIR/common-functions.sh
  40. DEFAULT_ABI="armeabi"
  41. VALID_ABIS="armeabi armeabi-v7a x86 mips"
  42. ABI=
  43. ADB=
  44. ALL_TESTS=
  45. ENABLE_M32=
  46. HELP=
  47. HELP_ALL=
  48. NDK_DIR=
  49. NO_CLEANUP=
  50. NO_DEVICE=
  51. NUM_JOBS=$(get_core_count)
  52. TMPDIR=
  53. for opt do
  54. # The following extracts the value if the option is like --name=<value>.
  55. optarg=$(expr -- $opt : '^--[^=]*=\(.*\)$')
  56. case $opt in
  57. --abi=*) ABI=$optarg;;
  58. --adb=*) ADB=$optarg;;
  59. --all-tests) ALL_TESTS=true;;
  60. --enable-m32) ENABLE_M32=true;;
  61. --help|-h|-?) HELP=TRUE;;
  62. --help-all) HELP_ALL=true;;
  63. --jobs=*) NUM_JOBS=$optarg;;
  64. --ndk-dir=*) NDK_DIR=$optarg;;
  65. --tmp-dir=*) TMPDIR=$optarg;;
  66. --no-cleanup) NO_CLEANUP=true;;
  67. --no-device) NO_DEVICE=true;;
  68. --quiet) decrease_verbosity;;
  69. --verbose) increase_verbosity;;
  70. -*) panic "Invalid option '$opt', see --help for details.";;
  71. *) panic "This script doesn't take any parameters. See --help for details."
  72. ;;
  73. esac
  74. done
  75. if [ "$HELP" -o "$HELP_ALL" ]; then
  76. echo "\
  77. Usage: $PROGNAME [options]
  78. This script is used to check that your Google Breakpad source tree can
  79. be properly built for Android, and that the client library and host tools
  80. work properly together.
  81. "
  82. if [ "$HELP_ALL" ]; then
  83. echo "\
  84. In more details, this script will:
  85. - Rebuild the host version of Google Breakpad in a temporary
  86. directory (with the Auto-tools based build system).
  87. - Rebuild the Android client library with the Google Breakpad build
  88. system (using autotools/configure). This requires that you define
  89. ANDROID_NDK_ROOT in your environment to point to a valid Android NDK
  90. installation directory, or use the --ndk-dir=<path> option.
  91. - Rebuild the Android client library and a test crashing program with the
  92. Android NDK build system (ndk-build).
  93. - Require an Android device connected to your machine, and the 'adb'
  94. tool in your path. They are used to:
  95. - Install and run a test crashing program.
  96. - Extract the corresponding minidump from the device.
  97. - Dump the symbols from the test program on the host with 'dump_syms'
  98. - Generate a stack trace with 'minidump_stackwalk'
  99. - Check the stack trace content for valid source file locations.
  100. You can however skip this requirement and only test the builds by using
  101. the --no-device flag.
  102. By default, all generated files will be created in a temporary directory
  103. that is removed when the script completion. If you want to inspect the
  104. files, use the --no-cleanup option.
  105. Finally, use --verbose to increase the verbosity level, this will help
  106. you see which exact commands are being issues and their result. Use the
  107. flag twice for even more output. Use --quiet to decrease verbosity
  108. instead and run the script silently.
  109. If you have a device connected, the script will probe it to determine
  110. its primary CPU ABI, and build the test program for it. You can however
  111. use the --abi=<name> option to override this (this can be useful to check
  112. the secondary ABI, e.g. using --abi=armeabi to check that such a program
  113. works correctly on an ARMv7-A device).
  114. If you don't have a device connected, the test program will be built (but
  115. not run) with the default '$DEFAULT_ABI' ABI. Again, you can use
  116. --abi=<name> to override this. Valid ABI names are:
  117. $VALID_ABIS
  118. The script will only run the client library unit test on the device
  119. by default. You can use --all-tests to also build and run the unit
  120. tests for the Breakpad tools and processor, but be warned that this
  121. adds several minutes of testing time. --all-tests will also run the
  122. host unit tests suite.
  123. "
  124. fi # HELP_ALL
  125. echo "\
  126. Valid options:
  127. --help|-h|-? Display this message.
  128. --help-all Display extended help.
  129. --enable-m32 Build 32-bit version of host tools.
  130. --abi=<name> Specify target CPU ABI [auto-detected].
  131. --jobs=<count> Run <count> build tasks in parallel [$NUM_JOBS].
  132. --ndk-dir=<path> Specify NDK installation directory.
  133. --tmp-dir=<path> Specify temporary directory (will be wiped-out).
  134. --adb=<path> Specify adb program path.
  135. --no-cleanup Don't remove temporary directory after completion.
  136. --no-device Do not try to detect devices, nor run crash test.
  137. --all-tests Run all unit tests (i.e. tools and processor ones too).
  138. --verbose Increase verbosity.
  139. --quiet Decrease verbosity."
  140. exit 0
  141. fi
  142. TESTAPP_DIR=$PROGDIR/sample_app
  143. # Select NDK install directory.
  144. if [ -z "$NDK_DIR" ]; then
  145. if [ -z "$ANDROID_NDK_ROOT" ]; then
  146. panic "Please define ANDROID_NDK_ROOT in your environment, or use \
  147. --ndk-dir=<path>."
  148. fi
  149. NDK_DIR="$ANDROID_NDK_ROOT"
  150. log "Found NDK directory: $NDK_DIR"
  151. else
  152. log "Using NDK directory: $NDK_DIR"
  153. fi
  154. # Small sanity check.
  155. NDK_BUILD="$NDK_DIR/ndk-build"
  156. if [ ! -f "$NDK_BUILD" ]; then
  157. panic "Your NDK directory is not valid (missing ndk-build): $NDK_DIR"
  158. fi
  159. # Ensure the temporary directory is deleted on exit, except if the --no-cleanup
  160. # option is used.
  161. clean_tmpdir () {
  162. if [ "$TMPDIR" ]; then
  163. if [ -z "$NO_CLEANUP" ]; then
  164. log "Cleaning up: $TMPDIR"
  165. rm -rf "$TMPDIR"
  166. else
  167. dump "Temporary directory contents preserved: $TMPDIR"
  168. fi
  169. fi
  170. exit "$@"
  171. }
  172. atexit clean_tmpdir
  173. # If --tmp-dir=<path> is not used, create a temporary directory.
  174. # Otherwise, start by cleaning up the user-provided path.
  175. if [ -z "$TMPDIR" ]; then
  176. TMPDIR=$(mktemp -d /tmp/$PROGNAME.XXXXXXXX)
  177. fail_panic "Can't create temporary directory!"
  178. log "Using temporary directory: $TMPDIR"
  179. else
  180. if [ ! -d "$TMPDIR" ]; then
  181. mkdir -p "$TMPDIR"
  182. fail_panic "Can't create temporary directory: $TMPDIR"
  183. else
  184. log "Cleaning up temporary directory: $TMPDIR"
  185. rm -rf "$TMPDIR"/*
  186. fail_panic "Cannot cleanup temporary directory!"
  187. fi
  188. fi
  189. if [ -z "$NO_DEVICE" ]; then
  190. if ! adb_check_device $ADB; then
  191. echo "$(adb_get_error)"
  192. echo "Use --no-device to build the code without running any tests."
  193. exit 1
  194. fi
  195. fi
  196. BUILD_LOG="$TMPDIR/build.log"
  197. RUN_LOG="$TMPDIR/run.log"
  198. CRASH_LOG="$TMPDIR/crash.log"
  199. set_run_log "$RUN_LOG"
  200. TMPHOST="$TMPDIR/host-local"
  201. cd "$TMPDIR"
  202. # Build host version of the tools
  203. dump "Building host binaries."
  204. CONFIGURE_FLAGS=
  205. if [ "$ENABLE_M32" ]; then
  206. CONFIGURE_FLAGS="$CONFIGURE_FLAGS --enable-m32"
  207. fi
  208. (
  209. run mkdir "$TMPDIR/build-host" &&
  210. run cd "$TMPDIR/build-host" &&
  211. run2 "$PROGDIR/../configure" --prefix="$TMPHOST" $CONFIGURE_FLAGS &&
  212. run2 make -j$NUM_JOBS install
  213. )
  214. fail_panic "Can't build host binaries!"
  215. if [ "$ALL_TESTS" ]; then
  216. dump "Running host unit tests."
  217. (
  218. run cd "$TMPDIR/build-host" &&
  219. run2 make -j$NUM_JOBS check
  220. )
  221. fail_panic "Host unit tests failed!!"
  222. fi
  223. TMPBIN=$TMPHOST/bin
  224. # Generate a stand-alone NDK toolchain
  225. # Extract CPU ABI and architecture from device, if any.
  226. if adb_check_device; then
  227. DEVICE_ABI=$(adb_shell getprop ro.product.cpu.abi)
  228. DEVICE_ABI2=$(adb_shell getprop ro.product.cpu.abi2)
  229. if [ -z "$DEVICE_ABI" ]; then
  230. panic "Can't extract ABI from connected device!"
  231. fi
  232. if [ "$DEVICE_ABI2" ]; then
  233. dump "Found device ABIs: $DEVICE_ABI $DEVICE_ABI2"
  234. else
  235. dump "Found device ABI: $DEVICE_ABI"
  236. DEVICE_ABI2=$DEVICE_ABI
  237. fi
  238. # If --abi=<name> is used, check that the device supports it.
  239. if [ "$ABI" -a "$DEVICE_ABI" != "$ABI" -a "$DEVICE_ABI2" != "$ABI" ]; then
  240. dump "ERROR: Device ABI(s) do not match --abi command-line value ($ABI)!"
  241. panic "Please use --no-device to skip device tests."
  242. fi
  243. if [ -z "$ABI" ]; then
  244. ABI=$DEVICE_ABI
  245. dump "Using CPU ABI: $ABI (device)"
  246. else
  247. dump "Using CPU ABI: $ABI (command-line)"
  248. fi
  249. else
  250. if [ -z "$ABI" ]; then
  251. # No device connected, choose default ABI
  252. ABI=$DEFAULT_ABI
  253. dump "Using CPU ABI: $ABI (default)"
  254. else
  255. dump "Using CPU ABI: $ABI (command-line)"
  256. fi
  257. fi
  258. # Check the ABI value
  259. VALID=
  260. for VALID_ABI in $VALID_ABIS; do
  261. if [ "$ABI" = "$VALID_ABI" ]; then
  262. VALID=true
  263. break
  264. fi
  265. done
  266. if [ -z "$VALID" ]; then
  267. panic "Unknown CPU ABI '$ABI'. Valid values are: $VALID_ABIS"
  268. fi
  269. # Extract architecture name from ABI
  270. case $ABI in
  271. armeabi*) ARCH=arm;;
  272. *) ARCH=$ABI;;
  273. esac
  274. # Extract GNU configuration name
  275. case $ARCH in
  276. arm)
  277. GNU_CONFIG=arm-linux-androideabi
  278. ;;
  279. x86)
  280. GNU_CONFIG=i686-linux-android
  281. ;;
  282. mips)
  283. GNU_CONFIG=mipsel-linux-android
  284. ;;
  285. *)
  286. GNU_CONFIG="$ARCH-linux-android"
  287. ;;
  288. esac
  289. # Generate standalone NDK toolchain installation
  290. NDK_STANDALONE="$TMPDIR/ndk-$ARCH-toolchain"
  291. echo "Generating NDK standalone toolchain installation"
  292. mkdir -p "$NDK_STANDALONE"
  293. # NOTE: The --platform=android-9 is required to provide <regex.h> for GTest.
  294. run "$NDK_DIR/build/tools/make-standalone-toolchain.sh" \
  295. --arch="$ARCH" \
  296. --platform=android-9 \
  297. --install-dir="$NDK_STANDALONE"
  298. fail_panic "Can't generate standalone NDK toolchain installation!"
  299. # Rebuild the client library, processor and tools with the auto-tools based
  300. # build system. Even though it's not going to be used, this checks that this
  301. # still works correctly.
  302. echo "Building full Android binaries with configure/make"
  303. TMPTARGET="$TMPDIR/target-local"
  304. (
  305. PATH="$NDK_STANDALONE/bin:$PATH"
  306. run mkdir "$TMPTARGET" &&
  307. run mkdir "$TMPDIR"/build-target &&
  308. run cd "$TMPDIR"/build-target &&
  309. run2 "$PROGDIR"/../configure --prefix="$TMPTARGET" \
  310. --host="$GNU_CONFIG" &&
  311. run2 make -j$NUM_JOBS install
  312. )
  313. fail_panic "Could not rebuild Android binaries!"
  314. # Build and/or run unit test suite.
  315. # If --no-device is used, only rebuild it, otherwise, run in on the
  316. # connected device.
  317. if [ "$NO_DEVICE" ]; then
  318. ACTION="Building"
  319. # This is a trick to force the Makefile to ignore running the scripts.
  320. TESTS_ENVIRONMENT="TESTS_ENVIRONMENT=true"
  321. else
  322. ACTION="Running"
  323. TESTS_ENVIRONMENT=
  324. fi
  325. (
  326. PATH="$NDK_STANDALONE/bin:$PATH"
  327. run cd "$TMPDIR"/build-target &&
  328. # Reconfigure to only run the client unit test suite.
  329. # This one should _never_ fail.
  330. dump "$ACTION Android client library unit tests."
  331. run2 "$PROGDIR"/../configure --prefix="$TMPTARGET" \
  332. --host="$GNU_CONFIG" \
  333. --disable-tools \
  334. --disable-processor &&
  335. run make -j$NUM_JOBS check $TESTS_ENVIRONMENT || exit $?
  336. if [ "$ALL_TESTS" ]; then
  337. dump "$ACTION Tools and processor unit tests."
  338. # Reconfigure to run the processor and tools tests.
  339. # Most of these fail for now, so do not worry about it.
  340. run2 "$PROGDIR"/../configure --prefix="$TMPTARGET" \
  341. --host="$GNU_CONFIG" &&
  342. run make -j$NUM_JOBS check $TESTS_ENVIRONMENT
  343. if [ $? != 0 ]; then
  344. dump "Tools and processor unit tests failed as expected. \
  345. Use --verbose for results."
  346. fi
  347. fi
  348. )
  349. fail_panic "Client library unit test suite failed!"
  350. # Copy sources to temporary directory
  351. PROJECT_DIR=$TMPDIR/project
  352. dump "Copying test program sources to: $PROJECT_DIR"
  353. run cp -r "$TESTAPP_DIR" "$PROJECT_DIR" &&
  354. run rm -rf "$PROJECT_DIR/obj" &&
  355. run rm -rf "$PROJECT_DIR/libs"
  356. fail_panic "Could not copy test program sources to: $PROJECT_DIR"
  357. # Build the test program with ndk-build.
  358. dump "Building test program with ndk-build"
  359. export NDK_MODULE_PATH="$PROGDIR"
  360. NDK_BUILD_FLAGS="-j$NUM_JOBS"
  361. if verbosity_is_higher_than 1; then
  362. NDK_BUILD_FLAGS="$NDK_BUILD_FLAGS NDK_LOG=1 V=1"
  363. fi
  364. run "$NDK_DIR/ndk-build" -C "$PROJECT_DIR" $NDK_BUILD_FLAGS APP_ABI=$ABI
  365. fail_panic "Can't build test program!"
  366. # Unless --no-device was used, stop right here if ADB isn't in the path,
  367. # or there is no connected device.
  368. if [ "$NO_DEVICE" ]; then
  369. dump "Done. Please connect a device to run all tests!"
  370. clean_exit 0
  371. fi
  372. # Push the program to the device.
  373. TESTAPP=test_google_breakpad
  374. TESTAPP_FILE="$PROJECT_DIR/libs/$ABI/test_google_breakpad"
  375. if [ ! -f "$TESTAPP_FILE" ]; then
  376. panic "Device requires '$ABI' binaries. None found!"
  377. fi
  378. # Run the program there
  379. dump "Installing test program on device"
  380. DEVICE_TMP=/data/local/tmp
  381. adb_push "$TESTAPP_FILE" "$DEVICE_TMP/"
  382. fail_panic "Cannot push test program to device!"
  383. dump "Running test program on device"
  384. adb_shell cd "$DEVICE_TMP" "&&" ./$TESTAPP > "$CRASH_LOG" 2>/dev/null
  385. if [ $? = 0 ]; then
  386. panic "Test program did *not* crash as expected!"
  387. fi
  388. if verbosity_is_higher_than 0; then
  389. echo -n "Crash log: "
  390. cat "$CRASH_LOG"
  391. fi
  392. # Extract minidump from device
  393. MINIDUMP_NAME=$(awk '$1 == "Dump" && $2 == "path:" { print $3; }' "$CRASH_LOG")
  394. MINIDUMP_NAME=$(basename "$MINIDUMP_NAME")
  395. if [ -z "$MINIDUMP_NAME" ]; then
  396. panic "Test program didn't write minidump properly!"
  397. fi
  398. dump "Extracting minidump: $MINIDUMP_NAME"
  399. adb_pull "$DEVICE_TMP/$MINIDUMP_NAME" .
  400. fail_panic "Can't extract minidump!"
  401. dump "Parsing test program symbols"
  402. if verbosity_is_higher_than 1; then
  403. log "COMMAND: $TMPBIN/dump_syms \
  404. $PROJECT_DIR/obj/local/$ABI/$TESTAPP >$TESTAPP.sym"
  405. fi
  406. "$TMPBIN/dump_syms" "$PROJECT_DIR/obj/local/$ABI/$TESTAPP" > $TESTAPP.sym
  407. fail_panic "dump_syms doesn't work!"
  408. VERSION=$(awk '$1 == "MODULE" { print $4; }' $TESTAPP.sym)
  409. dump "Found module version: $VERSION"
  410. if [ -z "$VERSION" ]; then
  411. echo "ERROR: Can't find proper module version from symbol dump!"
  412. head -n5 $TESTAPP.sym
  413. clean_exit 1
  414. fi
  415. run mkdir -p "$TMPDIR/symbols/$TESTAPP/$VERSION"
  416. run mv $TESTAPP.sym "$TMPDIR/symbols/$TESTAPP/$VERSION/"
  417. dump "Generating stack trace"
  418. # Don't use 'run' to be able to send stdout and stderr to two different files.
  419. log "COMMAND: $TMPBIN/minidump_stackwalk $MINIDUMP_NAME symbols"
  420. "$TMPBIN/minidump_stackwalk" $MINIDUMP_NAME \
  421. "$TMPDIR/symbols" \
  422. > "$BUILD_LOG" 2>>"$RUN_LOG"
  423. fail_panic "minidump_stackwalk doesn't work!"
  424. dump "Checking stack trace content"
  425. if verbosity_is_higher_than 1; then
  426. cat "$BUILD_LOG"
  427. fi
  428. # The generated stack trace should look like the following:
  429. #
  430. # Thread 0 (crashed)
  431. # 0 test_google_breakpad!crash [test_breakpad.cpp : 17 + 0x4]
  432. # r4 = 0x00015530 r5 = 0xbea2cbe4 r6 = 0xffffff38 r7 = 0xbea2cb5c
  433. # r8 = 0x00000000 r9 = 0x00000000 r10 = 0x00000000 fp = 0x00000000
  434. # sp = 0xbea2cb50 lr = 0x00009025 pc = 0x00008f84
  435. # Found by: given as instruction pointer in context
  436. # 1 test_google_breakpad!main [test_breakpad.cpp : 25 + 0x3]
  437. # r4 = 0x00015530 r5 = 0xbea2cbe4 r6 = 0xffffff38 r7 = 0xbea2cb5c
  438. # r8 = 0x00000000 r9 = 0x00000000 r10 = 0x00000000 fp = 0x00000000
  439. # sp = 0xbea2cb50 pc = 0x00009025
  440. # Found by: call frame info
  441. # 2 libc.so + 0x164e5
  442. # r4 = 0x00008f64 r5 = 0xbea2cc34 r6 = 0x00000001 r7 = 0xbea2cc3c
  443. # r8 = 0x00000000 r9 = 0x00000000 r10 = 0x00000000 fp = 0x00000000
  444. # sp = 0xbea2cc18 pc = 0x400c34e7
  445. # Found by: call frame info
  446. # ...
  447. #
  448. # The most important part for us is ensuring that the source location could
  449. # be extracted, so look at the 'test_breakpad.cpp' references here.
  450. #
  451. # First, extract all the lines with test_google_breakpad! in them, and
  452. # dump the corresponding crash location.
  453. #
  454. # Note that if the source location can't be extracted, the second field
  455. # will only be 'test_google_breakpad' without the exclamation mark.
  456. #
  457. LOCATIONS=$(awk '$2 ~ "^test_google_breakpad!.*" { print $3; }' "$BUILD_LOG")
  458. if [ -z "$LOCATIONS" ]; then
  459. if verbosity_is_lower_than 1; then
  460. cat "$BUILD_LOG"
  461. fi
  462. panic "No source location found in stack trace!"
  463. fi
  464. # Now check that they all match "[<source file>"
  465. BAD_LOCATIONS=
  466. for LOCATION in $LOCATIONS; do
  467. case $LOCATION in
  468. # Escape the opening bracket, or some shells like Dash will not
  469. # match them properly.
  470. \[*.cpp|\[*.cc|\[*.h) # These are valid source locations in our executable
  471. ;;
  472. *) # Everything else is not!
  473. BAD_LOCATIONS="$BAD_LOCATIONS $LOCATION"
  474. ;;
  475. esac
  476. done
  477. if [ "$BAD_LOCATIONS" ]; then
  478. dump "ERROR: Generated stack trace doesn't contain valid source locations:"
  479. cat "$BUILD_LOG"
  480. echo "Bad locations are: $BAD_LOCATIONS"
  481. exit 1
  482. fi
  483. echo "All clear! Congratulations."