run-checks.sh 17 KB

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