summaryrefslogtreecommitdiff
path: root/src/test/test-loop-block.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2022-12-01 17:16:18 +0100
committerLennart Poettering <lennart@poettering.net>2022-12-01 22:07:36 +0100
commit9f2d9a4aaba63d3b93d72e776413c8ed5c86e3fb (patch)
tree539c7eede69d0720d836370baed40e9fee779a12 /src/test/test-loop-block.c
parent02c15120a17b18c4af49d62086374622431d8cf4 (diff)
downloadsystemd-9f2d9a4aaba63d3b93d72e776413c8ed5c86e3fb.tar.gz
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)
Diffstat (limited to 'src/test/test-loop-block.c')
-rw-r--r--src/test/test-loop-block.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/test/test-loop-block.c b/src/test/test-loop-block.c
index 200cf2ba03..01db8b092e 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);