-
Notifications
You must be signed in to change notification settings - Fork 5
/
run_tests.sh
executable file
·70 lines (52 loc) · 1.56 KB
/
run_tests.sh
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
#!/bin/bash
# This is a main testing script for:
# * regression tests
# Copyright (c) 2018, Postgres Professional
set -eux
echo CHECK_CODE=$CHECK_CODE
status=0
# perform code analysis if necessary
if [ "$CHECK_CODE" = "clang" ]; then
scan-build --status-bugs make USE_PGXS=1 || status=$?
exit $status
elif [ "$CHECK_CODE" = "cppcheck" ]; then
cppcheck \
--template "{file} ({line}): {severity} ({id}): {message}" \
--enable=warning,portability,performance \
--suppress=redundantAssignment \
--suppress=uselessAssignmentPtrArg \
--suppress=literalWithCharPtrCompare \
--suppress=incorrectStringBooleanError \
--std=c99 src/*.c src/*.h 2> cppcheck.log
if [ -s cppcheck.log ]; then
cat cppcheck.log
status=1 # error
fi
exit $status
fi
# don't forget to "make clean"
make USE_PGXS=1 clean
# initialize database
initdb
# build extension
make USE_PGXS=1 install
# build rum
git clone https://github.com/postgrespro/rum.git
pushd rum
printf 'installincludes:\n\techo "includes are skipped"' >> Makefile
make USE_PGXS=1 install
popd
# check build
status=$?
if [ $status -ne 0 ]; then exit $status; fi
echo "port = 55435" >> $PGDATA/postgresql.conf
pg_ctl start -l /tmp/postgres.log -w
# check startup
status=$?
if [ $status -ne 0 ]; then cat /tmp/postgres.log; fi
# run regression tests
export PG_REGRESS_DIFF_OPTS="-w -U3" # for alpine's diff (BusyBox)
PGPORT=55435 make USE_PGXS=1 installcheck || status=$?
# show diff if it exists
if test -f regression.diffs; then cat regression.diffs; fi
exit $status