|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +# Copyright (c) 2018, Postgres Professional |
| 4 | + |
| 5 | + |
| 6 | +set -ux |
| 7 | + |
| 8 | + |
| 9 | +status=0 |
| 10 | + |
| 11 | +# perform static analyzis |
| 12 | +scan-build --status-bugs make USE_PGXS=1|| status=$? |
| 13 | + |
| 14 | +# something's wrong, exit now! |
| 15 | +if [$status-ne 0 ];thenexit 1;fi |
| 16 | + |
| 17 | +# don't forget to "make clean" |
| 18 | +make USE_PGXS=1 clean |
| 19 | + |
| 20 | +# initialize database |
| 21 | +initdb -D$PGDATA |
| 22 | + |
| 23 | +# build and install extension (using PG_CPPFLAGS and SHLIB_LINK for gcov) |
| 24 | +make USE_PGXS=1 PG_CPPFLAGS="-coverage" SHLIB_LINK="-coverage" |
| 25 | +make USE_PGXS=1 install |
| 26 | + |
| 27 | +# restart cluster 'test' |
| 28 | +echo"port = 55435">>$PGDATA/postgresql.conf |
| 29 | +pg_ctl start -l /tmp/postgres.log -w|| status=$? |
| 30 | + |
| 31 | +# something's wrong, exit now! |
| 32 | +if [$status-ne 0 ];then cat /tmp/postgres.log;exit 1;fi |
| 33 | + |
| 34 | +# run regression tests |
| 35 | +export PG_REGRESS_DIFF_OPTS="-w -U3"# for alpine's diff (BusyBox) |
| 36 | +PGPORT=55435 make USE_PGXS=1 installcheck|| status=$? |
| 37 | + |
| 38 | +# show diff if it exists |
| 39 | +iftest -f regression.diffs;then cat regression.diffs;fi |
| 40 | + |
| 41 | +# something's wrong, exit now! |
| 42 | +if [$status-ne 0 ];thenexit 1;fi |
| 43 | + |
| 44 | +# generate *.gcov files |
| 45 | +rm -f*serialize.{gcda,gcno} |
| 46 | +gcov*.c*.h |
| 47 | + |
| 48 | + |
| 49 | +set +ux |
| 50 | + |
| 51 | + |
| 52 | +# send coverage stats to Codecov |
| 53 | +bash<(curl -s https://codecov.io/bash) |