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

Andrea Cervesato andrea.cervesato@suse.com
Thu Aug 27 09:43:32 CEST 2026


> fallocate01.c:103: TPASS: write into the newly allocated region returned 1
> fallocate01.c:92: TFAIL: fallocate(FALLOC_FL_KEEP_SIZE, 393216, 32768) failed: EOPNOTSUPP (95)
> fallocate01.c:97: TPASS: file_stat.st_size == expected_size (393216)
> fallocate01.c:101: TPASS: pos == offset + write_offset (409600)
> fallocate01.c:103: TPASS: write into the newly allocated region returned 1
> 
> 
> I guess that the easiest solution is to use
> TST_EXP_PASS_OR_FAIL(..., EOPNOTSUPP, ...) in the run() function
> instead.

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()

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


More information about the ltp mailing list