[LTP] [PATCH v5 13/16] Add statmount07 test

Cyril Hrubis chrubis@suse.cz
Tue Oct 8 14:27:37 CEST 2024


Hi!
> +} tcases[] = {
> +	{ENOENT, "mount id doesn't exist'", &mnt_id_dont_exist, 0, 0, &buff_size, &st_mount},
> +	{EOVERFLOW, "invalid mask", &mnt_id, -1, 0, &buff_size, &st_mount},

I guess that we stil miss the EOVERFLOW case here with one of the
requests that yields string reply and small buffer.

> +	{EINVAL, "flags must be zero", &mnt_id, 0, 1, &buff_size, &st_mount},
> +	{EFAULT, "invalid buffer size", &mnt_id, 0, 0, &buff_size_invalid, &st_mount},
> +	{EFAULT, "invalid buffer pointer", &mnt_id, 0, 0, &buff_size, &st_mount_null},
> +};
> +
> +static void run(unsigned int n)
> +{
> +	struct tcase *tc = &tcases[n];
> +
> +	memset(st_mount, 0, sizeof(struct statmount));
> +
> +	TST_EXP_FAIL(statmount(*tc->mnt_id, tc->mask,
> +		*tc->buff, *tc->buff_size, tc->flags),
> +		tc->exp_errno, "%s", tc->msg);
> +}
> +
> +static void setup(void)
> +{
> +	struct ltp_statx sx;
> +
> +	SAFE_STATX(AT_FDCWD, MNTPOINT, 0, STATX_MNT_ID_UNIQUE, &sx);
> +
> +	mnt_id = sx.data.stx_mnt_id;
> +	buff_size = sizeof(struct statmount);
> +}
> +static struct tst_test test = {
> +	.test = run,
> +	.tcnt = ARRAY_SIZE(tcases),
> +	.setup = setup,
> +	.min_kver = "6.8",
> +	.mount_device = 1,
> +	.mntpoint = MNTPOINT,
> +	.format_device = 1,
> +	.bufs = (struct tst_buffers []) {
> +		{&st_mount, .size = sizeof(struct statmount)},
> +		{}
> +	}
> +};
> 
> -- 
> 2.43.0
> 

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list