test.sh (813B)
1 #!/bin/bash 2 set -evu 3 4 ./bootstrap 5 ./configure CFLAGS="-ggdb -O0" \ 6 --enable-logging=verbose \ 7 --disable-doc 8 make 9 make install 10 11 PG_BIN="$(pg_config --bindir)" 12 PG_ETC="$(pg_config --sharedir | sed 's|/share/postgresql|/etc/postgresql|") 13 sudo -u postgres "${PG_BIN}/postgres" -D ${PG_ETC}/main -h localhost -p 5432 & 14 15 sleep 10 16 sudo -u postgres createuser -p 5432 root 17 sudo -u postgres createdb -p 5432 -O root donaucheck 18 19 check_command() 20 { 21 # Set LD_LIBRARY_PATH so tests can find the installed libs 22 LD_LIBRARY_PATH=/usr/local/lib PGPORT=5432 make check 23 } 24 25 print_logs() 26 { 27 for i in src/*/test-suite.log 28 do 29 for FAILURE in $(grep '^FAIL:' ${i} | cut -d' ' -f2) 30 do 31 echo "Printing ${FAILURE}.log" 32 tail "$(dirname $i)/${FAILURE}.log" 33 done 34 done 35 } 36 37 if ! check_command ; then 38 print_logs 39 exit 1 40 fi