linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Wei Yang <richard.weiyang@gmail.com>
To: akpm@linux-foundation.org
Cc: willy@infradead.org, michel@lespinasse.org, linux-mm@kvack.org,
	Wei Yang <richard.weiyang@gmail.com>
Subject: [Patch v2 0/7] lib/interval_tree: add some test cases and cleanup
Date: Mon, 10 Mar 2025 07:49:31 +0000	[thread overview]
Message-ID: <20250310074938.26756-1-richard.weiyang@gmail.com> (raw)

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/20250224022239.21976-1-richard.weiyang@gmail.com

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

-- 
2.34.1



             reply	other threads:[~2025-03-10  7:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-10  7:49 Wei Yang [this message]
2025-03-10  7:49 ` [Patch v2 1/7] lib/rbtree: enable userland test suite for rbtree related data structure Wei Yang
2025-03-10  7:49 ` [Patch v2 2/7] lib/rbtree: split tests Wei Yang
2025-03-10  7:49 ` [Patch v2 3/7] lib/rbtree: add random seed Wei Yang
2025-03-10  7:49 ` [Patch v2 4/7] lib/interval_tree: add test case for interval_tree_iter_xxx() helpers Wei Yang
2025-03-10  7:49 ` [Patch v2 5/7] lib/interval_tree: add test case for span iteration Wei Yang
2025-03-10  7:49 ` [Patch v2 6/7] lib/interval_tree: skip the check before go to the right subtree Wei Yang
2025-03-10  7:49 ` [Patch v2 7/7] lib/interval_tree: fix the comment of interval_tree_span_iter_next_gap() Wei Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250310074938.26756-1-richard.weiyang@gmail.com \
    --to=richard.weiyang@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=michel@lespinasse.org \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox