summaryrefslogtreecommitdiff
path: root/scripts/run_tests.sh
blob: a4af39d5a9aea114b50b6ed90eaba7c9dfebdb1c (plain)
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
#!/usr/bin/env bash

set -e
set -o pipefail

if [ `uname -s` = 'Darwin' ]; then HOST=${HOST:-osx} ; else HOST=${HOST:-linux} ; fi

CMD=$@
shift

# 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

# install test server dependencies
if [ ! -d "test/node_modules/express" ]; then
    (cd test; npm install express@4.11.1)
fi

if command -v gdb >/dev/null 2>&1; then
    gdb -batch -return-child-result -ex 'set print thread-events off' \
        -ex 'run' -ex 'thread apply all bt' --args ${CMD} ;
else
    ${CMD} ;
fi