Re: [PATCH v3 1/4] t: move reftable/readwrite_test.c to the unit testing framework
- From
- Chandra Pratap <chandrapratap3519@gmail.com>
- Date
- Aug 14, 2024, 11:48 UTC
- Message-ID
- <CA+J6zkSAa4ejLtTqNob_JyS8wwx+BX0vsgsWU9mekWcNtVY80g@mail.gmail.com>
- In-Reply-To
- <2rxxfpzijfmvo65xournnmx4oawzqlhgipje4cxzxvo5aqzt6u@xppoikj262cp>
On Wed, 14 Aug 2024 at 04:03, Josh Steadmon <steadmon@google.com> wrote:
Show 17 quoted lines
>
> On 2024.08.13 20:04, Chandra Pratap wrote:
> > reftable/readwrite_test.c exercises the functions defined in
> > reftable/reader.{c,h} and reftable/writer.{c,h}. Migrate
> > reftable/readwrite_test.c to the unit testing framework. Migration
> > involves refactoring the tests to use the unit testing framework
> > instead of reftable's test framework and renaming the tests to
> > align with unit-tests' naming conventions.
> >
> > Since some tests in reftable/readwrite_test.c use the functions
> > set_test_hash(), noop_flush() and strbuf_add_void() defined in
> > reftable/test_framework.{c,h} but these files are not #included
> > in the ported unit test, copy these functions in the new test file.
>
> I'm assuming that eventually, reftable/test_framework (and all the rest
> of reftable/libreftable_test.a) will be removed after all the tests are
> converted to the unit test framework, is that correct?That hasn't been discussed yet but yes, that seems the most likely fate for reftable/test_framework.{c,h}.
> Will other tests need these test_framework functions? If so, I'd rather > not end up with duplicates in each test file, even if these are small > functions. Is there a reason why we can't link the reftable/test_framework > object (or the whole reftable/libreftable_test.a library)?
If I remember correctly, only stack and merged tests besides readwrite utilize these functions.
We're not #including 'test_framwork.h' in the new test files because in a way, the point of this GSoC project is to get rid of reftable/test_framework.{c,h} so we don't need to carry an entirely different testing framework for the reftable sub-project.
As far as duplicated functions are concerned, we can maybe move them to unit-tests/test-lib.{c,h} or a new file in reftable/. I'll create a patch for it sometimes later.