[LTP] [PATCH] fstat02.c: simplify using TST_EXP_*() macros
Petr Vorel
pvorel@suse.cz
Mon Jul 11 17:51:56 CEST 2022
Hi Avinesh,
LGTM, thanks!
Minor comments below.
Reviewed-by: Petr Vorel <pvorel@suse.cz>
...
> +++ b/testcases/kernel/syscalls/fstat/fstat02.c
...
> -#include <errno.h>
> -#include <unistd.h>
> -#include <sys/stat.h>
> -#include <sys/types.h>
> #include "tst_test.h"
> -#include "tst_safe_macros.h"
nit: obviously works without all these headers, but <sys/stat.h> is
needed (fstat) but included by tst_test.h
> +
> +/*\ [Description]
> + *
This is wrong, causes docparse not being formatted. It must be:
/*\
* [Description]
(can be fixed before merge)
> * Tests if fstat() returns correctly and reports correct file information
> * using the stat structure.
> */
...
> - tst_res(TPASS, "fstat() reported correct values.");
> + TST_EXP_PASS(fstat(fildes, &stat_buf));
> + TST_EXP_EQ_LI(stat_buf.st_uid, user_id);
> + TST_EXP_EQ_LI(stat_buf.st_gid, group_id);
nit: At least st_uid and st_gid are unsigned, thus maybe TST_EXP_EQ_LU?
> + TST_EXP_EQ_LI(stat_buf.st_size, FILE_SIZE);
> + TST_EXP_EQ_LI(stat_buf.st_mode & 0777, FILE_MODE);
> + TST_EXP_EQ_LI(stat_buf.st_nlink, NLINK);
> }
Kind regards,
Petr
More information about the ltp
mailing list