u-boot/lib/efi_selftest/efi_selftest_util.c
Heinrich Schuchardt d78e40d651 efi_selftest: allow to select a single test for execution
Environment variable efi_selftest is passed as load options
to the selftest application. It is used to select a single
test to be executed.

The load options are an UTF8 string. Yet I decided to keep
the name propertiy of the tests as char[] to reduce code
size.

Special value 'list' displays a list of all available tests.

Tests get an on_request property. If this property is set
the tests are only executed if explicitly requested.

The invocation of efi_selftest is changed to reflect that
bootefi selftest with efi_selftest = 'list' will call the
Exit bootservice.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2017-12-01 13:22:55 +01:00

34 lines
583 B
C

/*
* efi_selftest_util
*
* Copyright (c) 2017 Heinrich Schuchardt <xypron.glpk@gmx.de>
*
* SPDX-License-Identifier: GPL-2.0+
*
* Utility functions
*/
#include <efi_selftest.h>
int efi_st_memcmp(const void *buf1, const void *buf2, size_t length)
{
const u8 *pos1 = buf1;
const u8 *pos2 = buf2;
for (; length; --length) {
if (*pos1 != *pos2)
return *pos1 - *pos2;
++pos1;
++pos2;
}
return 0;
}
int efi_st_strcmp_16_8(const u16 *buf1, const char *buf2)
{
for (; *buf1 || *buf2; ++buf1, ++buf2) {
if (*buf1 != *buf2)
return *buf1 - *buf2;
}
return 0;
}