pgsql: test_bitmapset: Improve random function

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: test_bitmapset: Improve random function
Date: 2025-10-09 22:20:33
Message-ID: E1v6yzx-000u0K-1f@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

test_bitmapset: Improve random function

test_random_operations() did not check the result returned by
bms_is_member() in its last phase, when checking that the contents of
the bitmap match with what is expected. This was impacting the
reliability of the function and the coverage it could provide.

This commit improves the whole function, adding more checks based on
bms_is_member(), using a bitmap and a secondary array that tracks the
members added by random additions and deletions.

While on it, more comments are added to document the internals of the
function.

Reported-by: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
Author: Greg Burd <greg(at)burd(dot)me>
Reviewed-by: Michael Paquier <michael(at)paquier(dot)xyz>
Reviewed-by: David Rowley <dgrowleyml(at)gmail(dot)com>
Discussion: https://postgr.es/m/CAEudQAq_zOSA2NUQSWePTGV_=90Uw0WcXxGOWnN-vwF046OOqA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9d46b86529e8337e34fb5a65b1a7dca9dc53938f

Modified Files
--------------
src/test/modules/test_bitmapset/test_bitmapset.c | 57 ++++++++++++++++++------
1 file changed, 44 insertions(+), 13 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2025-10-09 23:17:33 pgsql: bufmgr: Fix valgrind checking for buffers pinned in StrategyGetB
Previous Message Melanie Plageman 2025-10-09 20:30:45 pgsql: Eliminate COPY FREEZE use of XLOG_HEAP2_VISIBLE