# Copyright (c) 2026, Kirillov Vyacheslav by AI, QDB Development Group # # Assert-only shared-map tests. They are kept out of the cfs_shmem # regression test so that its expected output does not depend on whether # the server was built with assertions. use strict; use warnings FATAL => 'all'; use PostgreSQL::Test::Cluster; use Test::More; my $node = PostgreSQL::Test::Cluster->new('cfs_shmem_hooks'); $node->init; $node->start; $node->safe_psql('postgres', 'CREATE EXTENSION test_cfs'); my $asserts = $node->safe_psql('postgres', 'SHOW debug_assertions'); if ($asserts eq 'off') { plan skip_all => 'server built without assertions'; } my $failures = $node->safe_psql('postgres', "SELECT count(*) FROM cfs_run_shmem_hook_tests() WHERE result <> 'ok'"); is($failures, '0', 'all shared-map hook tests pass'); my $count = $node->safe_psql('postgres', 'SELECT count(*) FROM cfs_run_shmem_hook_tests()'); is($count, '4', 'four shared-map hook tests registered'); my $names = $node->safe_psql( 'postgres', q{ SELECT string_agg(test_name, ',' ORDER BY test_name) FROM cfs_run_shmem_hook_tests() }); is( $names, 'shared_map_merge_race,shared_map_orphan_reservation,shared_map_publish_unsynced,shared_map_usage_reset', 'hook test names are stable'); done_testing();