Skip to content

Commit b5d2c58

Browse files
authored
Travis fixes (fix test_ptrack_vacuum_full test) (#14)
* [travis] fix test_ptrack_vacuum_full Remove unused PG_VERSION (PG_MAJOR) variable Reworking working directories (helps to run tap test) Remove unused amcheck install
1 parent 437a469 commit b5d2c58

File tree

6 files changed

+89
-101
lines changed

6 files changed

+89
-101
lines changed

.travis.yml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,26 @@ notifications:
2121

2222
# keep in sync with codecov.yml number of builds
2323
env:
24-
- PG_VERSION=15 PG_BRANCH=master TEST_CASE=tap
25-
- PG_VERSION=15 PG_BRANCH=master TEST_CASE=tap MODE=legacy
26-
- PG_VERSION=15 PG_BRANCH=master TEST_CASE=all
27-
- PG_VERSION=15 PG_BRANCH=master TEST_CASE=all MODE=paranoia
28-
- PG_VERSION=14 PG_BRANCH=REL_14_STABLE TEST_CASE=tap
29-
- PG_VERSION=14 PG_BRANCH=REL_14_STABLE TEST_CASE=tap MODE=legacy
30-
- PG_VERSION=14 PG_BRANCH=REL_14_STABLE TEST_CASE=all
31-
- PG_VERSION=14 PG_BRANCH=REL_14_STABLE TEST_CASE=all MODE=paranoia
32-
- PG_VERSION=13 PG_BRANCH=REL_13_STABLE TEST_CASE=tap
33-
- PG_VERSION=13 PG_BRANCH=REL_13_STABLE TEST_CASE=tap MODE=legacy
34-
- PG_VERSION=13 PG_BRANCH=REL_13_STABLE TEST_CASE=all
35-
- PG_VERSION=13 PG_BRANCH=REL_13_STABLE TEST_CASE=all MODE=paranoia
36-
- PG_VERSION=12 PG_BRANCH=REL_12_STABLE TEST_CASE=tap
37-
- PG_VERSION=12 PG_BRANCH=REL_12_STABLE TEST_CASE=tap MODE=legacy
38-
- PG_VERSION=12 PG_BRANCH=REL_12_STABLE TEST_CASE=all
39-
- PG_VERSION=12 PG_BRANCH=REL_12_STABLE TEST_CASE=all MODE=paranoia
40-
- PG_VERSION=11 PG_BRANCH=REL_11_STABLE TEST_CASE=tap
41-
- PG_VERSION=11 PG_BRANCH=REL_11_STABLE TEST_CASE=tap MODE=legacy
42-
- PG_VERSION=11 PG_BRANCH=REL_11_STABLE TEST_CASE=all
43-
- PG_VERSION=11 PG_BRANCH=REL_11_STABLE TEST_CASE=all MODE=paranoia
24+
- PG_BRANCH=master TEST_CASE=tap
25+
- PG_BRANCH=master TEST_CASE=tap MODE=legacy
26+
# - PG_BRANCH=master TEST_CASE=all
27+
- PG_BRANCH=master TEST_CASE=all MODE=paranoia
28+
- PG_BRANCH=REL_14_STABLE TEST_CASE=tap
29+
- PG_BRANCH=REL_14_STABLE TEST_CASE=tap MODE=legacy
30+
# - PG_BRANCH=REL_14_STABLE TEST_CASE=all
31+
- PG_BRANCH=REL_14_STABLE TEST_CASE=all MODE=paranoia
32+
- PG_BRANCH=REL_13_STABLE TEST_CASE=tap
33+
- PG_BRANCH=REL_13_STABLE TEST_CASE=tap MODE=legacy
34+
# - PG_BRANCH=REL_13_STABLE TEST_CASE=all
35+
- PG_BRANCH=REL_13_STABLE TEST_CASE=all MODE=paranoia
36+
- PG_BRANCH=REL_12_STABLE TEST_CASE=tap
37+
- PG_BRANCH=REL_12_STABLE TEST_CASE=tap MODE=legacy
38+
# - PG_BRANCH=REL_12_STABLE TEST_CASE=all
39+
- PG_BRANCH=REL_12_STABLE TEST_CASE=all MODE=paranoia
40+
- PG_BRANCH=REL_11_STABLE TEST_CASE=tap
41+
- PG_BRANCH=REL_11_STABLE TEST_CASE=tap MODE=legacy
42+
# - PG_BRANCH=REL_11_STABLE TEST_CASE=all
43+
- PG_BRANCH=REL_11_STABLE TEST_CASE=all MODE=paranoia
4444

4545
jobs:
4646
allow_failures:

Dockerfile.in

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@ RUN apt-get update
55
RUN apt-get -yq install python python-pip python-virtualenv
66

77
# Environment
8-
ENV PG_MAJOR=${PG_VERSION} PG_BRANCH=${PG_BRANCH}
9-
ENV LANG=C.UTF-8 PGHOME=/pg/testdir/pgbin
8+
ENV PG_BRANCH=${PG_BRANCH}
9+
ENV LANG=C.UTF-8 PGHOME=/testdir/pgbin
1010
ENV MODE=${MODE} TEST_CASE=${TEST_CASE} TEST_REPEATS=${TEST_REPEATS}
1111

1212
# Make directories
13-
RUN mkdir -p /pg/testdir
13+
RUN mkdir -p /testdir
1414

1515
COPY run_tests.sh /run.sh
1616
RUN chmod 755 /run.sh
1717

18-
COPY . /pg/testdir
19-
WORKDIR /pg/testdir
18+
COPY . /testdir/ptrack
19+
WORKDIR /testdir
2020

2121
# Grant privileges
22-
RUN chown -R postgres:postgres /pg/testdir
22+
RUN chown -R postgres:postgres /testdir
2323

2424
USER postgres
2525
ENTRYPOINT /run.sh

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ Feel free to [send pull requests](https://github.com/postgrespro/ptrack/compare)
151151
Everything is tested automatically with [travis-ci.com](https://travis-ci.com/postgrespro/ptrack) and [codecov.io](https://codecov.io/gh/postgrespro/ptrack), but you can also run tests locally via `Docker`:
152152

153153
```sh
154-
export PG_VERSION=14
155154
export PG_BRANCH=REL_14_STABLE
156155
export TEST_CASE=all
157156
export MODE=paranoia

docker-compose.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1-
tests:
2-
privileged: true
3-
build: .
1+
version: "3.7"
2+
services:
3+
tests:
4+
build:
5+
context: .
6+
7+
cap_add:
8+
- SYS_PTRACE
9+
10+
security_opt:
11+
- seccomp=unconfined
12+
13+
# don't work
14+
#sysctls:
15+
# kernel.yama.ptrace_scope: 0
16+
privileged: true
17+

make_dockerfile.sh

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
#!/usr/bin/env sh
22

3-
if [ -z ${PG_VERSION+x} ]; then
4-
echo PG_VERSION is not set!
5-
exit 1
6-
fi
7-
83
if [ -z ${PG_BRANCH+x} ]; then
94
echo PG_BRANCH is not set!
105
exit 1
@@ -28,11 +23,9 @@ else
2823
echo TEST_REPEATS=${TEST_REPEATS}
2924
fi
3025

31-
echo PG_VERSION=${PG_VERSION}
3226
echo PG_BRANCH=${PG_BRANCH}
3327

3428
sed \
35-
-e 's/${PG_VERSION}/'${PG_VERSION}/g \
3629
-e 's/${PG_BRANCH}/'${PG_BRANCH}/g \
3730
-e 's/${MODE}/'${MODE}/g \
3831
-e 's/${TEST_CASE}/'${TEST_CASE}/g \

run_tests.sh

Lines changed: 46 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,47 @@
11
#!/usr/bin/env bash
22

33
#
4-
# Copyright (c) 2019-2020, Postgres Professional
4+
# Copyright (c) 2019-2021, Postgres Professional
55
#
66

7-
PG_SRC=$PWD/postgres
7+
PTRACK_SRC=${PWD}/ptrack
8+
PG_SRC=${PWD}/postgres
9+
PBK_SRC=${PWD}/pg_probackup
810
status=0
911

10-
# curl "https://ftp.postgresql.org/pub/source/v$PG_VERSION/postgresql-$PG_VERSION.tar.bz2" -o postgresql.tar.bz2
11-
# echo "$PG_SHA256 *postgresql.tar.bz2" | sha256sum -c -
12-
13-
# mkdir $PG_SRC
14-
15-
# tar \
16-
# --extract \
17-
# --file postgresql.tar.bz2 \
18-
# --directory $PG_SRC \
19-
# --strip-components 1
20-
12+
#########################################################
2113
# Clone Postgres
2214
echo "############### Getting Postgres sources"
23-
git clone https://github.com/postgres/postgres.git -b $PG_BRANCH --depth=1
15+
git clone https://github.com/postgres/postgres.git --depth=1 --branch=${PG_BRANCH} ${PG_SRC}
2416

2517
# Clone pg_probackup
2618
echo "############### Getting pg_probackup sources"
27-
git clone https://github.com/postgrespro/pg_probackup.git --depth=1 -b master
28-
# git clone https://github.com/ololobus/pg_probackup.git --depth=1 -b ptrack-tests
19+
git clone https://github.com/postgrespro/pg_probackup.git --depth=1 --branch=master ${PBK_SRC}
2920

21+
#########################################################
3022
# Compile and install Postgres
31-
cd postgres # Go to postgres dir
23+
cd ${PG_SRC} # Go to postgres dir
3224

3325
echo "############### Applying ptrack patch"
34-
git apply -v -3 ../patches/$PG_BRANCH-ptrack-core.diff
26+
git apply --verbose --3way ${PTRACK_SRC}/patches/${PG_BRANCH}-ptrack-core.diff
3527

36-
if [ "$MODE" = "paranoia" ]; then
28+
if [ "${MODE}" = "paranoia" ]; then
3729
echo "############### Paranoia mode: applying turn-off-hint-bits.diff"
38-
git apply -v -3 ../patches/turn-off-hint-bits.diff
30+
git apply --verbose --3way ${PTRACK_SRC}/patches/turn-off-hint-bits.diff
3931
fi
4032

4133
echo "############### Compiling Postgres"
42-
if [ "$TEST_CASE" = "tap" ] && [ "$MODE" = "legacy" ]; then
43-
./configure CFLAGS='-DEXEC_BACKEND' --disable-atomics --prefix=$PGHOME --enable-debug --enable-cassert --enable-depend --enable-tap-tests
34+
if [ "${TEST_CASE}" = "tap" ] && [ "${MODE}" = "legacy" ]; then
35+
./configure CFLAGS='-DEXEC_BACKEND' --disable-atomics --prefix=${PGHOME} --enable-debug --enable-cassert --enable-depend --enable-tap-tests --quiet
4436
else
45-
./configure --prefix=$PGHOME --enable-debug --enable-cassert --enable-depend --enable-tap-tests
37+
./configure --prefix=${PGHOME} --enable-debug --enable-cassert --enable-depend --enable-tap-tests --quiet
4638
fi
47-
make -s -j$(nproc) install
48-
make -s -j$(nproc) -C contrib/ install
39+
make --quiet --jobs=$(nproc) install
40+
make --quiet --jobs=$(nproc) --directory=contrib/ install
4941

5042
# Override default Postgres instance
51-
export PATH=$PGHOME/bin:$PATH
52-
export LD_LIBRARY_PATH=$PGHOME/lib
43+
export PATH=${PGHOME}/bin:${PATH}
44+
export LD_LIBRARY_PATH=${PGHOME}/lib
5345
export PG_CONFIG=$(which pg_config)
5446

5547
# Show pg_config path (just in case)
@@ -60,48 +52,37 @@ which pg_config
6052
echo "############### pg_config"
6153
pg_config
6254

63-
# Get amcheck if missing
64-
if [ ! -d "contrib/amcheck" ]; then
65-
echo "############### Getting missing amcheck"
66-
git clone https://github.com/petergeoghegan/amcheck.git --depth=1 contrib/amcheck
67-
make USE_PGXS=1 -C contrib/amcheck install
68-
fi
69-
70-
# Get back to testdir
71-
cd ..
72-
55+
#########################################################
7356
# Build and install ptrack extension
7457
echo "############### Compiling and installing ptrack extension"
58+
cp --recursive ${PTRACK_SRC} ${PG_SRC}/contrib/ptrack
59+
make USE_PGXS=1 PG_CPPFLAGS="-coverage" SHLIB_LINK="-coverage" --directory=${PG_SRC}/contrib/ptrack/ install
7560

76-
# XXX: Hackish way to make possible to run tap tests
77-
mkdir $PG_SRC/contrib/ptrack
78-
cp * $PG_SRC/contrib/ptrack/
79-
cp -R t $PG_SRC/contrib/ptrack/
80-
81-
make USE_PGXS=1 PG_CPPFLAGS="-coverage" SHLIB_LINK="-coverage" -C $PG_SRC/contrib/ptrack/ install
82-
83-
if [ "$TEST_CASE" = "tap" ]; then
61+
if [ "${TEST_CASE}" = "tap" ]; then
8462

8563
# Run tap tests
8664
echo "############### Running tap tests"
87-
if [ "$MODE" = "legacy" ]; then
65+
if [ "${MODE}" = "legacy" ]; then
8866
# There is a known issue with attaching shared memory segment using the same
8967
# address each time, when EXEC_BACKEND mechanism is turned on. It happens due
9068
# to the ASLR address space randomization, so we are trying to attach a segment
9169
# to the already occupied location. That way we simply turning off ASLR here.
9270
#
9371
# Postgres comment: https://github.com/postgres/postgres/blob/5cbfce562f7cd2aab0cdc4694ce298ec3567930e/src/backend/postmaster/postmaster.c#L4929
94-
setarch x86_64 --addr-no-randomize make -C postgres/contrib/ptrack check || status=$?
72+
setarch x86_64 --addr-no-randomize make --directory=${PG_SRC}/contrib/ptrack check || status=$?
9573
else
96-
make -C postgres/contrib/ptrack check || status=$?
74+
make --directory=${PG_SRC}/contrib/ptrack check || status=$?
9775
fi
9876

9977
else
78+
# Set kernel params (used for debugging -- probackup tests)
79+
echo "############### setting kernel params"
80+
sudo sh -c 'echo 0 > /proc/sys/kernel/yama/ptrace_scope'
10081

10182
# Build and install pg_probackup
10283
echo "############### Compiling and installing pg_probackup"
103-
cd pg_probackup # Go to pg_probackup dir
104-
make USE_PGXS=1 top_srcdir=$PG_SRC install
84+
cd ${PBK_SRC} # Go to pg_probackup dir
85+
make USE_PGXS=1 top_srcdir=${PG_SRC} install
10586

10687
# Setup python environment
10788
echo "############### Setting up python env"
@@ -110,35 +91,36 @@ else
11091
pip install testgres==1.8.2
11192

11293
echo "############### Testing"
113-
if [ "$MODE" = "basic" ]; then
94+
export PG_PROBACKUP_PTRACK=ON
95+
if [ "${MODE}" = "basic" ]; then
11496
export PG_PROBACKUP_TEST_BASIC=ON
115-
elif [ "$MODE" = "paranoia" ]; then
97+
elif [ "${MODE}" = "paranoia" ]; then
11698
export PG_PROBACKUP_PARANOIA=ON
11799
fi
118100

119-
export PG_PROBACKUP_PTRACK=ON
120-
if [ "$TEST_CASE" = "all" ]; then
101+
if [ "${TEST_CASE}" = "all" ]; then
121102
# Run all pg_probackup ptrack tests
122-
python3 -m unittest -v tests.ptrack || status=$?
103+
PBK_TEST_CASE=tests.ptrack
123104
else
124-
for i in `seq $TEST_REPEATS`; do
125-
python3 -m unittest -v tests.ptrack.PtrackTest.$TEST_CASE || status=$?
126-
done
105+
PBK_TEST_CASE=tests.ptrack.PtrackTest.${TEST_CASE}
127106
fi
107+
for i in `seq ${TEST_REPEATS}`; do
108+
python3 -m unittest -v ${PBK_TEST_CASE} || status=$?
109+
done
128110

129111
# Exit virtualenv
130112
deactivate
131-
132-
# Get back to testdir
133-
cd ..
134-
135113
fi
136114

115+
#########################################################
116+
# codecov
117+
echo "############### Codecov"
118+
cd ${PTRACK_SRC}
137119
# Generate *.gcov files
138-
gcov $PG_SRC/contrib/ptrack/*.c $PG_SRC/contrib/ptrack/*.h
120+
gcov ${PG_SRC}/contrib/ptrack/*.c ${PG_SRC}/contrib/ptrack/*.h
139121

140122
# Send coverage stats to Codecov
141123
bash <(curl -s https://codecov.io/bash)
142124

143125
# Something went wrong, exit with code 1
144-
if [ $status -ne 0 ]; then exit 1; fi
126+
if [ ${status} -ne 0 ]; then exit 1; fi

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy