Skip to content

lib/interval_tree: add some test cases and cleanup

Wei Yang linux-mm 2 versions – Applied

Status from this message: [merged mm-nonmm-stable] lib-interval_tree-fix-the-comment-of-interval_tree_span_iter_next_gap.patch removed from -mm tree

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest7 patches 0 repliesApplied 7/7
  2. v17 patches 6 repliesSuperseded

Changes in v2 from the cover letter

* move definition of container_of() into container_of.h
* fix compile warning by defining seed with ullong

Patches in v2 All 7 applied

#Subject and filesSizeRepliesApplied
1/7lib/rbtree: enable userland test suite for rbtree related data structuretools/include/asm/timex.h tools/include/linux/container_of.h tools/include/linux/kernel.h +16 more+288 -130 repliesApplied
2/7lib/rbtree: split testslib/interval_tree_test.c lib/rbtree_test.c+59 -200 repliesApplied
3/7lib/rbtree: add random seedinclude/linux/types.h lib/interval_tree_test.c lib/rbtree_test.c +3 more+15 -40 repliesApplied
4/7lib/interval_tree: add test case for interval_tree_iter_xxx() helperslib/interval_tree_test.c tools/include/linux/bitmap.h tools/lib/bitmap.c+110 -00 repliesApplied
5/7lib/interval_tree: add test case for span iterationlib/interval_tree_test.c tools/testing/rbtree/Makefile tools/testing/rbtree/interval_tree_test.c+123 -20 repliesApplied
6/7lib/interval_tree: skip the check before go to the right subtreeinclude/linux/interval_tree_generic.h+2 -60 repliesApplied
7/7lib/interval_tree: fix the comment of interval_tree_span_iter_next_gap()lib/interval_tree.c+9 -30 repliesApplied

Reviews trailers per patch

1 of 7 patches has a Reviewed-by or Acked-by.

PatchJason Gunthorpe
1/7
2/7
3/7
4/7
5/7
6/7
7/7R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [Patch v2 0/7] lib/interval_tree: add some test cases and cleanup

Originally, I sent an interval tree cleanup[1], but lack of reasonable test.

As Matthew suggested, this patch set includes proper test to exercise the change in interval tree.

Since rbtree/augmented tree/interval tree share similar data structure, besides new cases for interval tree, this patch set also does cleanup for others.

Patch 1: There are test cases as kernel module, this patch enable them in
userland. This would help for testing and debugging.
Patch 2: Split cases for better reading. And prepare for new cases adding. Patch 3: Add random seed to cover different situations
Patch 4: Add case for interval_tree_iter_xxx() helper
Patch 5: Add case for span iteration
Patch 6: is the original cleanup
Patch 7: fix the comment of interval_tree_span_iter_next_gap()

v2:
* move definition of container_of() into container_of.h
* fix compile warning by defining seed with ullong

[1]: https://lkml.kernel.org/r/[email protected]

Wei Yang (7):
lib/rbtree: enable userland test suite for rbtree related data
structure
lib/rbtree: split tests
lib/rbtree: add random seed
lib/interval_tree: add test case for interval_tree_iter_xxx() helpers lib/interval_tree: add test case for span iteration lib/interval_tree: skip the check before go to the right subtree lib/interval_tree: fix the comment of
interval_tree_span_iter_next_gap()

 include/linux/interval_tree_generic.h         |   8 +-
 include/linux/types.h                         |   1 +
 lib/interval_tree.c                           |  12 +-
 lib/interval_tree_test.c                      | 237 ++++++++++++++++--
 lib/rbtree_test.c                             |  30 ++-
 tools/include/asm/timex.h                     |  13 +
 tools/include/linux/bitmap.h                  |  21 ++
 tools/include/linux/container_of.h            |  18 ++
 tools/include/linux/kernel.h                  |  14 +-
 tools/include/linux/math64.h                  |   5 +
 tools/include/linux/moduleparam.h             |   7 +
 tools/include/linux/prandom.h                 |  51 ++++
 tools/include/linux/slab.h                    |   1 +
 tools/include/linux/types.h                   |   2 +
 tools/lib/bitmap.c                            |  20 ++
 tools/lib/slab.c                              |  16 ++
 tools/testing/rbtree/Makefile                 |  33 +++
 tools/testing/rbtree/interval_tree_test.c     |  58 +++++
 tools/testing/rbtree/rbtree_test.c            |  48 ++++
 tools/testing/rbtree/test.h                   |   4 +
 tools/testing/shared/interval_tree-shim.c     |   5 +
 tools/testing/shared/linux/interval_tree.h    |   7 +
 .../shared/linux/interval_tree_generic.h      |   2 +
 tools/testing/shared/linux/rbtree.h           |   8 +
 tools/testing/shared/linux/rbtree_augmented.h |   7 +
 tools/testing/shared/linux/rbtree_types.h     |   8 +
 tools/testing/shared/rbtree-shim.c            |   6 +
 27 files changed, 600 insertions(+), 42 deletions(-)
 create mode 100644 tools/include/asm/timex.h
 create mode 100644 tools/include/linux/container_of.h
 create mode 100644 tools/include/linux/moduleparam.h
 create mode 100644 tools/include/linux/prandom.h
 create mode 100644 tools/testing/rbtree/Makefile
 create mode 100644 tools/testing/rbtree/interval_tree_test.c
 create mode 100644 tools/testing/rbtree/rbtree_test.c
 create mode 100644 tools/testing/rbtree/test.h
 create mode 100644 tools/testing/shared/interval_tree-shim.c
 create mode 100644 tools/testing/shared/linux/interval_tree.h
 create mode 100644 tools/testing/shared/linux/interval_tree_generic.h
 create mode 100644 tools/testing/shared/linux/rbtree.h
 create mode 100644 tools/testing/shared/linux/rbtree_augmented.h
 create mode 100644 tools/testing/shared/linux/rbtree_types.h
 create mode 100644 tools/testing/shared/rbtree-shim.c
Signature · 1 line
2.34.1