[PATCH] fstat02: Verify st_ino field

Jinseok Kim <[email protected]>
Newsgroups gmane.linux.ltp
Message-ID <[email protected]>
fstat01 does not currently verify the st_ino field.

Add a check to verify that fstat() reports the expected inode number,
improving coverage of the metadata returned by fstat().

Signed-off-by: Jinseok Kim <[email protected]>
---
 testcases/kernel/syscalls/fstat/fstat02.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/testcases/kernel/syscalls/fstat/fstat02.c b/testcases/kernel/syscalls/fstat/fstat02.c
index 68cbe82f0..e7175cfac 100644
--- a/testcases/kernel/syscalls/fstat/fstat02.c
+++ b/testcases/kernel/syscalls/fstat/fstat02.c
@@ -19,6 +19,7 @@
 #define NLINK	        2

 static struct stat stat_buf;
+static struct stat link_stat_buf;
 static uid_t user_id;
 static gid_t group_id;
 static int fildes;
@@ -31,6 +32,7 @@ static void run(void)
 	TST_EXP_EQ_LI(stat_buf.st_size, FILE_SIZE);
 	TST_EXP_EQ_LU(stat_buf.st_mode & 0777, FILE_MODE);
 	TST_EXP_EQ_LU(stat_buf.st_nlink, NLINK);
+	TST_EXP_EQ_LU(stat_buf.st_ino, link_stat_buf.st_ino);
 }

 static void setup(void)
@@ -46,6 +48,8 @@ static void setup(void)
 		tst_brk(TBROK, "Could not fill test file");

 	SAFE_LINK(TESTFILE, LINK_TESTFILE);
+
+	SAFE_STAT(LINK_TESTFILE, &link_stat_buf);
 }

 static void cleanup(void)
--
2.43.0

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.