[LTP] [PATCH v3 3/4] tree: Use TST_EXP_PASS_OR_FAIL() and TST_EXP_FD_OR_FAIL()

Andrea Cervesato andrea.cervesato@suse.com
Thu Aug 20 09:52:23 CEST 2026


> Therefore I suggest to merge with changes below (removed O_TRUNC and move fd =
> to the beginning).
> 
> > Kind regards,
> > Petr
> 
> +++ testcases/kernel/syscalls/landlock/landlock_tester.h
> @@ -254,13 +254,13 @@ static void _test_truncate(const int exp_err)
>  	tst_res(TINFO, "Test truncating file");
>  
>  	TST_EXP_PASS_OR_FAIL(truncate(FILE_TRUNCATE, 10), exp_err);
> -	TST_EXP_FD_OR_FAIL(fd = open(FILE_TRUNCATE, O_WRONLY | O_TRUNC, PERM_MODE), exp_err);
> +	fd = TST_EXP_FD_OR_FAIL(open(FILE_TRUNCATE, O_WRONLY, PERM_MODE), exp_err);
>  	if (fd != -1) {
>  		TST_EXP_PASS_OR_FAIL(ftruncate(fd, 10), exp_err);
>  		SAFE_CLOSE(fd);
>  	}
>  
> -	TST_EXP_FD_OR_FAIL(fd = open(FILE_TRUNCATE, O_WRONLY | O_TRUNC, PERM_MODE), exp_err);
> +	fd = TST_EXP_FD_OR_FAIL(open(FILE_TRUNCATE, O_WRONLY | O_TRUNC, PERM_MODE), exp_err);
>  	if (fd != -1)
>  		SAFE_CLOSE(TST_RET);
>  }

+1

--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com


More information about the ltp mailing list