From: Lennart Poettering Date: Thu, 1 Dec 2022 16:16:18 +0000 (+0100) Subject: test-loop-block: also test dissection without ADD/PIN of partition block devices X-Git-Tag: v253-rc1~394^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9f2d9a4aaba63d3b93d72e776413c8ed5c86e3fb;p=thirdparty%2Fsystemd.git test-loop-block: also test dissection without ADD/PIN of partition block devices Let's extend the test further, and try the codepaths where we do not pin/add the partition block devices (i.e. which is the codepaths we use when running without privs) --- diff --git a/src/test/test-loop-block.c b/src/test/test-loop-block.c index 200cf2ba033..01db8b092ec 100644 --- a/src/test/test-loop-block.c +++ b/src/test/test-loop-block.c @@ -255,6 +255,14 @@ static int run(int argc, char *argv[]) { assert_se(make_filesystem(dissected->partitions[PARTITION_HOME].node, "ext4", "home", NULL, id, true) >= 0); dissected = dissected_image_unref(dissected); + + /* Try to read once, without pinning or adding partitions, i.e. by only accessing the whole block + * device. */ + assert_se(dissect_loop_device(loop, NULL, NULL, 0, &dissected) >= 0); + verify_dissected_image_harder(dissected); + dissected = dissected_image_unref(dissected); + + /* Now go via the loopback device after all, but this time add/pin, because now we want to mount it. */ assert_se(dissect_loop_device(loop, NULL, NULL, DISSECT_IMAGE_ADD_PARTITION_DEVICES|DISSECT_IMAGE_PIN_PARTITION_DEVICES, &dissected) >= 0); verify_dissected_image_harder(dissected);