#include <kunit/test.h>
#include <linux/ioport.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/sizes.h>
#include <linux/mm.h>
#define R0_START …
#define R0_END …
#define R1_START …
#define R1_END …
#define R2_START …
#define R2_END …
#define R3_START …
#define R3_END …
#define R4_START …
#define R4_END …
static struct resource r0 = …;
static struct resource r1 = …;
static struct resource r2 = …;
static struct resource r3 = …;
static struct resource r4 = …;
struct result { … };
static struct result results_for_union[] = …;
static struct result results_for_intersection[] = …;
static void resource_do_test(struct kunit *test, bool ret, struct resource *r,
bool exp_ret, struct resource *exp_r,
struct resource *r1, struct resource *r2)
{ … }
static void resource_do_union_test(struct kunit *test, struct result *r)
{ … }
static void resource_test_union(struct kunit *test)
{ … }
static void resource_do_intersection_test(struct kunit *test, struct result *r)
{ … }
static void resource_test_intersection(struct kunit *test)
{ … }
#define RES_TEST_RAM0_OFFSET …
#define RES_TEST_RAM0_SIZE …
#define RES_TEST_HOLE0_OFFSET …
#define RES_TEST_HOLE0_SIZE …
#define RES_TEST_WIN0_OFFSET …
#define RES_TEST_WIN0_SIZE …
#define RES_TEST_RAM1_OFFSET …
#define RES_TEST_RAM1_SIZE …
#define RES_TEST_WIN1_OFFSET …
#define RES_TEST_WIN1_SIZE …
#define RES_TEST_RAM2_OFFSET …
#define RES_TEST_RAM2_SIZE …
#define RES_TEST_CODE_OFFSET …
#define RES_TEST_CODE_SIZE …
#define RES_TEST_RAM3_OFFSET …
#define RES_TEST_RAM3_SIZE …
#define RES_TEST_TOTAL_SIZE …
KUNIT_DEFINE_ACTION_WRAPPER(kfree_wrapper, kfree, const void *);
static void remove_free_resource(void *ctx)
{ … }
static void resource_test_add_action_or_abort(
struct kunit *test, void (*action)(void *), void *ctx)
{ … }
static void resource_test_request_region(struct kunit *test, struct resource *parent,
resource_size_t start, resource_size_t size,
const char *name, unsigned long flags)
{ … }
static void resource_test_insert_resource(struct kunit *test, struct resource *parent,
resource_size_t start, resource_size_t size,
const char *name, unsigned long flags)
{ … }
static void resource_test_region_intersects(struct kunit *test)
{ … }
static struct kunit_case resource_test_cases[] = …;
static struct kunit_suite resource_test_suite = …;
kunit_test_suite(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;