summaryrefslogtreecommitdiff
path: root/lib/tests/test_bits.c
AgeCommit message (Collapse)Author
3 daystest_bits: add tests for __GENMASK() and __GENMASK_ULL()Vincent Mailhol
The definitions of GENMASK() and GENMASK_ULL() do not depend any more on __GENMASK() and __GENMASK_ULL(). Duplicate the existing unit tests so that __GENMASK{,ULL}() are still covered. Because __GENMASK() and __GENMASK_ULL() do use GENMASK_INPUT_CHECK(), drop the TEST_GENMASK_FAILURES negative tests. It would be good to have a small assembly test case for GENMASK*() in case somebody decides to unify both in the future. However, I lack expertise in assembly to do so. Instead add a FIXME message to highlight the absence of the asm unit test. Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr> Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com> Signed-off-by: Yury Norov (NVIDIA) <yury.norov@gmail.com>
2025-04-29test_bits: add tests for BIT_U*()Vincent Mailhol
Add some additional tests in lib/tests/test_bits.c to cover the expected results of the fixed type BIT_U*() macros. Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr> Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Yury Norov <yury.norov@gmail.com>
2025-04-29test_bits: add tests for GENMASK_U*()Lucas De Marchi
Add some additional tests in lib/tests/test_bits.c to cover the expected/non-expected values of the fixed-type GENMASK_U*() macros. Also check that the result value matches the expected type. Since those are known at build time, use static_assert() instead of normal kunit tests. Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com> Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Yury Norov <yury.norov@gmail.com>
2025-02-10lib: Move KUnit tests into tests/ subdirectoryKees Cook
Following from the recent KUnit file naming discussion[1], move all KUnit tests in lib/ into lib/tests/. Link: https://lore.kernel.org/lkml/20240720165441.it.320-kees@kernel.org/ [1] Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org> Acked-by: Jakub Kicinski <kuba@kernel.org> Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Reviewed-by: David Gow <davidgow@google.com> Acked-by: Vlastimil Babka <vbabka@suse.cz> Reviewed-by: Rae Moar <rmoar@google.com> Link: https://lore.kernel.org/r/20241202075545.3648096-4-davidgow@google.com Signed-off-by: Kees Cook <kees@kernel.org>