]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-loop-block: tighten tests a bit - check fstype, too
authorLennart Poettering <lennart@poettering.net>
Thu, 1 Dec 2022 16:15:10 +0000 (17:15 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 1 Dec 2022 21:07:36 +0000 (22:07 +0100)
Let's verify that we properly created the file systems once we did so.
And tets this way that our dissector works correctly.

src/test/test-loop-block.c

index af2a9683a4319b0a3a8f85cd107478e5119531bd..200cf2ba0331cf59c14d20f53da3e9df97a6bf40 100644 (file)
@@ -44,6 +44,15 @@ static void verify_dissected_image(DissectedImage *dissected) {
         assert_se(dissected->partitions[PARTITION_HOME].node);
 }
 
+static void verify_dissected_image_harder(DissectedImage *dissected) {
+        verify_dissected_image(dissected);
+
+        assert_se(streq(dissected->partitions[PARTITION_ESP].fstype, "vfat"));
+        assert_se(streq(dissected->partitions[PARTITION_XBOOTLDR].fstype, "vfat"));
+        assert_se(streq(dissected->partitions[PARTITION_ROOT].fstype, "ext4"));
+        assert_se(streq(dissected->partitions[PARTITION_HOME].fstype, "ext4"));
+}
+
 static void* thread_func(void *ptr) {
         int fd = PTR_TO_FD(ptr);
         int r;
@@ -247,7 +256,7 @@ static int run(int argc, char *argv[]) {
 
         dissected = dissected_image_unref(dissected);
         assert_se(dissect_loop_device(loop, NULL, NULL, DISSECT_IMAGE_ADD_PARTITION_DEVICES|DISSECT_IMAGE_PIN_PARTITION_DEVICES, &dissected) >= 0);
-        verify_dissected_image(dissected);
+        verify_dissected_image_harder(dissected);
 
         assert_se(mkdtemp_malloc(NULL, &mounted) >= 0);