From: Ben Pfaff Date: Mon, 3 Dec 2018 02:36:51 +0000 (-0800) Subject: get-data-psql.at: Make test work with Debian pg_wrapper arrangement. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=769186f0a30bc22fe6da1b2c4418689e43cfe55d;p=pspp get-data-psql.at: Make test work with Debian pg_wrapper arrangement. It had been years since I tested Postgres, but I was making a change that would affect the Postgres test, and I found out that the test didn't work. This fixes it. --- diff --git a/tests/language/data-io/get-data-psql.at b/tests/language/data-io/get-data-psql.at index fc99babf34..3096073b03 100644 --- a/tests/language/data-io/get-data-psql.at +++ b/tests/language/data-io/get-data-psql.at @@ -18,8 +18,6 @@ AT_BANNER([GET DATA /TYPE=PSQL]) m4_define([INIT_PSQL], [AT_SKIP_IF([test "$PSQL_SUPPORT" = no]) - PATH=$PG_PATH:$PATH - export PATH PGDATA=`pwd`/cluster export PGDATA PGPORT=$PG_PORT @@ -27,10 +25,10 @@ m4_define([INIT_PSQL], socket_dir=`mktemp -d` PGHOST="$socket_dir" export PGHOST - AT_CHECK([initdb -A trust], [0], [ignore]) - AT_CHECK([pg_ctl start -w -o "-k $socket_dir -h ''"], [0], [ignore]) + AT_CHECK([PATH=$PG_PATH:$PATH initdb -A trust], [0], [ignore]) + AT_CHECK([PATH=$PG_PATH:$PATH pg_ctl start -w -o "-k $socket_dir -h ''"], [0], [ignore]) trap 'CLEANUP_PSQL' 0 - AT_CHECK([createdb -h "$socket_dir" -p $PG_PORT $PG_DBASE], + AT_CHECK([PATH=$PG_PATH:$PATH createdb -h "$socket_dir" -p $PG_PORT $PG_DBASE], [0], [ignore], [ignore]) AT_DATA([populate.sql], [CREATE TABLE empty (a int, b date, c numeric(23, 4)); @@ -132,10 +130,19 @@ m4_define([INIT_PSQL], '01:05:02 UTC-7' ); ]) + + # On Debian, the psql binary in the postgres bindir won't work because + # it needs libreadline to be LD_PRELOADed into it. The psql in the + # normal $PATH works fine though. + if (PATH=$PG_PATH:$PATH psql -V) >/dev/null 2>&1; then + psql () { + PATH=$PG_PATH:$PATH command psql "$@" + } + fi AT_CHECK([psql -h "$socket_dir" -p $PG_PORT $PG_DBASE < populate.sql], [0], [ignore])]) -m4_define([CLEANUP_PSQL], [pg_ctl stop -W -o "-k $socket_dir -h ''"]) +m4_define([CLEANUP_PSQL], [PATH=$PG_PATH:$PATH pg_ctl stop -W -o "-k $socket_dir -h ''"]) AT_SETUP([GET DATA /TYPE=PSQL]) INIT_PSQL