Skip to content

Commit

Permalink
tst_test: Fix test using a device without .filesystems
Browse files Browse the repository at this point in the history
cce6188 introduced a regression for tests which use the test loop
device (e.g. .mount_device = 1 or .format_device = 1) without
.filesystems array (execveat03, ioctl04, inotify0[378], fanotify10,
mount02, umount0[1-3], umount2_02).

Call in that case prepare_device() with the default filesystem type.

Fixes: cce6188 ("lib: tst_test: Add per filesystem mkfs and mount opts")
Signed-off-by: Cyril Hrubis <[email protected]>
Signed-off-by: Petr Vorel <[email protected]>
Reviewed-by: Petr Vorel <[email protected]>
Tested-by: Petr Vorel <[email protected]>
  • Loading branch information
metan-ucw committed Jul 9, 2024
1 parent b2439e5 commit 6667816
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/tst_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -1101,6 +1101,9 @@ static void prepare_device(struct tst_fs *fs)
{
const char *mnt_data;
char buf[1024];
struct tst_fs dummy = {};

fs = fs ?: &dummy;

const char *const extra[] = {fs->mkfs_size_opt, NULL};

Expand Down Expand Up @@ -1355,8 +1358,8 @@ static void do_setup(int argc, char *argv[])

tdev.fs_type = default_fs_type();

if (!tst_test->all_filesystems && count_fs_descs() == 1)
prepare_device(&tst_test->filesystems[0]);
if (!tst_test->all_filesystems && count_fs_descs() <= 1)
prepare_device(tst_test->filesystems);
}

if (tst_test->needs_overlay && !tst_test->mount_device)
Expand Down

0 comments on commit 6667816

Please sign in to comment.