From 9fdd3a4a1e6e4c0059cef2c6218ef84fcef657d0 Mon Sep 17 00:00:00 2001 From: Alexander Bayandin Date: Fri, 28 Jul 2023 16:00:55 +0100 Subject: [PATCH] test_runner: add amcheck to test_compatibility (#4772) Run `pg_amcheck` in forward and backward compatibility tests to catch some data corruption. ## Summary of changes - Add amcheck compiling to Makefile - Add `pg_amcheck` to test_compatibility --- Makefile | 2 ++ test_runner/regress/test_compatibility.py | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/Makefile b/Makefile index ae979b8b4c..0768b64502 100644 --- a/Makefile +++ b/Makefile @@ -108,6 +108,8 @@ postgres-%: postgres-configure-% \ $(MAKE) -C $(POSTGRES_INSTALL_DIR)/build/$*/contrib/pg_buffercache install +@echo "Compiling pageinspect $*" $(MAKE) -C $(POSTGRES_INSTALL_DIR)/build/$*/contrib/pageinspect install + +@echo "Compiling amcheck $*" + $(MAKE) -C $(POSTGRES_INSTALL_DIR)/build/$*/contrib/amcheck install .PHONY: postgres-clean-% postgres-clean-%: diff --git a/test_runner/regress/test_compatibility.py b/test_runner/regress/test_compatibility.py index 6c592d3249..f353c9d6c9 100644 --- a/test_runner/regress/test_compatibility.py +++ b/test_runner/regress/test_compatibility.py @@ -438,6 +438,14 @@ def check_neon_works( test_output_dir / "dump-from-wal.filediff", ) + # TODO: Run pg_amcheck unconditionally after the next release + try: + pg_bin.run(["psql", connstr, "--command", "CREATE EXTENSION IF NOT EXISTS amcheck"]) + except subprocess.CalledProcessError: + log.info("Extension amcheck is not available, skipping pg_amcheck") + else: + pg_bin.run_capture(["pg_amcheck", connstr, "--install-missing", "--verbose"]) + # Check that we can interract with the data pg_bin.run_capture(["pgbench", "--time=10", "--progress=2", connstr])