Re: Unit tests for SLRU - Mailing list pgsql-hackers

From Aleksander Alekseev
Subject Re: Unit tests for SLRU
Date
Msg-id CAJ7c6TP+4FquwzZ_FGdLgRK2YRz9K76RAA7e6JnQkEbOT1GUwQ@mail.gmail.com
Whole thread Raw
In response to Re: Unit tests for SLRU  (Pavel Borisov <pashkin.elfe@gmail.com>)
Responses Re: Unit tests for SLRU  (Maxim Orlov <orlovmg@gmail.com>)
List pgsql-hackers
Hi Daniel,

> It also doesn't seem all that appealing that SimpleLruInit can
> return false on successful function invocation, it makes for a confusing API.

Agree. I think using an additional `bool *found` argument would be less confusing.

Noah, Pavel,

>> The default place for this kind of test is regress.c, with plain "make check"
>> calling the regress.c function.  src/test/modules is for things requiring an
>> extension module or otherwise unable to run through regress.c.
>
> +1 for placement c functions into regress.c if it's possible for the aim of simplification.

Thanks for your feedback. I'm OK with placing the tests to regress.c, but I would like to double-check if this would be a right place for them.

I'm reading src/test/modules/README and it says:

"""
src/test/modules contains PostgreSQL extensions that are primarily or entirely
intended for testing PostgreSQL and/or to serve as example code. [...]

If you're adding new hooks or other functionality exposed as C-level API this
is where to add the tests for it.
"""

SLRU looks like a quite general-purpose container. I can imagine how someone may decide to use it in an extension. Wouldn't it be more logical to place it near:

src/test/modules/test_rbtree
src/test/modules/test_shm_mq

... etc?

Again, I don't have a strong opinion here. If you insist, I will place the tests to regress.c.
 
--
Best regards,
Aleksander Alekseev

pgsql-hackers by date:

Previous
From: Kyotaro Horiguchi
Date:
Subject: Re: standby recovery fails (tablespace related) (tentative patch and discussion)
Next
From: Bharath Rupireddy
Date:
Subject: Re: Extensible Rmgr for Table AMs