// SPDX-License-Identifier: GPL-2.0 /* * KUnit test for the FPGA Manager * * Copyright (C) 2023 Red Hat, Inc. * * Author: Marco Pagani <marpagan@redhat.com>
*/
/** * init_test_buffer() - Allocate and initialize a test image in a buffer. * @test: KUnit test context object. * @count: image size in bytes. * * Return: pointer to the newly allocated image.
*/ staticchar *init_test_buffer(struct kunit *test, size_t count)
{ char *buf;
/* * Check the image header. Do not return an error code if the image check fails * since, in this case, it is a failure of the FPGA manager itself, not this * op that tests it.
*/ staticint op_parse_header(struct fpga_manager *mgr, struct fpga_image_info *info, constchar *buf, size_t count)
{ struct mgr_stats *stats = mgr->priv;
size_t i;
/* * Check the image data. As with op_parse_header, do not return an error code * if the image check fails.
*/ staticint op_write(struct fpga_manager *mgr, constchar *buf, size_t count)
{ struct mgr_stats *stats = mgr->priv;
size_t i;
stats->image_match = true; for (i = 0; i < count; i++) { if (buf[i] != IMAGE_FILL) {
stats->image_match = false; break;
}
}
return 0;
}
/* * Check the image data, but first skip the header since write_sg will get * the whole image in sg_table. As with op_parse_header, do not return an * error code if the image check fails.
*/ staticint op_write_sg(struct fpga_manager *mgr, struct sg_table *sgt)
{ struct mgr_stats *stats = mgr->priv; struct sg_mapping_iter miter; char *img;
size_t i;
ret = fpga_mgr_lock(ctx->mgr);
KUNIT_EXPECT_EQ(test, ret, 0);
ret = fpga_mgr_lock(ctx->mgr);
KUNIT_EXPECT_EQ(test, ret, -EBUSY);
fpga_mgr_unlock(ctx->mgr);
}
/* Check the programming sequence using an image in a buffer */ staticvoid fpga_mgr_test_img_load_buf(struct kunit *test)
{ struct mgr_ctx *ctx = test->priv; char *img_buf; int ret;
MODULE_DESCRIPTION("KUnit test for the FPGA Manager");
MODULE_LICENSE("GPL");
Messung V0.5
¤ 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.0.22Bemerkung:
(vorverarbeitet)
¤
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.