pg_checksum: add test for coverage

Started by Dong Wook Leeabout 4 years ago3 messageshackers
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

appliessuccessCI history

You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:

docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t46505
psql -h localhost -U postgres

Built from patchset v1 (message #1), September 20, 2026 at 05:45 AM.

Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:

git clone --branch t46505_1 https://github.com/hackorum-dev/postgres.git

In a checkout you already have, add the fork once:

git remote add hackorum https://github.com/hackorum-dev/postgres.git

then, for this patchset and every later one:

git fetch hackorum t46505_1 && git checkout t46505_1

Patchset v1 (message #1) is on t46505_1

Jump to latest
#1Dong Wook Lee
sh95119@gmail.com

Hi,
I add a tiny test to pg_checksum for coverage.
I checked it improve test coverage 77.9% -> 87.7%.

---
Regards,
DongWook Lee.

Attachments:

t46505_1
v1_add_test_to_pg_checksum.patchapplication/octet-stream; name=v1_add_test_to_pg_checksum.patchDownload+10-0
#2Daniel Gustafsson
daniel@yesql.se
In reply to: Dong Wook Lee (#1)
Re: pg_checksum: add test for coverage

On 29 Aug 2022, at 13:26, Dong Wook Lee <sh95119@gmail.com> wrote:

I add a tiny test to pg_checksum for coverage.
I checked it improve test coverage 77.9% -> 87.7%.

+# Checksums are verified if --progress arguments are specified
+command_ok(
+	[ 'pg_checksums', '--progress', '-D', $pgdata ],
+	"verifies checksums as default action with --progress option");
+
+# Checksums are verified if --verbose arguments are specified
+command_ok(
+	[ 'pg_checksums', '--verbose', '-D', $pgdata ],
+	"verifies checksums as default action with --verbose option");

This isn't really true, --progress or --verbose doesn't enable checksum
verification, it just happens to be the default and thus is invoked when called
without a mode parameter.

As written these tests aren't providing more coverage, they run more code but
they don't ensure that the produced output is correct. If you write these
tests with validation on the output they will be a lot more interesting.

--
Daniel Gustafsson https://vmware.com/

#3Michael Paquier
michael@paquier.xyz
In reply to: Daniel Gustafsson (#2)
Re: pg_checksum: add test for coverage

On Mon, Aug 29, 2022 at 01:46:25PM +0200, Daniel Gustafsson wrote:

As written these tests aren't providing more coverage, they run more code but
they don't ensure that the produced output is correct. If you write these
tests with validation on the output they will be a lot more interesting.

DongWook, if you are able to reply back to this feedback, please feel
free to send a new patch. For now, I have marked this CF entry as
returned with feedback.
--
Michael