Skip to content

Commit 9461c68

Browse files
committed
Improved after_failure script [skip appveyor]
1 parent 40533d1 commit 9461c68

File tree

2 files changed

+25
-23
lines changed

2 files changed

+25
-23
lines changed

.ci/after-failure.sh

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,38 @@
77
# For the full copyright and license information, please view
88
# the LICENSE file that was distributed with this source code.
99

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
1513

1614
shopt -s nullglob
1715

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-
3216
export LC_ALL=C
3317

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
3737
set pagination 0
3838
backtrace full
3939
info registers
4040
x/16i \$pc
4141
thread apply all backtrace
4242
quit
4343
EOF
44-
fi
4544
done

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ cache:
4545
before_install:
4646
- phpenv config-rm xdebug.ini || true
4747
- ulimit -c unlimited -S || true
48+
- echo '/tmp/core.%e.%p.%t' | sudo tee /proc/sys/kernel/core_pattern
4849

4950
install:
5051
- .ci/install-re2c.sh
@@ -74,6 +75,8 @@ script:
7475
- make test NO_INTERACTION=1 REPORT_EXIT_STATUS=1 TEST_PHP_ARGS=-m
7576

7677
after_failure:
78+
- echo "$($(phpenv which php) -v)"
79+
- echo "$($(phpenv which php) -m)"
7780
- .ci/after-failure.sh
7881

7982
after_success:

0 commit comments

Comments
 (0)