Linux Test Project
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Andrea Cervesato <andrea.cervesato@suse.de>
Cc: Linux Test Project <ltp@lists.linux.it>
Subject: Re: [LTP] [PATCH v3 3/3] swapon02: Add test cases for invalid swapflags
Date: Thu, 3 Sep 2026 13:32:48 +0200	[thread overview]
Message-ID: <apla4DklqK8990v6@yuki.lan> (raw)
In-Reply-To: <20260828-swapon_discard_coverage-v3-3-136924a1a730@suse.com>

Hi!
>  static void setup(void)
> @@ -66,20 +96,20 @@ static void cleanup(void)
>  
>  static void verify_swapon(unsigned int i)
>  {
> -	struct tcase *tc = tcases + i;
> +	struct tcase *tc = &tcases[i];
> +
>  	if (tc->exp_errno == EPERM)
>  		SAFE_SETEUID(nobody_uid);
>  
> -	TST_EXP_FAIL(tst_syscall(__NR_swapon, tc->path, 0), tc->exp_errno,
> +	TST_EXP_FAIL(tst_syscall(__NR_swapon, tc->path, tc->flags), tc->exp_errno,
>  		     "swapon(2) fail with %s", tc->err_desc);
>  
>  	if (tc->exp_errno == EPERM)
>  		SAFE_SETEUID(0);
>  
> -	if (TST_RET != -1) {
> -		tst_res(TFAIL, "swapon(2) failed unexpectedly, expected: %s",
> -			tst_strerrno(tc->exp_errno));
> -	}
> +	/* If swapon() unexpectedly succeeded, undo it for the next iteration */

This probably falls into commenting the obvious.

> +	if (TST_RET == 0 && tst_syscall(__NR_swapoff, tc->path) != 0)
> +		tst_res(TWARN | TTERRNO, "swapoff(%s) failed", tc->path);
>  }
                                 ^
				 TERRNO

-- 
Cyril Hrubis
chrubis@suse.cz

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

      reply	other threads:[~2026-09-03 11:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-28 11:10 [LTP] [PATCH v3 0/3] Increase coverage for swapon syscall Andrea Cervesato
2026-08-28 11:10 ` [LTP] [PATCH v3 1/3] tse_swap: Add fallback definitions for swapon Andrea Cervesato
2026-08-28 11:30   ` [LTP] " linuxtestproject.agent
2026-08-28 11:10 ` [LTP] [PATCH v3 2/3] swapon04: Add test for discard flags Andrea Cervesato
2026-09-03 11:18   ` Cyril Hrubis
2026-08-28 11:10 ` [LTP] [PATCH v3 3/3] swapon02: Add test cases for invalid swapflags Andrea Cervesato
2026-09-03 11:32   ` Cyril Hrubis [this message]

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=apla4DklqK8990v6@yuki.lan \
    --to=chrubis@suse.cz \
    --cc=andrea.cervesato@suse.de \
    --cc=ltp@lists.linux.it \
    /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