linux/lib/memcpy_kunit.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Test cases for memcpy(), memmove(), and memset().
 */
#define pr_fmt(fmt)

#include <kunit/test.h>
#include <linux/device.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/overflow.h>
#include <linux/slab.h>
#include <linux/types.h>
#include <linux/vmalloc.h>

struct some_bytes {};

#define check(instance, v)

#define compare(name, one, two)

static void memcpy_test(struct kunit *test)
{}

static unsigned char larger_array [2048];

static void memmove_test(struct kunit *test)
{}

static void memset_test(struct kunit *test)
{}

static u8 large_src[1024];
static u8 large_dst[2048];
static const u8 large_zero[2048];

static void set_random_nonzero(struct kunit *test, u8 *byte)
{}

static void init_large(struct kunit *test)
{}

/*
 * Instead of an indirect function call for "copy" or a giant macro,
 * use a bool to pick memcpy or memmove.
 */
static void copy_large_test(struct kunit *test, bool use_memmove)
{}

static void memcpy_large_test(struct kunit *test)
{}

static void memmove_large_test(struct kunit *test)
{}

/*
 * On the assumption that boundary conditions are going to be the most
 * sensitive, instead of taking a full step (inc) each iteration,
 * take single index steps for at least the first "inc"-many indexes
 * from the "start" and at least the last "inc"-many indexes before
 * the "end". When in the middle, take full "inc"-wide steps. For
 * example, calling next_step(idx, 1, 15, 3) with idx starting at 0
 * would see the following pattern: 1 2 3 4 7 10 11 12 13 14 15.
 */
static int next_step(int idx, int start, int end, int inc)
{}

static void inner_loop(struct kunit *test, int bytes, int d_off, int s_off)
{}

static void memmove_overlap_test(struct kunit *test)
{}

static struct kunit_case memcpy_test_cases[] =;

static struct kunit_suite memcpy_test_suite =;

kunit_test_suite();

MODULE_DESCRIPTION();
MODULE_LICENSE();