-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathdocheck
executable file
·56 lines (49 loc) · 1.06 KB
/
docheck
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
set -eu
usage() {
cat << EOF
Usage: ./docheck command [args]
Available commands:
EOF
}
if [[ $# = 0 ]] ; then
usage
exit 1
fi
py3_check () {
local v=$1
docker build -f docker/$v/Dockerfile docker/$v -t pg-test:$v
docker run -v "${PWD}:/source:ro" pg-test:$v /source/docheck test-in-docker 3.5
}
cmd=$1
shift 1
case "${cmd}" in
(py3-11) py3_check py3-11 ;;
(py39-13) py3_check py3-12 ;;
(test-in-docker)
PY_VERSION=$1
cp -r /source /build
cd /build
su postgres -c '/usr/lib/postgresql/*/bin/initdb'
# If jit is enabled, it causes additional output for `explain`
# command, resulting in failed tests.
sed -i -e '/jit =/cjit = false' /var/lib/postgresql/data/postgresql.conf
su postgres -c '/usr/lib/postgresql/*/bin/pg_ctl -D /var/lib/postgresql/data start'
make
make install
make installcheck || /bin/true
if test -f regression.out ; then
cat regression.out
for x in results/*.out ; do
base=$(basename "$x")
echo ">>> $base"
diff -U3 test-${PY_VERSION}/expected/$base $x || /bin/true
done
exit 2
fi
;;
(*)
usage
exit 1
;;
esac