aboutsummaryrefslogtreecommitdiffstats
path: root/roms/skiboot/libstb/test/run-stb-container.c
diff options
context:
space:
mode:
Diffstat (limited to 'roms/skiboot/libstb/test/run-stb-container.c')
-rw-r--r--roms/skiboot/libstb/test/run-stb-container.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/roms/skiboot/libstb/test/run-stb-container.c b/roms/skiboot/libstb/test/run-stb-container.c
new file mode 100644
index 000000000..2f078759a
--- /dev/null
+++ b/roms/skiboot/libstb/test/run-stb-container.c
@@ -0,0 +1,21 @@
+// SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
+/* Copyright 2016 IBM Corp. */
+
+#include <config.h>
+
+#include "../container.c"
+
+#include <assert.h>
+
+int main(void)
+{
+ ROM_container_raw *c = malloc(SECURE_BOOT_HEADERS_SIZE);
+ assert(stb_is_container(NULL, 0) == false);
+ assert(stb_is_container(NULL, SECURE_BOOT_HEADERS_SIZE) == false);
+ c->magic_number = cpu_to_be32(ROM_MAGIC_NUMBER + 1);
+ assert(stb_is_container(c, SECURE_BOOT_HEADERS_SIZE) == false);
+ c->magic_number = cpu_to_be32(ROM_MAGIC_NUMBER);
+ assert(stb_is_container(c, SECURE_BOOT_HEADERS_SIZE) == true);
+
+ return 0;
+}