mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
synced 2025-08-27 15:36:48 +00:00

Extract a private header and convert the prime_numbers self-test to a KUnit test. I considered parameterizing the test using `KUNIT_CASE_PARAM` but didn't see how it was possible since the test logic is entangled with the test parameter generation logic. Signed-off-by: Tamir Duberstein <tamird@gmail.com> Link: https://lore.kernel.org/r/20250208-prime_numbers-kunit-convert-v5-2-b0cb82ae7c7d@gmail.com Signed-off-by: Kees Cook <kees@kernel.org>
17 lines
359 B
C
17 lines
359 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
#include <linux/types.h>
|
|
|
|
struct primes {
|
|
struct rcu_head rcu;
|
|
unsigned long last, sz;
|
|
unsigned long primes[];
|
|
};
|
|
|
|
#if IS_ENABLED(CONFIG_PRIME_NUMBERS_KUNIT_TEST)
|
|
typedef void (*primes_fn)(void *, const struct primes *);
|
|
|
|
void with_primes(void *ctx, primes_fn fn);
|
|
bool slow_is_prime_number(unsigned long x);
|
|
#endif
|