#!/bin/sh

set -eux

# tests fail in C.UTF-8
export LC_COLLATE=C

if [ $(id -un) = root ]; then
    chmod -R go+rwX regress
    exec su -c debian/tests/installcheck postgres
fi

if ! make installcheck PG_CONFIG=/usr/lib/postgresql/12/bin/pg_config; then
    head -n 10000 regress/regression.diffs regress/log/*.log
    exit 1
fi
