summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-04-13 15:06:18 +0300
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-04-18 17:44:45 +0300
commit08cfd9d7cacc3c0b97530ad7e13fa8db75e99947 (patch)
treed3cad08d36436dd7be97778c4964243d505c0bd9 /tests
parent711217f8e63fc7cf23e1e2859d2621eab4886754 (diff)
fs-tests: integck: do not use tests_fs_is_rootfs
Do not use the shared 'tests_fs_is_rootfs()' function - introduce 'fsinfo.is_rootfs' flag and utilize it instead. This is another step forward the goal to make integck independent of the common code. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/fs-tests/integrity/integck.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/fs-tests/integrity/integck.c b/tests/fs-tests/integrity/integck.c
index 92571d1..7a4bcdc 100644
--- a/tests/fs-tests/integrity/integck.c
+++ b/tests/fs-tests/integrity/integck.c
@@ -65,6 +65,7 @@ static struct {
* nospc_size_ok: file size is updated even if the write operation failed with
* ENOSPC error
* can_mmap: file-system supports share writable 'mmap()' operation
+ * is_rootfs: the tested file-system the root file-system
* fstype: file-system type (e.g., "ubifs")
* mount_point: tested file-system mount point path
* test_dir: the directory on the tested file-system where we test
@@ -75,6 +76,7 @@ static struct {
unsigned int log10_initial_free;
unsigned int nospc_size_ok:1;
unsigned int can_mmap:1;
+ unsigned int is_rootfs:1;
const char *fstype;
const char *mount_point;
const char *test_dir;
@@ -2026,7 +2028,7 @@ static int integck(void)
create_test_data();
- if (!tests_fs_is_rootfs()) {
+ if (fsinfo.is_rootfs) {
close_open_files();
tests_remount(); /* Requires root access */
}
@@ -2039,7 +2041,7 @@ static int integck(void)
for (rpt = 0; args.repeat_cnt == 0 || rpt < args.repeat_cnt; ++rpt) {
update_test_data();
- if (!tests_fs_is_rootfs()) {
+ if (!fsinfo.is_rootfs) {
close_open_files();
tests_remount(); /* Requires root access */
}
@@ -2069,6 +2071,7 @@ static void get_tested_fs_info(void)
uint64_t z;
char *p;
unsigned int pid;
+ struct stat st1, st2;
/* Remove trailing '/' symbols from the mount point */
p = dup_string(args.mount_point);
@@ -2127,6 +2130,11 @@ static void get_tested_fs_info(void)
normsg("pid %u, testing \"%s\" at \"%s\"",
pid, fsinfo.fstype, fsinfo.mount_point);
+
+ CHECK(stat(fsinfo.mount_point, &st1) == 0);
+ CHECK(stat("/", &st2) != -1);
+ if (st1.st_dev == st2.st_dev)
+ fsinfo.is_rootfs = 1;
}
static const char doc[] = PROGRAM_NAME " version " PROGRAM_VERSION