summaryrefslogtreecommitdiff
path: root/lib/efi_selftest
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2020-09-30 22:52:09 +0300
committerHeinrich Schuchardt <xypron.glpk@gmx.de>2020-10-06 08:43:56 +0300
commiteb0d1d83994a1e54d6720a6fc8eb1fd3ce2e56a9 (patch)
tree836a5bd336fc23b0f0496a1ad2f3b47c96bed2b6 /lib/efi_selftest
parentdc374ab08f7432933083ea9a95a90d7f29a8852e (diff)
downloadu-boot-eb0d1d83994a1e54d6720a6fc8eb1fd3ce2e56a9.tar.xz
efi_selftest: avoid unnecessary reset
When we do not execute a test requiring ExitBootServices do not reset the system after testing. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'lib/efi_selftest')
-rw-r--r--lib/efi_selftest/efi_selftest.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/efi_selftest/efi_selftest.c b/lib/efi_selftest/efi_selftest.c
index 165fa265f2..85e819bdfa 100644
--- a/lib/efi_selftest/efi_selftest.c
+++ b/lib/efi_selftest/efi_selftest.c
@@ -143,6 +143,27 @@ static int teardown(struct efi_unit_test *test, unsigned int *failures)
}
/*
+ * Check that a test requiring reset exists.
+ *
+ * @testname: name of the test
+ * @return: test, or NULL if not found
+ */
+static bool need_reset(const u16 *testname)
+{
+ struct efi_unit_test *test;
+
+ for (test = ll_entry_start(struct efi_unit_test, efi_unit_test);
+ test < ll_entry_end(struct efi_unit_test, efi_unit_test); ++test) {
+ if (testname && efi_st_strcmp_16_8(testname, test->name))
+ continue;
+ if (test->phase == EFI_SETUP_BEFORE_BOOTTIME_EXIT ||
+ test->phase == EFI_SETUP_AFTER_BOOTTIME_EXIT)
+ return true;
+ }
+ return false;
+}
+
+/*
* Check that a test exists.
*
* @testname: name of the test
@@ -290,6 +311,16 @@ efi_status_t EFIAPI efi_selftest(efi_handle_t image_handle,
EFI_ST_SETUP | EFI_ST_EXECUTE | EFI_ST_TEARDOWN,
&failures);
+ if (!need_reset(testname)) {
+ if (failures)
+ ret = EFI_PROTOCOL_ERROR;
+
+ /* Give feedback */
+ efi_st_printc(EFI_WHITE, "\nSummary: %u failures\n\n",
+ failures);
+ return ret;
+ }
+
/* Execute mixed tests */
efi_st_do_tests(testname, EFI_SETUP_BEFORE_BOOTTIME_EXIT,
EFI_ST_SETUP, &failures);