public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Petr Vorel <pvorel@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 1/1] swapon01: Test on all filesystems
Date: Fri, 19 Jan 2024 16:06:03 +0100	[thread overview]
Message-ID: <ZaqP2_ZeyRM1YY0w@yuki> (raw)
In-Reply-To: <20240119144322.41928-1-pvorel@suse.cz>

Hi!
>  testcases/kernel/syscalls/swapon/swapon01.c | 21 +++++++++++++++------
>  1 file changed, 15 insertions(+), 6 deletions(-)
> 
> diff --git a/testcases/kernel/syscalls/swapon/swapon01.c b/testcases/kernel/syscalls/swapon/swapon01.c
> index e59fb20a1..ef4ebfdcf 100644
> --- a/testcases/kernel/syscalls/swapon/swapon01.c
> +++ b/testcases/kernel/syscalls/swapon/swapon01.c
> @@ -8,6 +8,7 @@
>   * [Description]
>   *
>   * Checks that swapon() succeds with swapfile.
> + * Testing on all filesystems which support swap file.
>   */
>  
>  #include <unistd.h>
> @@ -17,13 +18,14 @@
>  #include "lapi/syscalls.h"
>  #include "libswap.h"
>  
> -#define SWAP_FILE "swapfile01"
> +#define MNTPOINT	"mntpoint"
> +#define SWAP_FILE	MNTPOINT"/swapfile01"
>  
>  static void verify_swapon(void)
>  {
>  	TST_EXP_PASS(tst_syscall(__NR_swapon, SWAP_FILE, 0));
>  
> -	if (TST_PASS && tst_syscall(__NR_swapoff, SWAP_FILE) != 0) {
> +	if (tst_syscall(__NR_swapoff, SWAP_FILE) != 0) {

I do not think that this should be removed, if the swapon() call fails
we still do not want TBROK here.

>  		tst_brk(TBROK | TERRNO,
>  				"Failed to turn off swapfile, system reboot recommended");
>  	}
> @@ -31,13 +33,20 @@ static void verify_swapon(void)
>  
>  static void setup(void)
>  {
> -	is_swap_supported(SWAP_FILE);
>  	make_swapfile(SWAP_FILE, 0);
>  }
>  
>  static struct tst_test test = {
> -	.needs_root = 1,
> -	.needs_tmpdir = 1,
> +	.mntpoint = MNTPOINT,
> +	.mount_device = 1,
> +	.needs_root = 1, /* for swapon() */

Can we please avoid comments like this?

I'ts pretty clear that if you are working with devices and setting up
swapfiles it's priviledged operation...

> +	.all_filesystems = 1,
>  	.test_all = verify_swapon,
> -	.setup = setup
> +	.setup = setup,
> +	.skip_filesystems = (const char *[]) {
> +		"bcachefs",
> +		"btrfs",
> +		"tmpfs",

So the rest of the filesystems work fine? If so this change looks fine
to me.

> +		NULL
> +	},
>  };


-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2024-01-19 15:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-19 14:43 [LTP] [PATCH 1/1] swapon01: Test on all filesystems Petr Vorel
2024-01-19 15:06 ` Cyril Hrubis [this message]
2024-01-22  6:22   ` Petr Vorel
2024-01-22  7:39     ` Li Wang
2024-01-20  4:21 ` Li Wang
2024-01-20  4:34   ` [LTP] [PATCH 1/2] libswap: add known swap supported fs check Li Wang
2024-01-20  4:34     ` [LTP] [PATCH 2/2] swapon01: Test on all filesystems Li Wang
2024-01-20  6:40       ` [LTP] [PATCH] swapon01: Improving test with memory limits and swap reporting Li Wang
2024-01-20  6:52         ` Li Wang
2024-01-20  8:27       ` [LTP] [PATCH] libswap: add Btrfs noCOW attribute setting for swap files Li Wang
2024-01-22  7:13         ` Petr Vorel
2024-01-22  7:28           ` Li Wang
2024-01-22  6:26   ` [LTP] [PATCH 1/1] swapon01: Test on all filesystems Petr Vorel
2024-01-22  7:50     ` Li Wang
2024-01-22  8:24       ` Petr Vorel

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=ZaqP2_ZeyRM1YY0w@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