[LTP] [PATCH v3 1/2] fallocate01: Convert to new API

Cyril Hrubis chrubis@suse.cz
Thu Aug 27 10:09:39 CEST 2026


Hi!
> mmmh...I guess we need to keep the gate on ENOSYS and to check for
> ENOTSUPP in here, but we can't use TST_EXP_PASS_OR_FAIL(). That will
> TFAIL on succeed, so I need to use the same test function for both
> setup() and run()
> 
> static int test_fallocate(int fd, int mode, long len, long off)
> {
> 	TEST(fallocate(fd, mode, len, off));
> 	if (TST_RET != 0) {
> 		if (TST_ERR == EOPNOTSUPP || TST_ERR == ENOSYS)
> 			tst_brk(TCONF, "fallocate() not supported");
> 
> 		tst_brk(TBROK | TTERRNO, "fallocate() failed");
> 	}
> 
> 	return TST_RET;
> }
> 
> and use it into setup() + run() with TST_EXP_PASS()

We can handle ENOSYS in the test setup(). ENOSYS means that the syscall
is missing completely. But we can get EOPNOTSUPP for only subset of
flags, this needs to be handled in run().

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list