mirror of
https://github.com/dimitri/pgloader.git
synced 2025-08-10 08:17:00 +02:00
Turns out that debian has mawk by default, which is not behaving the same in our very simple use case already. In passing, add gawk as a build dependency of the debian package, because the packaging is meant to exercize the test cases.
20 lines
570 B
Bash
Executable File
20 lines
570 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
|
|
|
|
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
|