From: Cyril Hrubis <chrubis@suse.cz>
To: Petr Vorel <pvorel@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 1/1] tst_test: Fix tests using device without .filesystems
Date: Tue, 9 Jul 2024 13:05:45 +0200 [thread overview]
Message-ID: <Zo0ZiWT01NFENPaz@yuki> (raw)
In-Reply-To: <20240709103324.183993-1-pvorel@suse.cz>
Hi!
> diff --git a/lib/tst_test.c b/lib/tst_test.c
> index b49c248ae..6d258cd28 100644
> --- a/lib/tst_test.c
> +++ b/lib/tst_test.c
> @@ -1355,8 +1355,11 @@ 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 ?
> + &tst_test->filesystems[0] :
> + &(struct tst_fs){.type = tdev.fs_type});
Another option would be to change prepare_device() so that it works fine
with NULL tst_fs pointer, then we could simply do:
prepare_device(tst_test->filesystems);
And for that we would have to do something like this:
diff --git a/lib/tst_test.c b/lib/tst_test.c
index b49c248ae..ec6deea9b 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -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 : fs;
const char *const extra[] = {fs->mkfs_size_opt, NULL};
> + }
> }
>
> if (tst_test->needs_overlay && !tst_test->mount_device)
> --
> 2.45.2
>
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2024-07-09 11:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-09 10:33 [LTP] [PATCH 1/1] tst_test: Fix tests using device without .filesystems Petr Vorel
2024-07-09 11:05 ` Cyril Hrubis [this message]
2024-07-09 11:18 ` Petr Vorel
2024-07-09 11:35 ` Cyril Hrubis
2024-07-09 11:56 ` Petr Vorel
2024-07-09 12:44 ` Cyril Hrubis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zo0ZiWT01NFENPaz@yuki \
--to=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
--cc=pvorel@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox