forked from springmeyer/travis-coredump
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
40 lines (34 loc) · 1.41 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
language: cpp
env:
matrix:
- CRASH_PLEASE=boooooooom
- HAPPY_NO_CRASH=all-good
compiler:
# gcc compiler, clang would be fine too
- gcc
before_install:
# install the gnu debugger for later use in reading the core file
- sudo apt-get -y install gdb
install:
# What is the current file size max for core files?
# It is usually 0, which means no core file will be dumped if there is a crash
- ulimit -c
before_script:
# Set the core file limit to unlimited so a core file is generated upon crash
- ulimit -c unlimited -S
script:
- RESULT=0
# Compile our demo program which will crash if
# the CRASH_PLEASE environment variable is set (to anything)
- make
# Run the program to prompt a crash
# Note: we capture the return code of the program here and add
# `|| true` to ensure that travis continues past the crash
- RESULT=$(./test > /dev/null)$? || true
- if [[ ${RESULT} == 0 ]]; then echo "\\o/ our test worked without problems"; else echo "ruhroh test returned an errorcode of $RESULT"; fi;
# If the program returned an error code, now we check for a
# core file in the current working directory and dump the backtrace out
- for i in $(find ./ -maxdepth 1 -name 'core*' -print); do gdb $(pwd)/test core* -ex "thread apply all bt" -ex "set pagination 0" -batch; done;
# now we should present travis with the original
# error code so the run cleanly stops
- if [[ ${RESULT} != 0 ]]; then exit $RESULT ; fi;