Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd104fd6

Browse files
committed
Add travis tests
1 parent3815bdd commitd104fd6

File tree

4 files changed

+121
-0
lines changed

4 files changed

+121
-0
lines changed

‎.travis.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
os:
2+
-linux
3+
4+
sudo:required
5+
dist:trusty
6+
7+
language:c
8+
9+
services:
10+
-docker
11+
12+
install:
13+
-sed -e 's/${CHECK_CODE}/'${CHECK_CODE}/g -e 's/${PG_VERSION}/'${PG_VERSION}/g Dockerfile.tmpl > Dockerfile
14+
-docker-compose build
15+
16+
script:
17+
-docker-compose run tests
18+
19+
env:
20+
-PG_VERSION=9.6 CHECK_CODE=clang
21+
-PG_VERSION=9.6 CHECK_CODE=cppcheck
22+
-PG_VERSION=9.6 CHECK_CODE=false
23+
-PG_VERSION=10 CHECK_CODE=clang
24+
-PG_VERSION=10 CHECK_CODE=cppcheck
25+
-PG_VERSION=10 CHECK_CODE=false

‎Dockerfile.tmpl

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
FROM ${PG_IMAGE}
2+
3+
ENV LANG=C.UTF-8 PGDATA=/pg/data
4+
5+
RUN if [ "${CHECK_CODE}" = "clang" ] ; then \
6+
echo 'http://dl-3.alpinelinux.org/alpine/edge/main' > /etc/apk/repositories; \
7+
apk --no-cache add clang-analyzer make musl-dev gcc; \
8+
fi
9+
10+
RUN if [ "${CHECK_CODE}" = "cppcheck" ] ; then \
11+
apk --no-cache add cppcheck --repository http://dl-cdn.alpinelinux.org/alpine/v3.6/community; \
12+
fi
13+
14+
RUN if [ "${CHECK_CODE}" = "false" ] ; then \
15+
echo 'http://dl-3.alpinelinux.org/alpine/edge/main' > /etc/apk/repositories; \
16+
apk --no-cache add curl python3 gcc make musl-dev;\
17+
fi
18+
19+
RUN mkdir -p /pg/data && \
20+
mkdir /pg/src && \
21+
chown postgres:postgres ${PGDATA} && \
22+
chmod a+rwx /usr/local/lib/postgresql && \
23+
chmod a+rwx /usr/local/share/postgresql/extension
24+
25+
ADD . /pg/src
26+
WORKDIR /pg/src
27+
RUN chmod -R go+rwX /pg/src
28+
USER postgres
29+
ENTRYPOINT PGDATA=${PGDATA} CHECK_CODE=${CHECK_CODE} bash run_tests.sh

‎cppcheck.log

Whitespace-only changes.

‎run_tests.sh

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#!/bin/bash
2+
3+
# This is a main testing script for:
4+
#* regression tests
5+
#* testgres-based tests
6+
#* cmocka-based tests
7+
# Copyright (c) 2017, Postgres Professional
8+
9+
set -eux
10+
11+
echo CHECK_CODE=$CHECK_CODE
12+
13+
status=0
14+
15+
# perform code analysis if necessary
16+
if ["$CHECK_CODE"="clang" ];then
17+
scan-build --status-bugs make USE_PGXS=1|| status=$?
18+
exit$status
19+
20+
elif ["$CHECK_CODE"="cppcheck" ];then
21+
cppcheck \
22+
--template"{file} ({line}): {severity} ({id}): {message}" \
23+
--enable=warning,portability,performance \
24+
--suppress=redundantAssignment \
25+
--suppress=uselessAssignmentPtrArg \
26+
--suppress=literalWithCharPtrCompare \
27+
--suppress=incorrectStringBooleanError \
28+
--std=c89*.c*.h2> cppcheck.log
29+
30+
if [-s cppcheck.log ];then
31+
cat cppcheck.log
32+
status=1# error
33+
fi
34+
35+
exit$status
36+
fi
37+
38+
# don't forget to "make clean"
39+
make USE_PGXS=1 clean
40+
41+
# initialize database
42+
initdb
43+
44+
# build extension
45+
make USE_PGXS=1 install
46+
47+
# check build
48+
status=$?
49+
if [$status-ne 0 ];thenexit$status;fi
50+
51+
# add pg_pathman to shared_preload_libraries and restart cluster 'test'
52+
echo"shared_preload_libraries = 'pg_wait_sampling'">>$PGDATA/postgresql.conf
53+
echo"port = 55435">>$PGDATA/postgresql.conf
54+
pg_ctl start -l /tmp/postgres.log -w
55+
56+
# check startup
57+
status=$?
58+
if [$status-ne 0 ];then cat /tmp/postgres.log;fi
59+
60+
# run regression tests
61+
export PG_REGRESS_DIFF_OPTS="-w -U3"# for alpine's diff (BusyBox)
62+
PGPORT=55435 make USE_PGXS=1 installcheck|| status=$?
63+
64+
# show diff if it exists
65+
iftest -f regression.diffs;then cat regression.diffs;fi
66+
67+
exit$status

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp