// SPDX-License-Identifier: GPL-2.0 /* * KUnit test for the FPGA Bridge * * Copyright (C) 2023 Red Hat, Inc. * * Author: Marco Pagani <marpagan@redhat.com>
*/
/* * Wrapper to avoid a cast warning when passing the action function directly * to kunit_add_action().
*/
KUNIT_DEFINE_ACTION_WRAPPER(fpga_bridge_unregister_wrapper, fpga_bridge_unregister, struct fpga_bridge *);
/* * Fake FPGA bridge that implements only the enable_set op to track * the state.
*/ staticconststruct fpga_bridge_ops fake_bridge_ops = {
.enable_set = op_enable_set,
};
/** * register_test_bridge() - Register a fake FPGA bridge for testing. * @test: KUnit test context object. * @dev_name: name of the kunit device to be registered * * Return: Context of the newly registered FPGA bridge.
*/ staticstruct bridge_ctx *register_test_bridge(struct kunit *test, constchar *dev_name)
{ struct bridge_ctx *ctx; int ret;
ret = fpga_bridge_disable(ctx->bridge);
KUNIT_EXPECT_EQ(test, ret, 0);
KUNIT_EXPECT_FALSE(test, ctx->stats.enable);
ret = fpga_bridge_enable(ctx->bridge);
KUNIT_EXPECT_EQ(test, ret, 0);
KUNIT_EXPECT_TRUE(test, ctx->stats.enable);
}
/* Test the functions for getting and controlling a list of bridges */ staticvoid fpga_bridge_test_get_put_list(struct kunit *test)
{ struct list_head bridge_list; struct bridge_ctx *ctx_0, *ctx_1; int ret;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.