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

New Travis CI -based checks (--enable-cassert + Valgrind)#8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
za-arthur merged 9 commits intopostgrespro:masterfromfunbringer:travis_hardcore
Apr 23, 2018
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions.travis.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,6 +18,12 @@ notifications:
on_failure: always

env:
- PG_VERSION=10 LEVEL=nightmare
- PG_VERSION=10 LEVEL=hardcore
- PG_VERSION=10
- PG_VERSION=9.6
- PG_VERSION=9.5

matrix:
allow_failures:
- env: PG_VERSION=10 LEVEL=nightmare
14 changes: 12 additions & 2 deletionsDockerfile.tmpl
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
FROM postgres:${PG_VERSION}-alpine

# Install dependencies
RUN apk add --no-cache clang-analyzer clang perl make musl-dev gcc curl;
RUN apk add --no-cache \
openssl curl \
perl perl-ipc-run \
make musl-dev gcc bison flex coreutils \
zlib-dev libedit-dev \
clang clang-analyzer;

# Install fresh valgrind
RUN apk add valgrind \
--update-cache \
--repository http://dl-3.alpinelinux.org/alpine/edge/main;

# Environment
ENV LANG=C.UTF-8 PGDATA=/pg/data
Expand All@@ -23,4 +33,4 @@ ADD . /pg/testdir
WORKDIR /pg/testdir

USER postgres
ENTRYPOINT /run.sh
ENTRYPOINTLEVEL=${LEVEL}/run.sh
18 changes: 16 additions & 2 deletionsmk_dockerfile.sh
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,16 @@
set -eu
sed -e 's/${PG_VERSION}/'${PG_VERSION}/g Dockerfile.tmpl > Dockerfile
if [ -z ${PG_VERSION+x} ]; then
echo PG_VERSION is not set!
exit 1
fi

if [ -z ${LEVEL+x} ]; then
LEVEL=scan-build
fi

echo PG_VERSION=${PG_VERSION}
echo LEVEL=${LEVEL}

sed \
-e 's/${PG_VERSION}/'${PG_VERSION}/g \
-e 's/${LEVEL}/'${LEVEL}/g \
Dockerfile.tmpl > Dockerfile
118 changes: 103 additions & 15 deletionsrun_tests.sh
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,131 @@
#!/usr/bin/env bash

#
# Copyright (c) 2018, Postgres Professional

#
# supported levels:
#* standard
#* scan-build
#* hardcore
#* nightmare
#

set -ux
status=0


status=0
# rebuild PostgreSQL with cassert + valgrind support
if [ "$LEVEL" = "hardcore" ] || \
[ "$LEVEL" = "nightmare" ]; then

set -e

CUSTOM_PG_BIN=$PWD/pg_bin
CUSTOM_PG_SRC=$PWD/postgresql

# here PG_VERSION is provided by postgres:X-alpine docker image
curl "https://ftp.postgresql.org/pub/source/v$PG_VERSION/postgresql-$PG_VERSION.tar.bz2" -o postgresql.tar.bz2
echo "$PG_SHA256 *postgresql.tar.bz2" | sha256sum -c -

mkdir $CUSTOM_PG_SRC

tar \
--extract \
--file postgresql.tar.bz2 \
--directory $CUSTOM_PG_SRC \
--strip-components 1

cd $CUSTOM_PG_SRC

# enable Valgrind support
sed -i.bak "s/\/* #define USE_VALGRIND *\//#define USE_VALGRIND/g" src/include/pg_config_manual.h

# enable additional options
./configure \
CFLAGS='-O0 -ggdb3 -fno-omit-frame-pointer' \
--enable-cassert \
--prefix=$CUSTOM_PG_BIN \
--quiet

time make -s -j$(nproc) && make -s install

# override default PostgreSQL instance
export PATH=$CUSTOM_PG_BIN/bin:$PATH
export LD_LIBRARY_PATH=$CUSTOM_PG_BIN/lib

# show pg_config path (just in case)
which pg_config

cd -

set +e
fi

# show pg_config just in case
pg_config

# perform static analyzis
scan-build --status-bugs make USE_PGXS=1 || status=$?
# perform code checks if asked to
if [ "$LEVEL" = "scan-build" ] || \
[ "$LEVEL" = "hardcore" ] || \
[ "$LEVEL" = "nightmare" ]; then

# something's wrong, exit now!
if [ $status -ne 0 ]; then exit 1; fi
# perform static analyzis
scan-build --status-bugs make USE_PGXS=1 || status=$?

# don't forget to "make clean"
make USE_PGXS=1 clean
# something's wrong, exit now!
if [ $status -ne 0 ]; then exit 1; fi

# don't forget to "make clean"
make USE_PGXS=1 clean
fi


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

# initialize database
initdb -D $PGDATA

#build and install extension (using PG_CPPFLAGS and SHLIB_LINK for gcov)
make USE_PGXS=1 PG_CPPFLAGS="-coverage" SHLIB_LINK="-coverage"
make USE_PGXS=1 install
#set appropriate port
export PGPORT=55435
echo "port = $PGPORT" >> $PGDATA/postgresql.conf

# restart cluster 'test'
echo "port = 55435" >> $PGDATA/postgresql.conf
pg_ctl start -l /tmp/postgres.log -w || status=$?
if [ "$LEVEL" = "nightmare" ]; then
ls $CUSTOM_PG_BIN/bin

valgrind \
--tool=memcheck \
--leak-check=no \
--time-stamp=yes \
--track-origins=yes \
--trace-children=yes \
--gen-suppressions=all \
--suppressions=$CUSTOM_PG_SRC/src/tools/valgrind.supp \
--suppressions=$PWD/valgrind.supp \
--log-file=/tmp/valgrind-%p.log \
pg_ctl start -l /tmp/postgres.log -w || status=$?
else
pg_ctl start -l /tmp/postgres.log -w || status=$?
fi

# something's wrong, exit now!
if [ $status -ne 0 ]; then cat /tmp/postgres.log; exit 1; fi

# run regression tests
export PG_REGRESS_DIFF_OPTS="-w -U3" # for alpine's diff (BusyBox)
PGPORT=55435 make USE_PGXS=1 installcheck || status=$?
make USE_PGXS=1 installcheck || status=$?

# show Valgrind logs if necessary
if [ "$LEVEL" = "nightmare" ]; then
for f in $(find /tmp -name valgrind-*.log); do
if grep -q 'Command: [^ ]*/postgres' $f && grep -q 'ERROR SUMMARY: [1-9]' $f; then
echo "========= Contents of $f"
cat $f
status=1
fi
done
fi

# show diff if it exists
if test -f regression.diffs; then cat regression.diffs; fi
Expand All@@ -45,7 +134,6 @@ if test -f regression.diffs; then cat regression.diffs; fi
if [ $status -ne 0 ]; then exit 1; fi

# generate *.gcov files
rm -f *serialize.{gcda,gcno}
gcov *.c *.h


Expand Down
Empty file addedvalgrind.supp
View file
Open in desktop
Empty file.

[8]ページ先頭

©2009-2025 Movatter.jp