From 20b23f049f869cc696f5a6d318fa00a61196a209 Mon Sep 17 00:00:00 2001
From: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Date: Sun, 3 Nov 2024 21:46:42 +0100
Subject: [PATCH] test: print_printf() must check availability of %ls

Availability of %ls in printf() depends on having
CONFIG_EFI_LOADER or CONFIG_EFI_APP.

Respect this when testing.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
---
 test/common/print.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/test/common/print.c b/test/common/print.c
index f1eb9072d9..464e425ede 100644
--- a/test/common/print.c
+++ b/test/common/print.c
@@ -115,8 +115,10 @@ static int print_printf(struct unit_test_state *uts)
 	snprintf(str, 0, "testing none");
 	ut_asserteq('x', *str);
 
-	sprintf(big_str, "_%ls_", u"foo");
-	ut_assertok(strcmp("_foo_", big_str));
+	if (CONFIG_IS_ENABLED(EFI_LOADER) || IS_ENABLED(CONFIG_EFI_APP)) {
+		sprintf(big_str, "_%ls_", u"foo");
+		ut_assertok(strcmp("_foo_", big_str));
+	}
 
 	/* Test the banner function */
 	s = display_options_get_banner(true, str, sizeof(str));
-- 
2.39.5