mbox series

[GSoC,0/6] t: port reftable/stack_test.c to the unit testing framework

Message ID 20240806142020.4615-1-chandrapratap3519@gmail.com (mailing list archive)
Headers show
Series t: port reftable/stack_test.c to the unit testing framework | expand

Message

Chandra Pratap Aug. 6, 2024, 2:13 p.m. UTC
The reftable library comes with self tests, which are exercised
as part of the usual end-to-end tests and are designed to
observe the end-user visible effects of Git commands. What it
exercises, however, is a better match for the unit-testing
framework, merged at 8bf6fbd0 (Merge branch 'js/doc-unit-tests',
2023-12-09), which is designed to observe how low level
implementation details, at the level of sequences of individual
function calls, behave.

Hence, port reftable/stack_test.c to the unit testing framework and
improve upon the ported test. The first patch in the series moves
the test to the unit testing framework, and the rest of the patches
improve upon the ported test.

Mentored-by: Patrick Steinhardt <ps@pks.im>
Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Chandra Pratap <chandrapratap3519@gmail.com>

---
CI/PR: https://github.com/gitgitgadget/git/pull/1762

Chandra Pratap(6):
t: move reftable/stack_test.c to the unit testing framework
t: harmonize t-reftable-stack.c with coding guidelines
t-reftable-stack: use Git's tempfile API instead of mkstemp()
t-reftable-stack: use reftable_ref_record_equal() to compare ref records
t-reftable-stack: add test for non-default compaction factor
t-reftable-stack: add test for stack iterators

Makefile                                                 |   2 +-
reftable/reftable-tests.h                                |   1 -
t/helper/test-reftable.c                                 |   1 -
reftable/stack_test.c => t/unit-tests/t-reftable-stack.c | 600 +++++++++++++++++++--------------
4 files changed, 355 insertions(+), 249 deletions(-)

Comments

Junio C Hamano Aug. 6, 2024, 8:38 p.m. UTC | #1
Chandra Pratap <chandrapratap3519@gmail.com> writes:

> The reftable library comes with self tests, which are exercised
> as part of the usual end-to-end tests and are designed to
> observe the end-user visible effects of Git commands. What it
> exercises, however, is a better match for the unit-testing
> framework, merged at 8bf6fbd0 (Merge branch 'js/doc-unit-tests',
> 2023-12-09), which is designed to observe how low level
> implementation details, at the level of sequences of individual
> function calls, behave.
>
> Hence, port reftable/stack_test.c to the unit testing framework and
> improve upon the ported test. The first patch in the series moves
> the test to the unit testing framework, and the rest of the patches
> improve upon the ported test.

However, reftable/stack_test.c currently is a moving target because
there is an in-flight topic that improves the table compaction and
that topic wants to add more tests there.  So let's wait until the
dust from the other topic settles before doing the first step of
this topic to move the file to t/unit-tests/ hiearchy.

Thanks.

> Mentored-by: Patrick Steinhardt <ps@pks.im>
> Mentored-by: Christian Couder <chriscool@tuxfamily.org>
> Signed-off-by: Chandra Pratap <chandrapratap3519@gmail.com>
>
> ---
> CI/PR: https://github.com/gitgitgadget/git/pull/1762
>
> Chandra Pratap(6):
> t: move reftable/stack_test.c to the unit testing framework
> t: harmonize t-reftable-stack.c with coding guidelines
> t-reftable-stack: use Git's tempfile API instead of mkstemp()
> t-reftable-stack: use reftable_ref_record_equal() to compare ref records
> t-reftable-stack: add test for non-default compaction factor
> t-reftable-stack: add test for stack iterators
>
> Makefile                                                 |   2 +-
> reftable/reftable-tests.h                                |   1 -
> t/helper/test-reftable.c                                 |   1 -
> reftable/stack_test.c => t/unit-tests/t-reftable-stack.c | 600 +++++++++++++++++++--------------
> 4 files changed, 355 insertions(+), 249 deletions(-)
Chandra Pratap Aug. 7, 2024, 1:01 p.m. UTC | #2
On Wed, 7 Aug 2024 at 02:08, Junio C Hamano <gitster@pobox.com> wrote:
>
> Chandra Pratap <chandrapratap3519@gmail.com> writes:
>
> > The reftable library comes with self tests, which are exercised
> > as part of the usual end-to-end tests and are designed to
> > observe the end-user visible effects of Git commands. What it
> > exercises, however, is a better match for the unit-testing
> > framework, merged at 8bf6fbd0 (Merge branch 'js/doc-unit-tests',
> > 2023-12-09), which is designed to observe how low level
> > implementation details, at the level of sequences of individual
> > function calls, behave.
> >
> > Hence, port reftable/stack_test.c to the unit testing framework and
> > improve upon the ported test. The first patch in the series moves
> > the test to the unit testing framework, and the rest of the patches
> > improve upon the ported test.
>
> However, reftable/stack_test.c currently is a moving target because
> there is an in-flight topic that improves the table compaction and
> that topic wants to add more tests there.  So let's wait until the
> dust from the other topic settles before doing the first step of
> this topic to move the file to t/unit-tests/ hiearchy.
>
> Thanks.
>

Oh okay, I will focus on the other tests in the meantime.

--snip--