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

Commit493aa8d

Browse files
committed
implement several levels in run_tests.sh
1 parente38097a commit493aa8d

File tree

4 files changed

+73
-12
lines changed

4 files changed

+73
-12
lines changed

‎.travis.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ notifications:
1818
on_failure:always
1919

2020
env:
21+
-PG_VERSION=10 LEVEL=hardcore
2122
-PG_VERSION=10
2223
-PG_VERSION=9.6
2324
-PG_VERSION=9.5

‎Dockerfile.tmpl‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
FROM postgres:${PG_VERSION}-alpine
22

33
# Install dependencies
4-
RUN apk add --no-cache clang-analyzer clang perl make musl-dev gcc curl;
4+
RUN apk add --no-cache \
5+
curl git \
6+
make musl-dev gcc bison flex coreutils \
7+
perl perl-utils perl-ipc-run \
8+
zlib-dev libedit-dev \
9+
clang-analyzer valgrind;
510

611
# Environment
712
ENV LANG=C.UTF-8 PGDATA=/pg/data
@@ -23,4 +28,4 @@ ADD . /pg/testdir
2328
WORKDIR /pg/testdir
2429

2530
USER postgres
26-
ENTRYPOINT /run.sh
31+
ENTRYPOINTLEVEL=${LEVEL}/run.sh

‎mk_dockerfile.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
set -eu
2-
sed -e's/${PG_VERSION}/'${PG_VERSION}/g Dockerfile.tmpl> Dockerfile
2+
sed -e's/${PG_VERSION}/'${PG_VERSION}/g-e's/${LEVEL}/'${LEVEL}/gDockerfile.tmpl> Dockerfile

‎run_tests.sh‎

Lines changed: 64 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,85 @@
33
# Copyright (c) 2018, Postgres Professional
44

55

6-
set -ux
6+
# provide a decent default level
7+
if [-z${LEVEL+x} ];then
8+
LEVEL=scan-build
9+
fi
710

11+
set -ux
812

913
status=0
1014

15+
1116
# show pg_config just in case
1217
pg_config
1318

14-
# perform static analyzis
15-
scan-build --status-bugs make USE_PGXS=1|| status=$?
1619

17-
#something's wrong, exit now!
18-
if [$status-ne 0];thenexit 1;fi
20+
#perform code checks if asked to
21+
if ["$LEVEL"="scan-build"];then
1922

20-
# don't forget to "make clean"
21-
make USE_PGXS=1clean
23+
# perform static analyzis
24+
scan-build --status-bugsmake USE_PGXS=1|| status=$?
2225

23-
# initialize database
24-
initdb -D$PGDATA
26+
# something's wrong, exit now!
27+
if [$status-ne 0 ];thenexit 1;fi
28+
29+
# don't forget to "make clean"
30+
make USE_PGXS=1 clean
31+
fi
32+
33+
# build with cassert + valgrind support
34+
if ["$LEVEL"="hardcore" ];then
35+
36+
set -e
37+
38+
CUSTOM_PG_PATH=$PWD/pg_bin
39+
40+
# here PG_VERSION is provided by postgres:X-alpine docker image
41+
wget -O postgresql.tar.bz2"https://ftp.postgresql.org/pub/source/v$PG_VERSION/postgresql-$PG_VERSION.tar.bz2"
42+
echo"$PG_SHA256 *postgresql.tar.bz2"| sha256sum -c -
43+
44+
mkdir postgresql
45+
46+
tar \
47+
--extract \
48+
--file postgresql.tar.bz2 \
49+
--directory postgresql \
50+
--strip-components 1
51+
52+
cd postgresql
53+
54+
# enable Valgrind support
55+
sed -i.bak"s/\/* #define USE_VALGRIND *\//#define USE_VALGRIND/g" src/include/pg_config_manual.h
56+
57+
# enable additional options
58+
eval ./configure \
59+
--with-gnu-ld \
60+
--enable-debug \
61+
--enable-cassert \
62+
--prefix=$CUSTOM_PG_PATH
63+
64+
# TODO: -j$(nproc)
65+
make -s -j1&& make install
66+
67+
# override default PostgreSQL instance
68+
export PATH=$CUSTOM_PG_PATH/bin:$PATH
69+
70+
# show pg_config path (just in case)
71+
which pg_config
72+
73+
cd -
74+
75+
set +e
76+
fi
2577

2678
# build and install extension (using PG_CPPFLAGS and SHLIB_LINK for gcov)
2779
make USE_PGXS=1 PG_CPPFLAGS="-coverage" SHLIB_LINK="-coverage"
2880
make USE_PGXS=1 install
2981

82+
# initialize database
83+
initdb -D$PGDATA
84+
3085
# restart cluster 'test'
3186
echo"port = 55435">>$PGDATA/postgresql.conf
3287
pg_ctl start -l /tmp/postgres.log -w|| status=$?

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp