[LTP] [PATCH v2 1/2] syscalls/stat01, 02, 05: Cleanup && Convert to new API

Cyril Hrubis
2019-04-09T13:33:25Z

Hi!
Pushed with small simplification, thanks.

diff --git a/testcases/kernel/syscalls/stat/stat01.c b/testcases/kernel/syscalls/stat/stat01.c
index 437ce0cf8..14f1036d5 100644
--- a/testcases/kernel/syscalls/stat/stat01.c
+++ b/testcases/kernel/syscalls/stat/stat01.c
@@ -48,36 +48,31 @@ static void verify_stat(unsigned int n)
}

if (stat_buf.st_uid != user_id) {
- tst_res(TINFO, "stat_buf.st_uid = %i expected %i",
+ tst_res(TFAIL, "stat_buf.st_uid = %i expected %i",
stat_buf.st_uid, user_id);
fail++;
}

if (stat_buf.st_gid != group_id) {
- tst_res(TINFO, "stat_buf.st_gid = %i expected %i",
+ tst_res(TFAIL, "stat_buf.st_gid = %i expected %i",
stat_buf.st_gid, group_id);
fail++;
}

if (stat_buf.st_size != FILE_SIZE) {
- tst_res(TINFO, "stat_buf.st_size = %li expected %i",
+ tst_res(TFAIL, "stat_buf.st_size = %li expected %i",
(long)stat_buf.st_size, FILE_SIZE);
fail++;
}

if ((stat_buf.st_mode & MASK) != tc->mode) {
- tst_res(TINFO, "stat_buf.st_mode = %o expected %o",
+ tst_res(TFAIL, "stat_buf.st_mode = %o expected %o",
(stat_buf.st_mode & MASK), tc->mode);
fail++;
}

- if (fail) {
- tst_res(TFAIL, "functionality of stat(%s) incorrect",
- tc->pathname);
- return;
- }
-
- tst_res(TPASS, "functionality of stat(%s) correct", tc->pathname);
+ if (!fail)
+ tst_res(TPASS, "stat(%s)", tc->pathname);
}

void setup(void)