[LTP] [PATCH v6 3/3] syscalls/quotactl: Make use of TST_EXP_PASS_SILENT and TST_EXP_FAIL

Cyril Hrubis chrubis@suse.cz
Thu Jan 13 15:45:25 CET 2022


Hi!
>  } tcases[] = {
> -	{QCMD(Q_QUOTAON, USRQUOTA), &fmt_id, testdir1, EACCES, 0},
> -	{QCMD(Q_QUOTAON, USRQUOTA), &fmt_id, testdir2, ENOENT, 0},
> -	{QCMD(Q_QUOTAON, USRQUOTA), &fmt_id, usrpath, EBUSY, 1},
> -	{QCMD(Q_SETQUOTA, USRQUOTA), &fmt_id, NULL, EFAULT, 1},
> -	{QCMD(OPTION_INVALID, USRQUOTA), &fmt_id, usrpath, EINVAL, 0},
> -	{QCMD(Q_QUOTAON, USRQUOTA), &fmt_id, usrpath, ENOTBLK, 0},
> -	{QCMD(Q_SETQUOTA, USRQUOTA), &test_id, &set_dq, ESRCH, 0},
> -	{QCMD(Q_QUOTAON, USRQUOTA), &fmt_invalid, usrpath, ESRCH, 0},
> -	{QCMD(Q_GETNEXTQUOTA, USRQUOTA), &test_invalid, usrpath, ESRCH, 0},
> -	{QCMD(Q_SETQUOTA, USRQUOTA), &test_id, &set_dqmax, ERANGE, 1},
> -	{QCMD(Q_QUOTAON, USRQUOTA), &fmt_id, usrpath, EPERM, 0},
> +	{QCMD(Q_QUOTAON, USRQUOTA), &fmt_id, testdir1, EACCES, 0,
> +	"EACCES when cmd is Q_QUOTAON and addr existed but not a regular file"},
> +
> +	{QCMD(Q_QUOTAON, USRQUOTA), &fmt_id, testdir2, ENOENT, 0,
> +	"ENOENT when the file specified by special or addr does not exist"},
> +
> +	{QCMD(Q_QUOTAON, USRQUOTA), &fmt_id, usrpath, EBUSY, 1,
> +	"EBUSY when cmd is Q_QUOTAON and another Q_QUOTAON had already been performed"},
> +
> +	{QCMD(Q_SETQUOTA, USRQUOTA), &fmt_id, NULL, EFAULT, 1,
> +	"EFAULT when addr or special is invalid"},
> +
> +	{QCMD(OPTION_INVALID, USRQUOTA), &fmt_id, usrpath, EINVAL, 0,
> +	"EINVAL when cmd or type is invalid"},
> +
> +	{QCMD(Q_QUOTAON, USRQUOTA), &fmt_id, usrpath, ENOTBLK, 0,
> +	"ENOTBLK when special is not a block device"},
> +
> +	{QCMD(Q_SETQUOTA, USRQUOTA), &test_id, &set_dq, ESRCH, 0,
> +	"ESRCH when no disk quota is found for the indicated user and quotas "
> +	"have not been turned on for this fs"},
> +
> +	{QCMD(Q_QUOTAON, USRQUOTA), &fmt_invalid, usrpath, ESRCH, 0,
> +	"ESRCH when cmd is Q_QUOTAON, but the quota format was not found"},
> +
> +	{QCMD(Q_GETNEXTQUOTA, USRQUOTA), &test_invalid, usrpath, ESRCH, 0,
> +	"ESRCH when cmd is Q_GETNEXTQUOTA, but there is no ID greater than or "
> +	"equal to id that has an active quota"},
> +
> +	{QCMD(Q_SETQUOTA, USRQUOTA), &test_id, &set_dqmax, ERANGE, 1,
> +	"ERANGE when cmd is Q_SETQUOTA, but the specified limits are out of "
> +	"the range allowed by the quota format"},
> +
> +	{QCMD(Q_QUOTAON, USRQUOTA), &fmt_id, usrpath, EPERM, 0,
> +	"EPERM when the caller lacked the required privilege (CAP_SYS_ADMIN) "
> +	"for the specified operation"},

These descriptions could be a bit shorter and still have the same amount
of information, for instance the last one could be shortened to just:

"EPERM when caller lacks required privilege (CAP_SYS_ADMIN)"

or

"ESRCH for Q_GETNEXTQUOTA but the id was last one"

or

"ESRCH for Q_GETNEXTQUOTA but no quota found for the user or quotas are off"

Ideally all the messages should fit into a single line less than 80
characters...


Other than that this is a nice cleanup, with the messages shortened:

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list