summaryrefslogtreecommitdiff
path: root/test-mock-variables.c
diff options
context:
space:
mode:
authorPeter Jones <pjones@redhat.com>2025-02-18 15:19:21 -0500
committerPeter Jones <pjones@redhat.com>2025-02-24 15:26:20 -0500
commitf0958baa7cc0fcce0de09323d89dda7bf23afec3 (patch)
tree508d8373ca29c9d26d62cb277a9bab5d1a57a0b9 /test-mock-variables.c
parente136e645d54983d2b5a89610d1565c23538ca1fa (diff)
downloadefi-boot-shim-f0958baa7cc0fcce0de09323d89dda7bf23afec3.tar.gz
efi-boot-shim-f0958baa7cc0fcce0de09323d89dda7bf23afec3.zip
test-mock-variables: improve some debug prints
This changes test-mock-variables and related code to not print all debug messages at SHIM_DEBUG=1, and also adds some prints and comments for context as to what's going on in the tests. Signed-off-by: Peter Jones <pjones@redhat.com>
Diffstat (limited to 'test-mock-variables.c')
-rw-r--r--test-mock-variables.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/test-mock-variables.c b/test-mock-variables.c
index c7e42b05..79e6628f 100644
--- a/test-mock-variables.c
+++ b/test-mock-variables.c
@@ -212,14 +212,23 @@ test_gnvn_helper(char *testvars)
mock_load_variables(testvars, mok_rt_vars, true);
+#if defined(SHIM_DEBUG) && SHIM_DEBUG != 0
+ dump_mock_variables(__FILE__, __LINE__, __func__);
+#endif
+
+ /*
+ * This tests the sort policy, filtering for only variables in the
+ * EFI "global" namespace. If ascending the first thing should
+ * be Boot0000, if descending it should be dbxDefault
+ */
+#if defined(SHIM_DEBUG) && SHIM_DEBUG >= 1
+ printf("Testing mock variable sorting in the global namespace\n");
+#endif
size = sizeof(buf);
buf[0] = L'\0';
status = RT->GetNextVariableName(&size, buf, &GV_GUID);
assert_equal_goto(status, EFI_SUCCESS, err, "0x%lx != 0x%lx\n");
-#if defined(SHIM_DEBUG) && SHIM_DEBUG != 0
- dump_mock_variables(__FILE__, __LINE__, __func__);
-#endif
switch (mock_variable_sort_policy) {
case MOCK_SORT_DESCENDING:
dump_mock_variables_if_wrong(__FILE__, __LINE__, __func__,
@@ -236,6 +245,14 @@ test_gnvn_helper(char *testvars)
break;
}
+ /*
+ * Do it again but test for only variables in the Secure Boot
+ * policy guid namespace. Ascending should be "db", descending
+ * "dbx".
+ */
+#if defined(SHIM_DEBUG) && SHIM_DEBUG >= 1
+ printf("Testing mock variable sorting in the Secure Boot GUID namespace\n");
+#endif
size = sizeof(buf);
buf[0] = 0;
status = RT->GetNextVariableName(&size, buf, &EFI_SECURE_BOOT_DB_GUID);