Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve and document test suites #404

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 2 additions & 1 deletion .github/workflows/postgresql-11-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ jobs:
libipc-run-perl -y docbook-xsl docbook-xsl libxml2 libxml2-utils \
libxml2-dev libxslt-dev xsltproc libkrb5-dev libldap2-dev \
libsystemd-dev gettext tcl-dev libperl-dev pkg-config clang-11 \
llvm-11 llvm-11-dev libselinux1-dev python3-dev uuid-dev liblz4-dev
llvm-11 llvm-11-dev libselinux1-dev python3-dev uuid-dev liblz4-dev \
libtext-diff-perl
sudo rm -rf /var/lib/postgresql /var/log/postgresql /etc/postgresql \
/usr/lib/postgresql /usr/include/postgresql /usr/share/postgresql \
/etc/postgresql
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/postgresql-11-ppg-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
postgresql postgresql*
sudo apt-get install -y libreadline6-dev systemtap-sdt-dev \
zlib1g-dev libssl-dev libpam0g-dev python3-dev bison flex \
libipc-run-perl wget
libipc-run-perl wget libtext-diff-perl
sudo rm -rf /var/lib/postgresql /var/log/postgresql /etc/postgresql \
/usr/lib/postgresql /usr/include/postgresql /usr/share/postgresql \
/etc/postgresql
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/postgresql-12-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ jobs:
libipc-run-perl docbook-xsl docbook-xsl libxml2 libxml2-utils \
libxml2-dev libxslt-dev xsltproc libkrb5-dev libldap2-dev \
libsystemd-dev gettext tcl-dev libperl-dev pkg-config clang-11 \
llvm-11 llvm-11-dev libselinux1-dev python3-dev uuid-dev liblz4-dev
llvm-11 llvm-11-dev libselinux1-dev python3-dev uuid-dev liblz4-dev \
libtext-diff-perl
sudo rm -rf /var/lib/postgresql /var/log/postgresql /etc/postgresql \
/usr/lib/postgresql /usr/include/postgresql /usr/share/postgresql \
/etc/postgresql
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/postgresql-12-pgdg-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
postgresql postgresql*
sudo apt-get install -y libreadline6-dev systemtap-sdt-dev \
zlib1g-dev libssl-dev libpam0g-dev python3-dev bison flex \
libipc-run-perl wget -y
libipc-run-perl wget -y libtext-diff-perl
sudo rm -rf /var/lib/postgresql /var/log/postgresql /etc/postgresql \
/usr/lib/postgresql /usr/include/postgresql /usr/share/postgresql \
/etc/postgresql
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/postgresql-12-ppg-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ jobs:
postgresql postgresql*
sudo apt-get install -y libreadline6-dev systemtap-sdt-dev \
zlib1g-dev libssl-dev libpam0g-dev python3-dev bison flex \
libipc-run-perl wget
sudo apt-get install -y libreadline6-dev systemtap-sdt-dev \
zlib1g-dev libssl-dev libpam0g-dev python3-dev bison flex \
libipc-run-perl wget
libipc-run-perl wget libtext-diff-perl
sudo rm -rf /var/lib/postgresql /var/log/postgresql /etc/postgresql \
/usr/lib/postgresql /usr/include/postgresql /usr/share/postgresql \
/etc/postgresql
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/postgresql-13-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ jobs:
libipc-run-perl -y docbook-xsl docbook-xsl libxml2 libxml2-utils \
libxml2-dev libxslt-dev xsltproc libkrb5-dev libldap2-dev \
libsystemd-dev gettext tcl-dev libperl-dev pkg-config clang-11 \
llvm-11 llvm-11-dev libselinux1-dev python3-dev uuid-dev liblz4-dev
llvm-11 llvm-11-dev libselinux1-dev python3-dev uuid-dev liblz4-dev \
libtext-diff-perl
sudo rm -rf /var/lib/postgresql /var/log/postgresql /etc/postgresql \
/usr/lib/postgresql /usr/include/postgresql /usr/share/postgresql \
/etc/postgresql
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/postgresql-13-pgdg-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
postgresql postgresql*
sudo apt-get install -y libreadline6-dev systemtap-sdt-dev \
zlib1g-dev libssl-dev libpam0g-dev python3-dev bison flex \
libipc-run-perl wget -y
libipc-run-perl wget -y libtext-diff-perl
sudo rm -rf /var/lib/postgresql /var/log/postgresql /etc/postgresql \
/usr/lib/postgresql /usr/include/postgresql /usr/share/postgresql \
/etc/postgresql
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/postgresql-13-ppg-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
postgresql postgresql*
sudo apt-get install -y libreadline6-dev systemtap-sdt-dev \
zlib1g-dev libssl-dev libpam0g-dev python3-dev bison flex \
libipc-run-perl wget
libipc-run-perl wget libtext-diff-perl
sudo rm -rf /var/lib/postgresql /var/log/postgresql /etc/postgresql \
/usr/lib/postgresql /usr/include/postgresql /usr/share/postgresql \
/etc/postgresql
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/postgresql-14-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
libxml2-dev libxslt-dev xsltproc libkrb5-dev libldap2-dev \
libsystemd-dev gettext tcl-dev libperl-dev pkg-config clang-11 \
llvm-11 llvm-11-dev libselinux1-dev python3-dev \
uuid-dev liblz4-dev
uuid-dev liblz4-dev libtext-diff-perl
sudo rm -rf /var/lib/postgresql /var/log/postgresql /etc/postgresql \
/usr/lib/postgresql /usr/include/postgresql /usr/share/postgresql \
/etc/postgresql
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/postgresql-14-pgdg-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ jobs:
sudo apt purge postgresql-client-common postgresql-common \
postgresql postgresql*
sudo apt-get install -y libreadline6-dev systemtap-sdt-dev wget \
zlib1g-dev libssl-dev libpam0g-dev bison flex libipc-run-perl
zlib1g-dev libssl-dev libpam0g-dev bison flex libipc-run-perl \
libtext-diff-perl
sudo rm -rf /var/lib/postgresql /var/log/postgresql /etc/postgresql \
/usr/lib/postgresql /usr/include/postgresql /usr/share/postgresql \
/etc/postgresql
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/postgresql-14-ppg-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
postgresql postgresql*
sudo apt-get install -y libreadline6-dev systemtap-sdt-dev \
zlib1g-dev libssl-dev libpam0g-dev python3-dev bison flex \
libipc-run-perl wget
libipc-run-perl wget libtext-diff-perl
sudo rm -rf /var/lib/postgresql /var/log/postgresql /etc/postgresql \
/usr/lib/postgresql /usr/include/postgresql /usr/share/postgresql \
/etc/postgresql
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/postgresql-15-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
libxml2-dev libxslt-dev xsltproc libkrb5-dev libldap2-dev \
libsystemd-dev gettext tcl-dev libperl-dev pkg-config clang-11 \
llvm-11 llvm-11-dev libselinux1-dev python3-dev \
uuid-dev liblz4-dev
uuid-dev liblz4-dev libtext-diff-perl
sudo rm -rf /var/lib/postgresql /var/log/postgresql /etc/postgresql \
/usr/lib/postgresql /usr/include/postgresql /usr/share/postgresql \
/etc/postgresql
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/postgresql-15-pgdg-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ jobs:
sudo apt purge postgresql-client-common postgresql-common \
postgresql postgresql*
sudo apt-get install -y libreadline6-dev systemtap-sdt-dev wget \
zlib1g-dev libssl-dev libpam0g-dev bison flex libipc-run-perl
zlib1g-dev libssl-dev libpam0g-dev bison flex libipc-run-perl \
libtext-diff-perl
sudo rm -rf /var/lib/postgresql /var/log/postgresql /etc/postgresql \
/usr/lib/postgresql /usr/include/postgresql /usr/share/postgresql \
/etc/postgresql
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/postgresql-15-ppg-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
postgresql postgresql*
sudo apt-get install -y libreadline6-dev systemtap-sdt-dev \
zlib1g-dev libssl-dev libpam0g-dev python3-dev bison flex \
libipc-run-perl wget
libipc-run-perl wget libtext-diff-perl
sudo rm -rf /var/lib/postgresql /var/log/postgresql /etc/postgresql \
/usr/lib/postgresql /usr/include/postgresql /usr/share/postgresql \
/etc/postgresql
Expand Down
31 changes: 31 additions & 0 deletions TESTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# How to run the tests

This document describes how to run the tests suites when building pg & pgsm from source.

The steps can also be adapted when postgres is installed using a package manager, in that case the relevant directories will be in their usual global locations (`/usr/lib/postgresql`)

## pg_regress

1. setup and start a postgres cluster
2. create a database named "contrib\_regression"
3. Install the pg\_stat\_statements extension
4. Run the tests using (with the working directory as the pgsm git repository):

```
<PG_BUILD_DIR>/src/test/regress/pg_regress --bindir <INST_DIR>/bin --temp-config pg_stat_monitor.conf --inputdir regression/ --dbname=contrib_regression basic version guc pgsm_query_id functions counters relations database error_insert application_name application_name_unique top_query cmd_type error rows tags user
```

# prove

1. setup and start postgres cluster
2. create a database named "contrib\_regression"
3. Install the pg\_stat\_monitor and pg\_stat\_statements extensions
4. When executing the tests multiple times, delete the `tmp_check` directory between runs
5. When executing the tests and encountering failures, databases created by some tests might remain in the cluster.
Connect to the cluster, and delete these databases if they cause errors.
6. Run the tests using (with the working directory as the pgsm git repository):

```
prove -I <PG_SRC_DIR>/src/src/test/perl/ -I . t/*.pl
```

6 changes: 3 additions & 3 deletions t/007_settings_pgsm_query_shared_buffer.pl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
print " out: $out \n";
ok($cmdret == 0, "Run pgbench");

($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT datname, substr(query,0,150) AS query, SUM(calls) AS calls FROM pg_stat_monitor GROUP BY datname, query ORDER BY datname, query, calls DESC Limit 20;', extra_params => ['-a', '-Pformat=aligned','-Ptuples_only=off']);
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT datname, substr(query,0,150) AS query, SUM(calls) AS calls FROM pg_stat_monitor GROUP BY datname, query ORDER BY datname, lower(query), calls DESC Limit 20;', extra_params => ['-a', '-Pformat=aligned','-Ptuples_only=off']);
ok($cmdret == 0, "SELECT XXX FROM pg_stat_monitor");
PGSM::append_to_file($stdout);

Expand All @@ -82,7 +82,7 @@
print " out: $out \n";
ok($cmdret == 0, "Run pgbench");

($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT datname, substr(query,0,150) AS query, SUM(calls) AS calls FROM pg_stat_monitor GROUP BY datname, query ORDER BY datname, query, calls DESC Limit 20;', extra_params => ['-a', '-Pformat=aligned','-Ptuples_only=off']);
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT datname, substr(query,0,150) AS query, SUM(calls) AS calls FROM pg_stat_monitor GROUP BY datname, query ORDER BY datname, lower(query), calls DESC Limit 20;', extra_params => ['-a', '-Pformat=aligned','-Ptuples_only=off']);
ok($cmdret == 0, "SELECT XXX FROM pg_stat_monitor");
PGSM::append_to_file($stdout);

Expand All @@ -105,7 +105,7 @@
print " out: $out \n";
ok($cmdret == 0, "Run pgbench");

($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT datname, substr(query,0,150) AS query, SUM(calls) AS calls FROM pg_stat_monitor GROUP BY datname, query ORDER BY datname, query, calls DESC Limit 20;', extra_params => ['-a', '-Pformat=aligned','-Ptuples_only=off']);
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT datname, substr(query,0,150) AS query, SUM(calls) AS calls FROM pg_stat_monitor GROUP BY datname, query ORDER BY datname, lower(query), calls DESC Limit 20;', extra_params => ['-a', '-Pformat=aligned','-Ptuples_only=off']);
ok($cmdret == 0, "SELECT XXX FROM pg_stat_monitor");
PGSM::append_to_file($stdout);

Expand Down
Loading