From: Lennart Poettering Date: Fri, 26 May 2023 14:55:29 +0000 (+0200) Subject: test-gpt: verify that alias entries are identical to the primary ones X-Git-Tag: v254-rc1~364 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=719771adcaed3d2f66363dfb505350318143bfb1;p=thirdparty%2Fsystemd.git test-gpt: verify that alias entries are identical to the primary ones Given we allow aliases we better check for consistency of alias entries and the primary one. --- diff --git a/src/test/test-gpt.c b/src/test/test-gpt.c index b8a54055c2b..5ad30fab446 100644 --- a/src/test/test-gpt.c +++ b/src/test/test-gpt.c @@ -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);