[LTP] [PATCH 2/2] swapon01: Simplify code, add copyright

Petr Vorel pvorel@suse.cz
Fri Jan 19 14:36:34 CET 2024


Hi Cyril,

> Hi!
> >  /*\
> > @@ -21,18 +22,11 @@

> >  static void verify_swapon(void)
> >  {
> > -	TEST(tst_syscall(__NR_swapon, SWAP_FILE, 0));
> > +	TST_EXP_PASS(tst_syscall(__NR_swapon, SWAP_FILE, 0));

> > -	if (TST_RET == -1) {
> > -		tst_res(TFAIL | TTERRNO, "Failed to turn on swapfile");
> > -	} else {
> > -		tst_res(TPASS, "Succeeded to turn on swapfile");
> > -		/*we need to turn this swap file off for -i option */
> > -		if (tst_syscall(__NR_swapoff, SWAP_FILE) != 0) {
> > -			tst_brk(TBROK | TERRNO, "Failed to turn off swapfile,"
> > -				" system reboot after execution of LTP "
> > -				"test suite is recommended.");
> > -		}
> > +	if (tst_syscall(__NR_swapoff, SWAP_FILE) != 0) {

> Maybe if (TST_PASS && tst_syscall(__NR_swapoff, ...) != 0) {

Rebased, add this change and merged. Thanks!

Kind regards,
Petr


> Otherwise it looks good, with that change:

> Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

> > +		tst_brk(TBROK | TERRNO,
> > +				"Failed to turn off swapfile, system reboot recommended");
> >  	}
> >  }

> > -- 
> > 2.42.0


More information about the ltp mailing list