Skip to contentSkip to conversation

utime: Add exception for V9FS for utime functional test

PATCH In review Harsh Prateek Bora 2 participants 3 messages Feb 24, 2011 1 message not in the archive Library code

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 utime: Add exception for V9FS for utime functional test

The functional tests for utime checks if utime updates the modification and access time to current time, however V9FS, similar to NFS, by default uses the server's localtime if client doesnt specify a new time. The current implentation does not run the test if the underlying filesystem is NFS. A similar check for V9FS is also required, hence this patch.

---
 include/test.h                            |    1 +
 lib/tst_is_cwd.c                          |   12 +++++++++++-
 testcases/kernel/syscalls/utime/utime01.c |    7 ++++++-
 testcases/kernel/syscalls/utime/utime02.c |    7 ++++++-
 testcases/kernel/syscalls/utime/utime03.c |    7 ++++++-
 5 files changed, 30 insertions(+), 4 deletions(-)
include/test.h +1 -0
index 019bc59..39bad72 100644
@@ -214,6 +214,7 @@ int tst_kvercmp(int r1, int r2, int r3);
 
 /* lib/tst_is_cwd.c */
 int tst_is_cwd_nfs(void);
+int tst_is_cwd_v9fs(void);
 int tst_is_cwd_tmpfs(void);
 int tst_is_cwd_ramfs(void);
 
lib/tst_is_cwd.c +10 -0
index 775d1f3..8c169dd 100644
@@ -31,6 +31,16 @@ int tst_is_cwd_nfs(void)
 	return sf.f_type == NFS_MAGIC ? 1 : 0;
 }
 
+#define V9FS_MAGIC 0x01021997 /* kernel-source/include/linux/magic.h */
+int tst_is_cwd_v9fs(void)
+{
+        struct statfs sf;
+        statfs(".", &sf);
+
+        /*  Verify that the file is not on a nfs filesystem */
+        return (sf.f_type == V9FS_MAGIC);
+}
+
 #define RAMFS_MAGIC 0x858458f6
 int tst_is_cwd_ramfs(void)
 {
testcases/kernel/syscalls/utime/utime01.c +5 -0
index c917afa..a15440c 100644
@@ -120,6 +120,11 @@ int main(int ac, char **av)
 			 "Cannot do utime on a file located on an NFS filesystem");
 	}
 
+        if (tst_is_cwd_v9fs()) {
+                tst_brkm(TCONF, cleanup,
+                         "Cannot do utime on a file located on an 9P filesystem");
+        }
+
 	/* set the expected errnos... */
 	TEST_EXP_ENOS(exp_enos);
 
testcases/kernel/syscalls/utime/utime02.c +5 -0
index 8928a78..f0558a8 100644
@@ -125,6 +125,11 @@ int main(int ac, char **av)
 			 "Cannot do utime on a file located on an NFS filesystem");
 	}
 
+        if (tst_is_cwd_v9fs()) {
+                tst_brkm(TCONF, cleanup,
+                         "Cannot do utime on a file located on an 9P filesystem");
+        }
+
 	/* set the expected errnos... */
 	TEST_EXP_ENOS(exp_enos);
 
testcases/kernel/syscalls/utime/utime03.c +5 -0
index 23402b7..4f70d2d 100644
@@ -136,6 +136,11 @@ int main(int ac, char **av)
 			 "Cannot do utime on a file located on an NFS filesystem");
 	}
 
+        if (tst_is_cwd_v9fs()) {
+                tst_brkm(TCONF, cleanup,
+                         "Cannot do utime on a file located on an 9P filesystem");
+        }
+
 	/* set the expected errnos... */
 	TEST_EXP_ENOS(exp_enos);
 
Signature · 13 lines
1.7.1.1


------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#1 lore raw

Hi!

Commited.

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw

Hi!

Quoted 4 lines

The below changes make the files inconsistent WRT other function definitions and calls:-

1) Other functions in '/lib/tst_is_cwd.c' still use '? 1 : 0'. Yes this is redundant but if we remove this from the newly added function, I believe we should sync other functions too by removing '? 1 : 0'.

Allready fixed.

Quoted 1 line

2) Keeping the comments in utime0*.c files does not harm us, i think...

See doc/style-guide.txt.

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list