]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-gpt: verify that alias entries are identical to the primary ones
authorLennart Poettering <lennart@poettering.net>
Fri, 26 May 2023 14:55:29 +0000 (16:55 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 26 May 2023 17:21:17 +0000 (02:21 +0900)
Given we allow aliases we better check for consistency of alias entries
and the primary one.

src/test/test-gpt.c

index b8a54055c2b4e5ab65f3ed6c49e74300a18112ba..5ad30fab446a8db33b59fa93aec62ff9dd13ac00 100644 (file)
@@ -64,4 +64,21 @@ TEST(verity_mappings) {
         }
 }
 
+TEST(type_alias_same) {
+        /* Check that the partition type table is consistent, i.e. all aliases of the same partition type
+         * carry the same metadata */
+
+        for (const GptPartitionType *t = gpt_partition_type_table; t->name; t++) {
+                GptPartitionType x, y;
+
+                x = gpt_partition_type_from_uuid(t->uuid);                   /* search first by uuid */
+                assert_se(gpt_partition_type_from_string(t->name, &y) >= 0); /* search first by name */
+
+                assert_se(t->arch == x.arch);
+                assert_se(t->arch == y.arch);
+                assert_se(t->designator == x.designator);
+                assert_se(t->designator == y.designator);
+        }
+}
+
 DEFINE_TEST_MAIN(LOG_INFO);