[LTP] [PATCH v2] Rewrite statx04 test

Petr Vorel pvorel@suse.cz
Wed Jan 19 12:23:00 CET 2022


Hi Martin,

> statx04 is supposed verify that inode attribute support in statx() matches
> what should actually be implemented. However, we already have functional tests
> for this in statx08 and lack a test of the stx_attribute_mask field which
> reports inode attribute support to userspace.

> Rewrite the test to drop the duplicate code and add the missing coverage.

> Signed-off-by: Martin Doucha <mdoucha@suse.cz>
> ---

> Changes since v1:
> - added known-fail tag for XFS in strict mode
> - changed copyright header to SUSE since this is a near-complete rewrite
Thanks a lot!

> This also fixes Btrfs failures on kernels v4.11 and v4.12 where the attributes
> are not supported at all. LTP is supposed to check for bugs, not force people
> to backport features from newer kernels.

> If anybody want to backport the Btrfs support, the test now has strict mode
> which disables kernel version exceptions.

> I've also disabled FUSE filesystems because they return wrong errno codes
> in the ioctl() check and NTFS3g now has some rudimentary support for inode
> attributes but no support for them in statx().

I'd put this into commit message (can be done during merge).

...
> +	if (TST_RET)
> +		tst_brk(TBROK | TTERRNO, "Unexpected ioctl() error");

> -static void test_unflagged(void)
> -{
> -	struct statx buf;
> +	for (i = 0, expected_mask = 0; i < ARRAY_SIZE(attr_list); i++)
Before merge we should cast to prevent "comparison of integer expressions of
different signedness" warning:
for (i = 0, expected_mask = 0; i < (int)ARRAY_SIZE(attr_list); i++)

> +		expected_mask |= attr_list[i].attr;

...
> -static void setup(void)
> -{
> -	SAFE_MKDIR(TESTDIR_FLAGGED, 0777);
> -	SAFE_MKDIR(TESTDIR_UNFLAGGED, 0777);
> +	for (i = 0; i < ARRAY_SIZE(attr_list); i++) {
And here:
for (i = 0; i < (int)ARRAY_SIZE(attr_list); i++) {
> +		if (!(expected_mask & attr_list[i].attr))
> +			continue;

Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr


More information about the ltp mailing list