summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2015-01-22 12:24:00 +0100
committerKonstantin Käfer <mail@kkaefer.com>2015-02-04 10:49:06 +0100
commitaa09aa321b24981bf0f8f2dec97ac100727266a5 (patch)
tree9291597f54e8d86357a285f9ffd426ff435f9387 /scripts
parent8a1fce547e9ad0bf750418c844c9b23a3ee6d8dd (diff)
downloadqtlocation-mapboxgl-aa09aa321b24981bf0f8f2dec97ac100727266a5.tar.gz
rearrange tests and make more robust
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/run_tests.sh60
1 files changed, 30 insertions, 30 deletions
diff --git a/scripts/run_tests.sh b/scripts/run_tests.sh
index c5eb4e0ec2..f0582ebed7 100755
--- a/scripts/run_tests.sh
+++ b/scripts/run_tests.sh
@@ -3,34 +3,34 @@
set -e
set -o pipefail
-for TEST in build/${BUILDTYPE:-Release}/test* ; do
- # allow writing core files
- ulimit -c unlimited -S
- echo 'ulimit -c: '`ulimit -c`
- if [ -f /proc/sys/kernel/core_pattern ]; then
- echo '/proc/sys/kernel/core_pattern: '`cat /proc/sys/kernel/core_pattern`
- fi
-
- if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then
- sysctl kernel.core_pattern
- fi
-
- RESULT=0
- ${TEST} || RESULT=$?
-
- if [[ ${RESULT} != 0 ]]; then
- echo "The program crashed with exit code ${RESULT}. We're now trying to output the core dump."
- fi
-
- # output core dump if we got one
- for DUMP in $(find ./ -maxdepth 1 -name 'core*' -print); do
- gdb ${TEST} ${DUMP} -ex "thread apply all bt" -ex "set pagination 0" -batch
- rm -rf ${DUMP}
- done
-
- # now we should present travis with the original
- # error code so the run cleanly stops
- if [[ ${RESULT} != 0 ]]; then
- exit $RESULT
- fi
+CMD="build/${BUILDTYPE:-Release}/test"
+
+# allow writing core files
+ulimit -c unlimited -S
+echo 'ulimit -c: '`ulimit -c`
+if [ -f /proc/sys/kernel/core_pattern ]; then
+ echo '/proc/sys/kernel/core_pattern: '`cat /proc/sys/kernel/core_pattern`
+fi
+
+if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then
+ sysctl kernel.core_pattern
+fi
+
+RESULT=0
+${CMD} "$@" || RESULT=$?
+
+if [[ ${RESULT} != 0 ]]; then
+ echo "The program crashed with exit code ${RESULT}. We're now trying to output the core dump."
+fi
+
+# output core dump if we got one
+for DUMP in $(find ./ -maxdepth 1 -name 'core*' -print); do
+ gdb ${CMD} ${DUMP} -ex "thread apply all bt" -ex "set pagination 0" -batch
+ rm -rf ${DUMP}
done
+
+# now we should present travis with the original
+# error code so the run cleanly stops
+if [[ ${RESULT} != 0 ]]; then
+ exit $RESULT
+fi