From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 6/6] efi_selftest: add HII database protocols test
Date: Fri, 2 Nov 2018 09:55:14 +0900 [thread overview]
Message-ID: <20181102005513.GQ11663@linaro.org> (raw)
In-Reply-To: <746f368e-53f1-ed8e-3fa7-94f17121e742@gmx.de>
On Thu, Nov 01, 2018 at 08:33:09AM +0100, Heinrich Schuchardt wrote:
> On 11/01/2018 05:47 AM, AKASHI Takahiro wrote:
> > This efi_selftest tests HII database protocol and HII string protocol.
> >
> > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> > ---
> > lib/efi_selftest/Makefile | 1 +
> > lib/efi_selftest/efi_selftest_hii.c | 882 +++++++++++++++++++++++
> > lib/efi_selftest/efi_selftest_hii_data.c | 450 ++++++++++++
> > 3 files changed, 1333 insertions(+)
> > create mode 100644 lib/efi_selftest/efi_selftest_hii.c
> > create mode 100644 lib/efi_selftest/efi_selftest_hii_data.c
> >
> > diff --git a/lib/efi_selftest/Makefile b/lib/efi_selftest/Makefile
> > index 4b1c0bb84b18..1209b54b07cd 100644
> > --- a/lib/efi_selftest/Makefile
> > +++ b/lib/efi_selftest/Makefile
> > @@ -25,6 +25,7 @@ efi_selftest_exception.o \
> > efi_selftest_exitbootservices.o \
> > efi_selftest_fdt.o \
> > efi_selftest_gop.o \
> > +efi_selftest_hii.o \
> > efi_selftest_loaded_image.o \
> > efi_selftest_manageprotocols.o \
> > efi_selftest_rtc.o \
> > diff --git a/lib/efi_selftest/efi_selftest_hii.c b/lib/efi_selftest/efi_selftest_hii.c
> > new file mode 100644
> > index 000000000000..2d5fe095a9b2
> > --- /dev/null
> > +++ b/lib/efi_selftest/efi_selftest_hii.c
> > @@ -0,0 +1,882 @@
> > +// SPDX-License-Identifier: GPL-2.0+
> > +/*
> > + * efi_selftest_hii
> > + *
> > + * Copyright (c) 2018 AKASHI Takahiro, Linaro Limited
> > + *
> > + * Test HII database protocols
> > + */
> > +
> > +#include <efi_selftest.h>
> > +#include <malloc.h>
> > +#include "efi_selftest_hii_data.c"
> > +
> > +#define PRINT_TESTNAME efi_st_printf("%s:\n", __func__)
> > +
> > +static struct efi_boot_services *boottime;
> > +
> > +static const efi_guid_t hii_database_protocol_guid =
> > + EFI_HII_DATABASE_PROTOCOL_GUID;
> > +static const efi_guid_t hii_string_protocol_guid =
> > + EFI_HII_STRING_PROTOCOL_GUID;
> > +
> > +static struct efi_hii_database_protocol *hii_database_protocol;
> > +static struct efi_hii_string_protocol *hii_string_protocol;
> > +
> > +/*
> > + * Setup unit test.
> > + *
> > + * @handle: handle of the loaded image
> > + * @systable: system table
> > + *
> > + * @return: EFI_ST_SUCCESS for success
> > + */
> > +static int setup(const efi_handle_t handle,
> > + const struct efi_system_table *systable)
> > +{
> > + efi_status_t ret;
> > +
> > + boottime = systable->boottime;
> > +
> > + /* HII database protocol */
> > + ret = boottime->locate_protocol(&hii_database_protocol_guid, NULL,
> > + (void **)&hii_database_protocol);
> > + if (ret != EFI_SUCCESS) {
> > + hii_database_protocol = NULL;
> > + efi_st_error("HII database protocol is not available.\n");
> > + return EFI_ST_FAILURE;
> > + }
> > +
> > + /* HII string protocol */
> > + ret = boottime->locate_protocol(&hii_string_protocol_guid, NULL,
> > + (void **)&hii_string_protocol);
> > + if (ret != EFI_SUCCESS) {
> > + hii_string_protocol = NULL;
> > + efi_st_error("HII string protocol is not available.\n");
> > + return EFI_ST_FAILURE;
> > + }
> > +
> > + return EFI_ST_SUCCESS;
> > +}
> > +
> > +/*
> > + * HII database protocol Tests
>
> Thanks a lot for providing unit tests for the protocols.
>
> %s/Tests/tests/
Fixed.
> > + */
> > +
>
> Please, add a comment to each test describing what it is doing, e.g.
OK, but it's a quite painful task.
> /**
> * test_hii_database_new_package_list() - test creation and removal of
> package lists
> *
> * This test adds a new package list and then tries to remove it using
> the provided handle.
> *
> * @Return: status code
> */
>
> > +static int test_hii_database_new_package_list(void)
> > +{
> > + efi_hii_handle_t handle;
> > + efi_status_t ret;
> > +
> > + PRINT_TESTNAME;
> > + ret = hii_database_protocol->new_package_list(hii_database_protocol,
> > + (struct efi_hii_package_list_header *)packagelist1,
> > + NULL, &handle);
> > + if (ret != EFI_SUCCESS || !handle) {
> > + efi_st_error("new_package_list returned %u\n", (int)ret);
>
> %s/int/unsigned int/
>
> > + return EFI_ST_FAILURE;
> > + }
> > +
> > + ret = hii_database_protocol->remove_package_list(hii_database_protocol,
> > + handle);
> > + if (ret != EFI_SUCCESS) {
> > + efi_st_error("remove_package_list returned %u\n", (int)ret);
>
> %s/int/unsigned int/
>
> Same change needed all over the file.
OK, but the root issue is that efi_st_printf/error() doesn't support
'l' specifier in "%lx" format.
-Takahiro Akashi
> Best regards
>
> Heinrich
next prev parent reply other threads:[~2018-11-02 0:55 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-01 4:40 [U-Boot] [PATCH 0/6] efi_loader: add HII database protocol AKASHI Takahiro
2018-11-01 4:45 ` [U-Boot] [PATCH 1/6] lib: add u16_strcpy/strdup functions AKASHI Takahiro
2018-11-01 6:10 ` Heinrich Schuchardt
2018-11-02 0:12 ` AKASHI Takahiro
2018-11-01 4:47 ` [U-Boot] [PATCH 2/6] efi_loader: Initial HII database protocols AKASHI Takahiro
2018-11-01 4:47 ` [U-Boot] [PATCH 3/6] efi: hii: add guid package support AKASHI Takahiro
2018-11-01 4:47 ` [U-Boot] [PATCH 4/6] efi: hii: add keyboard layout " AKASHI Takahiro
2018-11-01 4:47 ` [U-Boot] [PATCH 5/6] efi: hii: add HII config routing/access protocols AKASHI Takahiro
2018-11-01 4:47 ` [U-Boot] [PATCH 6/6] efi_selftest: add HII database protocols test AKASHI Takahiro
2018-11-01 7:33 ` Heinrich Schuchardt
2018-11-02 0:55 ` AKASHI Takahiro [this message]
2018-11-02 8:12 ` Heinrich Schuchardt
2018-11-01 7:09 ` [U-Boot] [PATCH 2/6] efi_loader: Initial HII database protocols Heinrich Schuchardt
2018-11-02 2:03 ` AKASHI Takahiro
2018-11-01 7:39 ` Heinrich Schuchardt
2018-11-02 0:32 ` AKASHI Takahiro
2018-11-02 8:15 ` Heinrich Schuchardt
2018-11-01 8:42 ` Heinrich Schuchardt
2018-11-02 0:17 ` AKASHI Takahiro
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181102005513.GQ11663@linaro.org \
--to=takahiro.akashi@linaro.org \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox