Skip to content

Commit 30c5c39

Browse files
committed
Refactor so tests verify stdout against the same file
1 parent 1a4c424 commit 30c5c39

File tree

7 files changed

+29
-94
lines changed

7 files changed

+29
-94
lines changed

test/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ test:
1717
.PHONY: clean
1818
clean:
1919
rm -f *_stderr.out
20-
rm -f *_actual.txt
20+
rm -f 1.out
21+
rm -f stdout.actual
2122
rm -f *startup.log
2223
rm -f *_tmp.txt

test/README

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
Run a set of shmig commands against each backend.
22

3+
Starts up MySQL and PostgreSql databases in a Docker container.
4+
35
Requires:
46

5-
1. mysql client installed and on PATH
7+
1. sqlite3 is installed
8+
9+
2. mysql client installed and on PATH
610

7-
2. psql client installed and on PATH
11+
3. psql client installed and on PATH
812

9-
3. docker running
13+
4. Docker running
1014

1115
Sample output:
1216

test/mysql_expected.txt

Lines changed: 0 additions & 31 deletions
This file was deleted.

test/report.sh

Lines changed: 0 additions & 23 deletions
This file was deleted.

test/runsuite.sh

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#! /bin/sh
22
# Run shmig tests against a database server.
33

4-
source report.sh
54

65
[ "x$1" = "x" ] && printf "usage: %s <testsuite>\n" $(basename $0) >&2 && exit 1
76

@@ -117,10 +116,9 @@ esac
117116
#
118117
#-----------------------------------------------------------------------------
119118

120-
report_start $DB
121-
122-
F=$(report_filename $DB)
119+
printf "%-10s .......... " $DB
123120

121+
F=1.out
124122
rm -f $F
125123
rm -f *_stderr.out
126124

@@ -160,5 +158,22 @@ case $DB in
160158
esac
161159

162160

161+
#
162+
# Replace time stamps with the string "*now*" and change tabs to '|'
163+
# in MySQL output.
164+
#
165+
166+
sed 's/20..-[012].-[0123]. ..:..:..\(\.[0-9]*\)*/*now*/' $F | sed 's/ /|/g' > stdout.actual
167+
168+
169+
#
170+
# Use diff to get test result.
171+
#
163172

164-
report_result $DB
173+
if diff -uw stdout.expected stdout.actual >/dev/null
174+
then
175+
printf "PASS\n" $1
176+
else
177+
printf "FAIL (diff below)\n" $1
178+
diff -uw stdout.expected stdout.actual
179+
fi

test/sqlite3_expected.txt

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)