6868CLUSTER_PATH=$( pwd) /test_cluster
6969$initdb_path -D$CLUSTER_PATH -U$USER -A trust
7070
71+ # enable core dumps and specify their path
72+ ulimit -c unlimited -S
73+ echo ' /tmp/%e-%s-%p.core' | sudo tee /proc/sys/kernel/core_pattern
74+
7175# build jsquery (using CFLAGS_SL for gcov)
7276make USE_PGXS=1 PG_CONFIG=$config_path CFLAGS_SL=" $( $config_path --cflags_sl) -coverage"
7377sudo make install USE_PGXS=1 PG_CONFIG=$config_path
@@ -89,6 +93,13 @@ PGPORT=55435 PGUSER=$USER PG_CONFIG=$config_path make installcheck USE_PGXS=1 ||
8993# show diff if it exists
9094if test -f regression.diffs; then cat regression.diffs; fi
9195
96+ # check core dumps if any
97+ for corefile in $( find /tmp/ -name' *.core' 2> /dev/null) ; do
98+ binary=$( gdb -quiet -core$corefile -batch -ex' info auxv' | grep AT_EXECFN| perl -pe" s/^.*\" (.*)\"\$ /\$ 1/g" )
99+ echo dumping$corefile for $binary
100+ gdb --batch --quiet -ex" thread apply all bt full" -ex" quit" $binary $corefile
101+ done
102+
92103# generate *.gcov files
93104gcov* .c* .h
94105