forked from brusnika-ru/multicorn2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docheck
executable file
·72 lines (64 loc) · 1.61 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
set -eu
usage() {
cat << EOF
Usage: ./docheck command [args]
Available commands:
* py2-9.6: build and test extension in container with postgresql-9.6
* test-in-docker: used internally by other commands
EOF
}
if [[ $# = 0 ]] ; then
usage
exit 1
fi
py2_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 2.7
}
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
(py2-9.6) py2_check py2-9.6 ;;
(py3-9.6) py3_check py3-9.6 ;;
(py2-10) py2_check py2-10 ;;
(py3-10) py3_check py3-10 ;;
(py2-11) py2_check py2-11 ;;
(py3-11) py3_check py3-11 ;;
(py2-12) py2_check py2-12 ;;
(py3-12) py3_check py3-12 ;;
(test-in-docker)
# Actually, we only need only distinguish python-2.7 and python-3.3
# tests.
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