| 1 | #!/bin/sh |
| 2 | |
| 3 | set -eux |
| 4 | |
| 5 | SOURCE=$(dpkg-parsechangelog -SSource) |
| 6 | MAJOR=${SOURCE#*-} |
| 7 | top_srcdir=$PWD |
| 8 | |
| 9 | cd src/test/regress |
| 10 | |
| 11 | # compile regress.so |
| 12 | make -f $top_srcdir/debian/tests/Makefile.regress PG_CONFIG=/usr/lib/postgresql/$MAJOR/bin/pg_config with_llvm=no |
| 13 | |
| 14 | # tell regression files that regress.so is not installed |
| 15 | sed -i -e "s;set regresslib :libdir;set regresslib '$PWD';" sql/* expected/* |
| 16 | |
| 17 | # when root, execute testsuite as user postgres since it insists on wiping the tablespace directory |
| 18 | if [ $(id -u) = 0 ]; then |
| 19 | SU="su postgres" |
| 20 | else |
| 21 | SU="sh" |
| 22 | fi |
| 23 | |
| 24 | $SU <<EOF |
| 25 | set -eux |
| 26 | |
| 27 | # create tablespace and results directories |
| 28 | OUTPUT=\$(mktemp -d /tmp/regress.XXXXXX) |
| 29 | trap "rm -rf \$OUTPUT" EXIT |
| 30 | |
| 31 | # run the regression tests |
| 32 | if ! pg_virtualenv -v $MAJOR \ |
| 33 | /usr/lib/postgresql/$MAJOR/lib/pgxs/src/test/regress/pg_regress \ |
| 34 | --schedule=parallel_schedule \ |
| 35 | --outputdir=\$OUTPUT \ |
| 36 | --temp-config=/usr/share/postgresql-common/server/test-with-jit.conf |
| 37 | then |
| 38 | head -100 \$OUTPUT/regression.diffs |
| 39 | exit 1 |
| 40 | fi |
| 41 | EOF |