[GSoC][PATCH v3 0/7] t: port reftable/pq_test.c to the unit testing framework

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In the recent codebase update (commit 8bf6fbd, 2023-12-09), a new unit
testing framework written entirely in C was introduced to the Git project
aimed at simplifying testing and reducing test run times.
Currently, tests for the reftable refs-backend are performed by a custom
testing framework defined by reftable/test_framework.{c, h}. Port
reftable/pq_test.c to the unit testing framework and improve upon
the ported test.

The first two patches in the series are preparatory cleanup, the third patch
moves the test to the unit testing framework, and the rest of the patches
improve upon the ported test.

Mentored-by: Patrick Steinhardt <ps@xxxxxx>
Mentored-by: Christian Couder <chriscool@xxxxxxxxxxxxx>
Signed-off-by: Chandra Pratap <chandrapratap3519@xxxxxxxxx>

---
Changes in v3:
- Add another cleanup patch for reftable/pq.c
- Change the commit title of the first patch
- Re-introduce a lost newline in the first patch

CI/PR for v3: https://github.com/gitgitgadget/git/pull/1745

Chandra Pratap(7):
reftable: remove unncessary curly braces in reftable/pq.c
reftable: change the type of array indices to 'size_t' in
t: move reftable/pq_test.c to the unit testing framework
t-reftable-pq: make merged_iter_pqueue_check() static
t-reftable-pq: make merged_iter_pqueue_check() callable
t-reftable-pq: add test for index based comparison
t-reftable-pq: add tests for merged_iter_pqueue_top()

Makefile                     |   2 +-
reftable/pq.c                |  29 +++--------
reftable/pq.h                |   1 -
reftable/pq_test.c           |  74 ----------------------------
t/helper/test-reftable.c     |   1 -
t/unit-tests/t-reftable-pq.c | 155 +++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 166 insertions(+), 96 deletions(-)

Range-diff against v2:
1:  9ac1035c07 ! 1:  d3c5605ea2 reftable: clean up reftable/pq.c
    @@ Metadata
     Author: Chandra Pratap <chandrapratap3519@xxxxxxxxx>
     
      ## Commit message ##
    -    reftable: clean up reftable/pq.c
    +    reftable: remove unncessary curly braces in reftable/pq.c
     
         According to Documentation/CodingGuidelines, control-flow statements
         with a single line as their body must omit curly braces. Make
    @@ reftable/pq.c: struct pq_entry merged_iter_pqueue_remove(struct merged_iter_pque
      		SWAP(pq->heap[i], pq->heap[min]);
      		i = min;
      	}
    -@@ reftable/pq.c: struct pq_entry merged_iter_pqueue_remove(struct merged_iter_pqueue *pq)
    - void merged_iter_pqueue_add(struct merged_iter_pqueue *pq, const struct pq_entry *e)
    - {
    - 	int i = 0;
    --
    - 	REFTABLE_ALLOC_GROW(pq->heap, pq->len + 1, pq->cap);
    - 	pq->heap[pq->len++] = *e;
    - 
    +@@ reftable/pq.c: void merged_iter_pqueue_add(struct merged_iter_pqueue *pq, const struct pq_entry
      	i = pq->len - 1;
      	while (i > 0) {
      		int j = (i - 1) / 2;
-:  ---------- > 2:  1873fb02ce reftable: change the type of array indices to 'size_t' in reftable/pq.c
2:  f24dc84877 = 3:  3cccf8266a t: move reftable/pq_test.c to the unit testing framework
3:  ce42fd1288 = 4:  4b63849694 t-reftable-pq: make merged_iter_pqueue_check() static
4:  226d72aa6a = 5:  3698a7189f t-reftable-pq: make merged_iter_pqueue_check() callable by reference
5:  00cb440f11 = 6:  d58c8f709e t-reftable-pq: add test for index based comparison
6:  dd44486c28 = 7:  69521f0ff7 t-reftable-pq: add tests for merged_iter_pqueue_top()





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux