Skip to content

Commit 9e88960

Browse files
authored
Merge pull request #7 from CherkashinSergey/refactoring
Improve tests, remove deprecated functions, update postgres patches
2 parents b6abfce + f550b4e commit 9e88960

22 files changed

+1427
-565
lines changed

.dockerignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*.gcno
2+
*.gcda
3+
*.gcov
4+
*.so
5+
*.o

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
*.o
22
*.so
33
*.swp
4+
*.pyc
5+
*.gcda
6+
*.gcno
7+
*.gcov
8+
pg_query_state--*.sql
49
cscope.out
510
tags
11+
Dockerfile

.travis.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
sudo: required
2+
3+
language: c
4+
5+
services:
6+
- docker
7+
8+
install:
9+
- ./mk_dockerfile.sh
10+
- docker-compose build
11+
12+
script:
13+
- docker-compose run $(bash <(curl -s https://codecov.io/env)) tests
14+
15+
notifications:
16+
email:
17+
on_success: change
18+
on_failure: always
19+
20+
env:
21+
- PG_VERSION=11 LEVEL=hardcore
22+
- PG_VERSION=11
23+
- PG_VERSION=10 LEVEL=hardcore
24+
- PG_VERSION=10
25+
- PG_VERSION=9.6 LEVEL=hardcore
26+
- PG_VERSION=9.6
27+
28+
matrix:
29+
allow_failures:
30+
- env: PG_VERSION=10 LEVEL=nightmare
31+
- env: PG_VERSION=9.6 LEVEL=nightmare

Dockerfile.tmpl

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
FROM postgres:${PG_VERSION}-alpine
2+
3+
# Install dependencies
4+
RUN apk add --no-cache \
5+
openssl curl \
6+
perl perl-ipc-run \
7+
make musl-dev gcc bison flex coreutils \
8+
zlib-dev libedit-dev \
9+
clang clang-analyzer \
10+
python2 python2-dev py2-virtualenv;
11+
12+
13+
# Install fresh valgrind
14+
RUN apk add valgrind \
15+
--update-cache \
16+
--repository http://dl-3.alpinelinux.org/alpine/edge/main;
17+
18+
# Environment
19+
ENV LANG=C.UTF-8 PGDATA=/pg/data
20+
21+
# Make directories
22+
RUN mkdir -p ${PGDATA} && \
23+
mkdir -p /pg/testdir
24+
25+
# Grant privileges
26+
RUN chown postgres:postgres ${PGDATA} && \
27+
chown postgres:postgres /pg/testdir && \
28+
chmod -R a+rwx /usr/local/lib/postgresql && \
29+
chmod a+rwx /usr/local/share/postgresql/extension
30+
31+
COPY run_tests.sh /run.sh
32+
RUN chmod 755 /run.sh
33+
34+
ADD . /pg/testdir
35+
WORKDIR /pg/testdir
36+
37+
USER postgres
38+
ENTRYPOINT LEVEL=${LEVEL} /run.sh

Makefile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
MODULE_big = pg_query_state
44
OBJS = pg_query_state.o signal_handler.o $(WIN32RES)
55
EXTENSION = pg_query_state
6-
EXTVERSION = 1.0
7-
DATA = $(EXTENSION)--$(EXTVERSION).sql
6+
EXTVERSION = 1.1
7+
DATA = pg_query_state--1.0--1.1.sql
8+
DATA_built = $(EXTENSION)--$(EXTVERSION).sql
89
PGFILEDESC = "pg_query_state - facility to track progress of plan execution"
910

10-
EXTRA_CLEAN = ./isolation_output
11+
EXTRA_CLEAN = ./isolation_output $(EXTENSION)--$(EXTVERSION).sql \
12+
Dockerfile ./tests/*.pyc
1113

1214
ifdef USE_PGXS
1315
PG_CONFIG = pg_config
@@ -20,6 +22,9 @@ include $(top_builddir)/src/Makefile.global
2022
include $(top_srcdir)/contrib/contrib-global.mk
2123
endif
2224

25+
$(EXTENSION)--$(EXTVERSION).sql: init.sql
26+
cat $^ > $@
27+
2328
check: isolationcheck
2429

2530
ISOLATIONCHECKS=corner_cases

README.md

Lines changed: 176 additions & 180 deletions
Large diffs are not rendered by default.

docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
tests:
2+
build: .

executor_hooks.patch

Lines changed: 0 additions & 66 deletions
This file was deleted.

pg_query_state--1.0.sql renamed to init.sql

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,3 @@ CREATE FUNCTION pg_query_state(pid integer
1515
, leader_pid integer)
1616
AS 'MODULE_PATHNAME'
1717
LANGUAGE C STRICT VOLATILE;
18-
19-
CREATE FUNCTION executor_step(pid integer) RETURNS VOID
20-
AS 'MODULE_PATHNAME'
21-
LANGUAGE C VOLATILE;
22-
23-
CREATE FUNCTION executor_continue(pid integer) RETURNS VOID
24-
AS 'MODULE_PATHNAME'
25-
LANGUAGE C VOLATILE;

mk_dockerfile.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
if [ -z ${PG_VERSION+x} ]; then
2+
echo PG_VERSION is not set!
3+
exit 1
4+
fi
5+
6+
if [ -z ${LEVEL+x} ]; then
7+
LEVEL=scan-build
8+
fi
9+
10+
echo PG_VERSION=${PG_VERSION}
11+
echo LEVEL=${LEVEL}
12+
13+
sed \
14+
-e 's/${PG_VERSION}/'${PG_VERSION}/g \
15+
-e 's/${LEVEL}/'${LEVEL}/g \
16+
Dockerfile.tmpl > Dockerfile

0 commit comments

Comments
 (0)