Re: Unit tests for SLRU

Aleksander Alekseev <aleksander@timescale.com>

From: Aleksander Alekseev <aleksander@timescale.com>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>, Maxim Orlov <orlovmg@gmail.com>, Pavel Borisov <pashkin.elfe@gmail.com>, Noah Misch <noah@leadboat.com>, Daniel Gustafsson <daniel@yesql.se>
Date: 2022-04-05T12:14:17Z
Lists: pgsql-hackers

Attachments

Hi hackers,

>> Again, I don't have a strong opinion here. If you insist, I will place the
>> tests to regress.c.
>
> It is up to committer to decide, but I think it would be good to place tests
> in regression. In my opinion, many things from core may be used by extensions.
> And then it is up to extension authors to make relevant tests.
>
> For me, it's enough to make a reasonable test coverage for SLRU without
> investing too much effort into generalization.

OK, here is an updated version of the patch. Changes comparing to v1:

* Tests are moved to regress.c, as asked by the majority;
* SimpleLruInit() returns void as before, per Daniel's feedback;
* Most of the initial refactorings were reverted in order to keep the patch
  as small as possible, per Maxim's feedback.

LCOV indicates 65% of code coverage in terms of lines of code. I'm currently
working on improving this number.

More feedback is always welcome!

-- 
Best regards,
Aleksander Alekseev

Commits

  1. Add test module for SLRUs

  2. Fix comment of SimpleLruInit() in slru.c