summaryrefslogtreecommitdiff
path: root/tests/fs-tests/lib
diff options
context:
space:
mode:
authorAdrian Hunter <ext-adrian.hunter@nokia.com>2007-11-06 13:08:12 +0200
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-06-16 18:02:31 +0300
commit838b38dadd00252c04fa5d548223b3a38062fe96 (patch)
treeb9d0f5e1400086ee2150dd931bd3652db207448f /tests/fs-tests/lib
parent7c850d4be465aee464c91f04753b6c1537edb48a (diff)
fs-tests: add simple performance test
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Diffstat (limited to 'tests/fs-tests/lib')
-rw-r--r--tests/fs-tests/lib/tests.c42
-rw-r--r--tests/fs-tests/lib/tests.h6
2 files changed, 48 insertions, 0 deletions
diff --git a/tests/fs-tests/lib/tests.c b/tests/fs-tests/lib/tests.c
index 9b8f443..aaf3907 100644
--- a/tests/fs-tests/lib/tests.c
+++ b/tests/fs-tests/lib/tests.c
@@ -1002,6 +1002,48 @@ void tests_remount(void)
CHECK(chdir(cwd) != -1);
}
+/* Un-mount or re-mount test file system */
+static void tests_mnt(int mnt)
+{
+ static struct mntent mount_info;
+ char *source;
+ char *target;
+ char *filesystemtype;
+ unsigned long mountflags;
+ void *data;
+ static char cwd[4096];
+
+ if (mnt == 0) {
+ CHECK(tests_get_mount_info(&mount_info));
+ if (strcmp(mount_info.mnt_dir,"/") == 0)
+ return;
+ CHECK(getcwd(cwd, 4096) != NULL);
+ CHECK(chdir("/") != -1);
+ CHECK(umount(tests_file_system_mount_dir) != -1);
+ } else {
+ source = mount_info.mnt_fsname;
+ target = tests_file_system_mount_dir;
+ filesystemtype = tests_file_system_type;
+ mountflags = 0;
+ data = NULL;
+ CHECK(mount(source, target, filesystemtype, mountflags, data)
+ != -1);
+ CHECK(chdir(cwd) != -1);
+ }
+}
+
+/* Unmount test file system */
+void tests_unmount(void)
+{
+ tests_mnt(0);
+}
+
+/* Mount test file system */
+void tests_mount(void)
+{
+ tests_mnt(1);
+}
+
/* Check whether the test file system is also the root file system */
int tests_fs_is_rootfs(void)
{
diff --git a/tests/fs-tests/lib/tests.h b/tests/fs-tests/lib/tests.h
index db08628..04c834d 100644
--- a/tests/fs-tests/lib/tests.h
+++ b/tests/fs-tests/lib/tests.h
@@ -146,6 +146,12 @@ int64_t tests_remove_entry(void);
/* Un-mount and re-mount test file system */
void tests_remount(void);
+/* Un-mount test file system */
+void tests_unmount(void);
+
+/* Mount test file system */
+void tests_mount(void);
+
/* Check whether the test file system is also the root file system */
int tests_fs_is_rootfs(void);