[LTP] [PATCH v2 1/2] syscalls/fstat{01,02}: rewrote testcases

Cyril Hrubis chrubis@suse.cz
Thu Jun 6 13:34:30 CEST 2019


Hi!
Pushed with minor changes, thanks.

The fstat01 was in the quickhit runtest file as well,, removed that.

And as for the test, we don't have to print another TFAIL message on
failure and we should be more strict about checking the return value
(the test would pass if fstat returned garbage that != -1)

 static void run(void)
 {
-	int fail;
+	int fail = 0;
 
 	TEST(fstat(fildes, &stat_buf));
 
-	if (TST_RET == -1) {
+	if (TST_RET != 0) {
 		tst_res(TFAIL | TTERRNO, "fstat() failed");
 		return;
 	}
@@ -61,10 +61,8 @@ static void run(void)
 		fail++;
 	}
 
-	if (fail) {
-		tst_res(TFAIL, "fstat() reported wrong values.");
+	if (fail)
 		return;
-	}
 
 	tst_res(TPASS, "fstat() reported correct values.");
 }

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list