pgloader/test/regress.sh
Dimitri Fontaine e054eb3838 Travis: set PGTZ in regress.sh
The TimeZone parameter should be set both for input and for output in
order to match our expected result file. Let's try to set PGTZ in the
shell environment...
2015-09-07 20:24:00 +02:00

26 lines
711 B
Bash
Executable File

#! /bin/bash
# regress test driver
# - run pgloader on the given .load command file
# - parse the PostgreSQL connection string and target table
# - output a CSV for the target table
# - diff the CSV and error if diffs found
set -x
# run the tests in the Europe/Paris TimeZone
# see csv-parse-date.load for an example where that matters
export PGTZ='Europe/Paris'
pgloader=$1
command=$2
targetdb=`gawk -F '[ ?]+' '/^ *INTO|into/ {print $3}' < $command`
table=`gawk -F '[ ?]+' '/^ *INTO|into/ {print $4}' < $command`
expected=regress/expected/`basename $2 .load`.out
out=regress/out/`basename $2 .load`.out
$pgloader $command
psql -c "copy $table to stdout" -d "$targetdb" > $out
diff -c $expected $out