Skip to content

Commit a3b5020

Browse files
committed
Initial version of running regression tests
1 parent 15b5bfb commit a3b5020

File tree

5 files changed

+112
-35
lines changed

5 files changed

+112
-35
lines changed

.github/workflows/spockbench.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,22 @@ jobs:
4141
with:
4242
version: latest
4343

44-
- name: Start docker
44+
- name: Build docker container
4545
run: |
4646
cd ${GITHUB_WORKSPACE}/tests/
4747
echo PG_VER=${{ matrix.pgver }} >> pgedge.env
48-
docker build --build-arg PGVER=${{ matrix.pgver }} -t spock -f Dockerfile.el9 .
48+
docker build \
49+
--build-arg PGVER=${{ matrix.pgver }} \
50+
--build-arg GITHUB_REF=${{ github.ref }} \
51+
--build-arg REPO_URL=https://github.com/${{ github.repository }} \
52+
-t spock -f Dockerfile.el9 .
53+
54+
- name: Run regression tests
55+
run: |
56+
docker run -it -e PGVER=${{ matrix.pgver }} spock /home/pgedge/run-spock-regress.sh
57+
58+
- name: Start docker
59+
run: |
4960
docker compose up
5061
5162
- name: Check spockbench output

tests/Dockerfile.el9

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
FROM rockylinux:9
22

33
ARG PGVER
4+
ARG GITHUB_REF
5+
ARG REPO_URL
46

57
ENV PGVER=$PGVER
8+
ENV GITHUB_REF=$GITHUB_REF
9+
ENV REPO_URL=$REPO_URL
610

711
RUN dnf -y install sudo && dnf -y groupinstall "Development Tools"
812

@@ -19,9 +23,65 @@ RUN dnf install --allowerasing --enablerepo=crb -y $(cat /home/pgedge/lib-list.t
1923
RUN ssh-keygen -t ed25519 -N "" -f ~/.ssh/id_ed25519 && \
2024
cat ~/.ssh/*.pub >> ~/.ssh/authorized_keys
2125

22-
COPY entrypoint.sh run-tests.sh /home/pgedge
2326

24-
RUN sudo chmod +x /home/pgedge/entrypoint.sh /home/pgedge/run-tests.sh
27+
#-----------------------------------------
28+
USER pgedge
29+
30+
WORKDIR /home/pgedge
31+
RUN echo "Cloning Spock at $GITHUB_REF from $REPO_URL"
32+
RUN git clone ${REPO_URL}
33+
34+
WORKDIR /home/pgedge/spock
35+
RUN git checkout ${GITHUB_REF}
36+
37+
WORKDIR /home/pgedge
38+
39+
RUN echo "Determine PostgreSQL tag"
40+
RUN LATEST_TAG=$(git ls-remote --tags https://github.com/postgres/postgres.git | \
41+
grep "refs/tags/REL_${PGVER}_" | \
42+
sed 's|.*refs/tags/||' | \
43+
tr '_' '.' | \
44+
sort -V | \
45+
tail -n 1 | \
46+
tr '.' '_') && \
47+
echo "Using tag $LATEST_TAG" && \
48+
git clone --branch $LATEST_TAG --depth 1 https://github.com/postgres/postgres /home/pgedge/postgres
49+
50+
51+
RUN sudo chmod -R a+w ~/postgres
52+
53+
RUN echo "Setting up pgedge..."
54+
WORKDIR /home/pgedge
55+
RUN curl -fsSL https://pgedge-download.s3.amazonaws.com/REPO/install.py > /home/pgedge/install.py
56+
RUN sudo -u pgedge python3 /home/pgedge/install.py
57+
58+
#RUN ./pgedge setup -U $DBUSER -P $DBPASSWD -d $DBNAME --pg_ver=$PGVER && ./pgedge stop
59+
60+
WORKDIR /home/pgedge/postgres
61+
62+
RUN git apply --verbose /home/pgedge/spock/patches/pg${PGVER}*
63+
64+
RUN echo "==========Compiling Modified PostgreSQL=========="
65+
RUN options="'--prefix=/home/pgedge/pgedge/pg$PGVER' '--disable-rpath' '--with-zstd' '--with-lz4' '--with-icu' '--with-libxslt' '--with-libxml' '--with-uuid=ossp' '--with-gssapi' '--with-ldap' '--with-pam' '--enable-debug' '--enable-dtrace' '--with-llvm' 'LLVM_CONFIG=/usr/bin/llvm-config-64' '--with-openssl' '--with-systemd' '--enable-tap-tests' '--with-python' 'PYTHON=/usr/bin/python3.9' 'BITCODE_CFLAGS=-gdwarf-5 -O0 -fforce-dwarf-frame' 'CFLAGS=-g -O0'" && eval ./configure $options && make -j4 && make install
66+
67+
WORKDIR /home/pgedge
68+
69+
# TODO review
70+
#. /home/pgedge/pgedge/pg$PGVER/pg$PGVER.env
71+
RUN echo "export LD_LIBRARY_PATH=/home/pgedge/pgedge/pg$PGVER/lib/:$LD_LIBRARY_PATH" >> /home/pgedge/.bashrc
72+
RUN echo "export PATH=/home/test/pgedge/pg$PGVER/bin:$PATH" >> /home/pgedge/.bashrc
73+
#. /home/pgedge/.bashrc
74+
75+
RUN echo "==========Recompiling Spock=========="
76+
WORKDIR /home/pgedge/spock
77+
RUN . /home/pgedge/.bashrc && export PG_CONFIG=/home/pgedge/pgedge/pg$PGVER/bin/pg_config && export PATH=/home/pgedge/pgedge/pg$PGVER/bin:$PATH && make clean && make -j16 && make install
78+
79+
RUN echo "==========Built Spock=========="
80+
81+
#-----------------------------------------
82+
COPY entrypoint.sh run-tests.sh run-spock-regress.sh /home/pgedge
83+
84+
RUN sudo chmod +x /home/pgedge/entrypoint.sh /home/pgedge/run-tests.sh /home/pgedge/run-spock-regress.sh
2585

2686
WORKDIR /home/pgedge/
2787
USER pgedge

tests/entrypoint.sh

Lines changed: 6 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,16 @@
11
#!/bin/bash
22
set -e
33

4-
echo "PGVER=$PGVER"
5-
LATEST_TAG=$(git ls-remote --tags https://github.com/postgres/postgres.git | \
6-
grep "refs/tags/REL_${PGVER}_" | \
7-
sed 's|.*refs/tags/||' | \
8-
tr '_' '.' | \
9-
sort -V | \
10-
tail -n 1 | \
11-
tr '.' '_')
4+
#echo "Setting up pgedge..."
5+
#cd /home/pgedge
6+
#curl -fsSL https://pgedge-download.s3.amazonaws.com/REPO/install.py > /home/pgedge/install.py
7+
#sudo -u pgedge python3 /home/pgedge/install.py
8+
#cd pgedge && ./pgedge setup -U $DBUSER -P $DBPASSWD -d $DBNAME --pg_ver=$PGVER && ./pgedge stop
9+
#
1210

13-
echo "Using tag $LATEST_TAG"
14-
git clone --branch $LATEST_TAG --depth 1 https://github.com/postgres/postgres /home/pgedge/postgres
15-
sudo chmod -R a+w ~/postgres
16-
17-
echo "Setting up pgedge..."
18-
cd /home/pgedge
19-
curl -fsSL https://pgedge-download.s3.amazonaws.com/REPO/install.py > /home/pgedge/install.py
20-
sudo -u pgedge python3 /home/pgedge/install.py
21-
cd pgedge && ./pgedge setup -U $DBUSER -P $DBPASSWD -d $DBNAME --pg_ver=$PGVER && ./pgedge stop
22-
23-
cd /home/pgedge/postgres
24-
25-
git apply --verbose /home/pgedge/spock/patches/pg${PGVER}*
26-
27-
options="'--prefix=/home/pgedge/pgedge/pg$PGVER' '--disable-rpath' '--with-zstd' '--with-lz4' '--with-icu' '--with-libxslt' '--with-libxml' '--with-uuid=ossp' '--with-gssapi' '--with-ldap' '--with-pam' '--enable-debug' '--enable-dtrace' '--with-llvm' 'LLVM_CONFIG=/usr/bin/llvm-config-64' '--with-openssl' '--with-systemd' '--enable-tap-tests' '--with-python' 'PYTHON=/usr/bin/python3.9' 'BITCODE_CFLAGS=-gdwarf-5 -O0 -fforce-dwarf-frame' 'CFLAGS=-g -O0'" && eval ./configure $options && make -j4 && make install
28-
29-
cd /home/pgedge
3011
. /home/pgedge/pgedge/pg$PGVER/pg$PGVER.env
31-
echo "export LD_LIBRARY_PATH=/home/pgedge/pgedge/pg$PGVER/lib/:$LD_LIBRARY_PATH" >> /home/pgedge/.bashrc
32-
echo "export PATH=/home/test/pgedge/pg$PGVER/bin:$PATH" >> /home/pgedge/.bashrc
3312
. /home/pgedge/.bashrc
3413

35-
echo "==========Recompiling Spock=========="
36-
cd ~/spock
37-
make clean && make -j16 && make install
38-
3914
echo "==========Installing Spockbench=========="
4015
cd ~/spockbench
4116
sudo python3 setup.py install

tests/lib-list.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ curl
44
cyrus-sasl-gssapi
55
dnsutils
66
flex
7+
jansson-devel
78
krb5-devel
89
libicu-devel
910
libpq

tests/run-spock-regress.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
###
3+
### Run the regression tests
4+
###
5+
6+
7+
export PG_CONFIG=/home/pgedge/pgedge/pg${PGVER}/bin/pg_config
8+
export PATH=/home/pgedge/pgedge/pg${PGVER}/bin:$PATH
9+
export LD_LIBRARY_PATH=/home/pgedge/pgedge/pg${PGVER}/lib/:$LD_LIBRARY_PATH
10+
11+
# PGVER should be previously set in the environment
12+
if [ -z "${PGVER}" ]
13+
then
14+
echo "The PGVER environment variable must be set before running this command"
15+
exit 1
16+
fi
17+
18+
CWD=`pwd`
19+
cd /home/pgedge/spock/
20+
21+
make regresscheck
22+
RESULT=$?
23+
24+
if [ $RESULT -ne 0 ]
25+
then
26+
cat /home/pgedge/spock/regression_output/regression.diffs
27+
echo "Errors in regression checks"
28+
exit 1
29+
fi
30+

0 commit comments

Comments
 (0)