Skip to content

Commit a4eb1d3

Browse files
committed
Add a separate tap test build
1 parent 3188527 commit a4eb1d3

File tree

3 files changed

+56
-43
lines changed

3 files changed

+56
-43
lines changed

.travis.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ notifications:
2020
on_failure: always
2121

2222
env:
23-
- PG_VERSION=12 PG_BRANCH=REL_12_STABLE
23+
- PG_VERSION=12 PG_BRANCH=REL_12_STABLE TEST_CASE=tap
24+
- PG_VERSION=12 PG_BRANCH=REL_12_STABLE TEST_CASE=all
2425
- PG_VERSION=12 PG_BRANCH=REL_12_STABLE TEST_CASE=test_ptrack_multiple_segments TEST_REPEATS=5
2526
- PG_VERSION=12 PG_BRANCH=REL_12_STABLE TEST_CASE=test_ptrack_uncommitted_xact TEST_REPEATS=15

codecov.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# datapagemap.c/.h are copied from Postgres, so let's remove it
2+
# from report. Otherwise, we would have to remove some currently
3+
# unused methods to do not spoil the report.
4+
ignore:
5+
- "**/*datapagemap*"

run_tests.sh

+49-42
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@ git clone https://github.com/ololobus/pg_probackup.git --depth=1 -b ptrack-tests
3232
# Compile and install Postgres
3333
cd postgres # Go to postgres dir
3434

35-
# XXX: Hackish way to run tap tests
36-
mkdir contrib/ptrack
37-
cp ../* contrib/ptrack/
38-
cp -R ../t contrib/ptrack/
39-
4035
echo "############### Applying ptrack patch"
4136
git apply -v -3 ../patches/$PG_BRANCH-ptrack-core.diff
4237

@@ -50,6 +45,14 @@ export PATH=$PGHOME/bin:$PATH
5045
export LD_LIBRARY_PATH=$PGHOME/lib
5146
export PG_CONFIG=$(which pg_config)
5247

48+
# Show pg_config path (just in case)
49+
echo "############### pg_config path"
50+
which pg_config
51+
52+
# Show pg_config just in case
53+
echo "############### pg_config"
54+
pg_config
55+
5356
# Get amcheck if missing
5457
if [ ! -d "contrib/amcheck" ]; then
5558
echo "############### Getting missing amcheck"
@@ -62,53 +65,57 @@ cd ..
6265

6366
# Build and install ptrack extension
6467
echo "############### Compiling and installing ptrack extension"
65-
make USE_PGXS=1 PG_CPPFLAGS="-coverage" SHLIB_LINK="-coverage" install
66-
67-
# Show pg_config path (just in case)
68-
echo "############### pg_config path"
69-
which pg_config
7068

71-
# Show pg_config just in case
72-
echo "############### pg_config"
73-
pg_config
69+
# XXX: Hackish way to make possible to run tap tests
70+
mkdir $PG_SRC/contrib/ptrack
71+
cp * $PG_SRC/contrib/ptrack/
72+
cp -R t $PG_SRC/contrib/ptrack/
7473

75-
# Build and install pg_probackup
76-
echo "############### Compiling and installing pg_probackup"
77-
cd pg_probackup # Go to pg_probackup dir
78-
make USE_PGXS=1 top_srcdir=$PG_SRC install
74+
make USE_PGXS=1 PG_CPPFLAGS="-coverage" SHLIB_LINK="-coverage" -C $PG_SRC/contrib/ptrack/ install
7975

80-
# Setup python environment
81-
echo "############### Setting up python env"
82-
virtualenv pyenv
83-
source pyenv/bin/activate
84-
pip install testgres==1.8.2
76+
if [ "$TEST_CASE" = "tap" ]; then
8577

86-
echo "############### Testing"
87-
if [ "$MODE" = "basic" ]; then
88-
export PG_PROBACKUP_TEST_BASIC=ON
89-
fi
78+
# Run tap tests
79+
echo "############### Running tap tests"
80+
make -C postgres/contrib/ptrack check || status=$?
9081

91-
if [ "$TEST_CASE" = "all" ]; then
92-
# Run all pg_probackup ptrack tests
93-
python -m unittest -v tests.ptrack || status=$?
9482
else
95-
for i in `seq $TEST_REPEATS`; do
96-
python -m unittest -v tests.ptrack.PtrackTest.$TEST_CASE || status=$?
97-
done
98-
fi
9983

100-
# Exit virtualenv
101-
deactivate
84+
# Build and install pg_probackup
85+
echo "############### Compiling and installing pg_probackup"
86+
cd pg_probackup # Go to pg_probackup dir
87+
make USE_PGXS=1 top_srcdir=$PG_SRC install
88+
89+
# Setup python environment
90+
echo "############### Setting up python env"
91+
virtualenv pyenv
92+
source pyenv/bin/activate
93+
pip install testgres==1.8.2
94+
95+
echo "############### Testing"
96+
if [ "$MODE" = "basic" ]; then
97+
export PG_PROBACKUP_TEST_BASIC=ON
98+
fi
99+
100+
if [ "$TEST_CASE" = "all" ]; then
101+
# Run all pg_probackup ptrack tests
102+
python -m unittest -v tests.ptrack || status=$?
103+
else
104+
for i in `seq $TEST_REPEATS`; do
105+
python -m unittest -v tests.ptrack.PtrackTest.$TEST_CASE || status=$?
106+
done
107+
fi
108+
109+
# Exit virtualenv
110+
deactivate
111+
112+
# Get back to testdir
113+
cd ..
102114

103-
# Get back to testdir
104-
cd ..
105-
106-
# Run tap tests
107-
echo "############### Running tap tests"
108-
make -C postgres/contrib/ptrack check || status=$?
115+
fi
109116

110117
# Generate *.gcov files
111-
gcov src/*.c src/*.h
118+
gcov $PG_SRC/contrib/ptrack/*.c $PG_SRC/contrib/ptrack/*.h
112119

113120
# Send coverage stats to Codecov
114121
bash <(curl -s https://codecov.io/bash)

0 commit comments

Comments
 (0)