Skip to contentSkip to conversation

mount/mount06.c: new case to test MS_MOVE of mount

PATCH In review DAN LI 2 participants 2 messages Jul 8, 2013 – Jul 10, 2013

lore
Share & tools
lore

DAN LI

author
#0 lore raw

PATCH v2 1/1 mount/mount06.c: new case to test MS_MOVE of mount

Create new test case "mount06.c" for MS_MOVE of mount.

Checking if file is visible from the new location after move mount.

---
 runtest/syscalls                          |   1 +
 testcases/kernel/syscalls/.gitignore      |   1 +
 testcases/kernel/syscalls/mount/mount06.c | 175 ++++++++++++++++++++++++++++++
 3 files changed, 177 insertions(+)
 create mode 100644 testcases/kernel/syscalls/mount/mount06.c
runtest/syscalls +1 -0
index beb8782..b4a69f5 100644
@@ -579,6 +579,7 @@ mount01 mount01 -D DEVICE -T DEVICE_FS_TYPE
 mount02 mount02 -D DEVICE -T DEVICE_FS_TYPE
 mount03 mount03 -D DEVICE -T DEVICE_FS_TYPE
 mount04 mount04 -D DEVICE -T DEVICE_FS_TYPE
+mount06 mount06 -D DEVICE -T DEVICE_FS_TYPE
 
 move_pages01 move_pages.sh 01
 move_pages02 move_pages.sh 02
testcases/kernel/syscalls/.gitignore +1 -0
index 18d03d4..5d6f9d6 100644
@@ -522,6 +522,7 @@
 /mount/mount02
 /mount/mount03
 /mount/mount04
+/mount/mount06
 /mount/setuid_test
 /move_pages/move_pages01
 /move_pages/move_pages02
testcases/kernel/syscalls/mount/mount06.c new file +175 -0

175 lines not on this page · raw message

Signature · 12 lines
1.8.1

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#1 lore raw

Hi!

Quoted 9 lines
testcases/kernel/syscalls/mount/mount06.c new file +9 -0
+		SAFE_FILE_PRINTF(cleanup, file_src, "TEST FILE");
+
+		TEST(mount(mntpoint_src, mntpoint_des, fs_type, MS_MOVE, NULL));
+
+		if (TEST_RETURN != 0) {
+			tst_resm(TFAIL | TTERRNO, "mount(2) failed");
+		} else {
+
+			if (open(file_des, O_CREAT | O_EXCL) == -1 &&

testcases/kernel/syscalls/mount/mount06.c line 116

Quoted 10 lines
testcases/kernel/syscalls/mount/mount06.c new file +10 -0
+			    errno == EEXIST)
+				tst_resm(TPASS, "move mount is ok");
+			else
+				tst_resm(TFAIL, "file %s is not available",
+					 file_des);
+
+			TEST(umount(mntpoint_des));
+			if (TEST_RETURN != 0)
+				tst_brkm(TBROK | TTERRNO, cleanup,
+					 "umount(2) failed");

I still think that we should make this check more robust...

testcases/kernel/syscalls/mount/mount06.c line 163

Quoted 12 lines
testcases/kernel/syscalls/mount/mount06.c new file +12 -0
+		}
+	}
+	cleanup();
+
+	tst_exit();
+}
+
+void cleanup(void)
+{
+	if (umount(path_name) != 0)
+		tst_brkm(TBROK | TTERRNO, NULL, "umount(2) %s failed",
+			 path_name);

I think that the TTERRNO is a typo here and it should be TERRNO.

Quoted 4 lines
testcases/kernel/syscalls/mount/mount06.c new file +4 -0
+	TEST_CLEANUP;
+
+	tst_rmdir();
+}
Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list