|
7 | 7 | # For the full copyright and license information, please view |
8 | 8 | # the LICENSE file that was distributed with this source code. |
9 | 9 |
|
10 | | -$(phpenv which php) -v |
11 | | -$(phpenv which php) -m |
12 | | - |
13 | | -PROJECT_ROOT=$(readlink -enq "$(dirname $0)/../") |
14 | | -cd ${PROJECT_ROOT} |
| 10 | +# -e Exit immediately if a command exits with a non-zero status. |
| 11 | +# -u Treat unset variables as an error when substituting. |
| 12 | +set -eu |
15 | 13 |
|
16 | 14 | shopt -s nullglob |
17 | 15 |
|
18 | | -for i in `find ./tests -name "*.out" 2>/dev/null`; do |
19 | | - echo "-- START ${i}"; cat ${i}; echo "-- END"; |
20 | | -done |
21 | | - |
22 | | -for i in `find ./tests -name "*.mem" 2>/dev/null`; do |
23 | | - echo "-- START ${i}"; cat ${i}; echo "-- END"; |
24 | | -done |
25 | | - |
26 | | -if [ -f "./configure.log" ]; then |
27 | | - cat "./configure.log" |
28 | | -fi |
29 | | - |
30 | | -ls -al ${PROJECT_ROOT} |
31 | | - |
32 | 16 | export LC_ALL=C |
33 | 17 |
|
34 | | -for i in core core.*; do |
35 | | - if [ -f "$i" -a "$(file "$i" | grep -o 'core file')" ]; then |
36 | | - gdb -q $(file "${i}" | grep -oE "'[^ ']+" | sed "s/^'//g") "$i" <<EOF |
| 18 | +while IFS= read -r -d '' file |
| 19 | +do |
| 20 | + (( count++ )) |
| 21 | + (>&1 printf ">>> START (%d)\\n%s\\n<<< END (%d)\\n\\n" $count "$(cat "$file")" $count) |
| 22 | +done < <(find ./tests -type f \( -name '*.out' -o -name '*.mem' \) -print0) |
| 23 | + |
| 24 | +# for some reason Ubuntu 18.04 on Travis CI doesn't install gdb |
| 25 | +function install_gdb() { |
| 26 | + if [ "${CI}" = "true" ] && [ "$(command -v gdb 2>/dev/null)" = "" ] |
| 27 | + then |
| 28 | + (>&1 echo "Install gdb...") |
| 29 | + sudo apt-get install --no-install-recommends --quiet --assume-yes gdb 1> /dev/null |
| 30 | + fi |
| 31 | +} |
| 32 | + |
| 33 | +for i in /tmp/core.php.*; do |
| 34 | + install_gdb |
| 35 | + (>&1 printf "Found core dump file: %s\\n\\n" "$i") |
| 36 | + gdb -q "$(phpenv which php)" "$i" <<EOF |
37 | 37 | set pagination 0 |
38 | 38 | backtrace full |
39 | 39 | info registers |
40 | 40 | x/16i \$pc |
41 | 41 | thread apply all backtrace |
42 | 42 | quit |
43 | 43 | EOF |
44 | | - fi |
45 | 44 | done |
0 commit comments