summaryrefslogtreecommitdiffstats
path: root/src/shared
diff options
context:
space:
mode:
authoranonymix007 <48598263+anonymix007@users.noreply.github.com>2024-11-06 21:06:32 +0100
committeranonymix007 <48598263+anonymix007@users.noreply.github.com>2024-11-07 22:53:22 +0100
commitab7c319268e83c4fdc117cb550bf5f2ace55aad3 (patch)
tree1e18b70ede91dbbbc13a63057435bf5d4970b02c /src/shared
parentfundamental: Add userspace efi_guid_equal (diff)
downloadsystemd-ab7c319268e83c4fdc117cb550bf5f2ace55aad3.tar.xz
systemd-ab7c319268e83c4fdc117cb550bf5f2ace55aad3.zip
test: Add chid-fundamental test
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/tests.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/shared/tests.h b/src/shared/tests.h
index a7c2600d38..8caf4d9d83 100644
--- a/src/shared/tests.h
+++ b/src/shared/tests.h
@@ -559,3 +559,22 @@ static inline int run_test_table(void) {
abort(); \
} \
})
+
+#define EFI_GUID_Fmt "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x"
+#define EFI_GUID_Arg(guid) (guid).Data1, (guid).Data2, (guid).Data3, \
+ (guid).Data4[0], (guid).Data4[1], (guid).Data4[2], (guid).Data4[3], \
+ (guid).Data4[4], (guid).Data4[5], (guid).Data4[6], (guid).Data4[7] \
+
+#define ASSERT_EQ_EFI_GUID(expr1, expr2) \
+ ({ \
+ typeof(expr1) _expr1 = (expr1); \
+ typeof(expr2) _expr2 = (expr2); \
+ if (!efi_guid_equal(_expr1, _expr2)) { \
+ log_error("%s:%i: Assertion failed: expected \"%s == %s\", but " EFI_GUID_Fmt \
+ " != " EFI_GUID_Fmt, \
+ PROJECT_FILE, __LINE__, \
+ #expr1, #expr2, \
+ EFI_GUID_Arg(*_expr1), EFI_GUID_Arg(*_expr2)); \
+ abort(); \
+ } \
+ })