Re: Unit tests for SLRU

Daniel Gustafsson <daniel@yesql.se>

From: Daniel Gustafsson <daniel@yesql.se>
To: Aleksander Alekseev <aleksander@timescale.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Michael Paquier <michael@paquier.xyz>, Pavel Borisov <pashkin.elfe@gmail.com>, Peter Eisentraut <peter.eisentraut@enterprisedb.com>, Maxim Orlov <orlovmg@gmail.com>, Noah Misch <noah@leadboat.com>
Date: 2022-11-15T10:39:20Z
Lists: pgsql-hackers
> On 15 Nov 2022, at 11:15, Aleksander Alekseev <aleksander@timescale.com> wrote:

>> What do you think?
> 
> It looks much better than before. I replaced strcpy() with strncpy()
> and pgindent'ed the code.

+	/* write given data to the page */
+	strncpy(TestSlruCtl->shared->page_buffer[slotno], data, BLCKSZ - 1);

Would it make sense to instead use pg_pwrite to closer match the code being
tested?

> Other than that to me it looks ready to be committed.

Agreed, reading over it nothing sticks out.

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




Commits

  1. Add test module for SLRUs

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