summaryrefslogtreecommitdiff
path: root/tests/fs-tests
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-04-14 13:32:06 +0300
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-04-22 14:29:51 +0300
commit9767fe1ef056d47eb7b0365fd4869f46ab2c45bf (patch)
tree9634dabe06778a8bd43e81746f0b4d61840ca63e /tests/fs-tests
parentc251867ba21ea2919831ee2349c77fb773ba5b6b (diff)
fs-tests: integck: handle errors in remount_tested_fs
Teach 'remount_tested_fs()' return error code when it fails to mount the file-system. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'tests/fs-tests')
-rw-r--r--tests/fs-tests/integrity/integck.c35
1 files changed, 24 insertions, 11 deletions
diff --git a/tests/fs-tests/integrity/integck.c b/tests/fs-tests/integrity/integck.c
index d138a7d..5b1adc1 100644
--- a/tests/fs-tests/integrity/integck.c
+++ b/tests/fs-tests/integrity/integck.c
@@ -2076,7 +2076,7 @@ static void update_test_data(void)
* Re-mount the test file-system. This function randomly select how to
* re-mount.
*/
-void remount_tested_fs(void)
+static int remount_tested_fs(void)
{
char *wd_save;
int ret;
@@ -2105,13 +2105,15 @@ void remount_tested_fs(void)
flags = fsinfo.mount_flags | MS_RDONLY | MS_REMOUNT;
ret = mount(fsinfo.fsdev, fsinfo.mount_point, fsinfo.fstype,
flags, fsinfo.mount_opts);
- CHECK(ret == 0);
+ if (ret)
+ return -1;
flags = fsinfo.mount_flags | MS_REMOUNT;
flags &= ~((unsigned long)MS_RDONLY);
ret = mount(fsinfo.fsdev, fsinfo.mount_point, fsinfo.fstype,
flags, fsinfo.mount_opts);
- CHECK(ret == 0);
+ if (ret)
+ return -1;
}
if (um) {
@@ -2119,7 +2121,8 @@ void remount_tested_fs(void)
flags = fsinfo.mount_flags | MS_RDONLY | MS_REMOUNT;
ret = mount(fsinfo.fsdev, fsinfo.mount_point,
fsinfo.fstype, flags, fsinfo.mount_opts);
- CHECK(ret == 0);
+ if (ret)
+ return -1;
}
CHECK(umount(fsinfo.mount_point) != -1);
@@ -2128,18 +2131,21 @@ void remount_tested_fs(void)
ret = mount(fsinfo.fsdev, fsinfo.mount_point,
fsinfo.fstype, fsinfo.mount_flags,
fsinfo.mount_opts);
- CHECK(ret == 0);
+ if (ret)
+ return -1;
} else {
ret = mount(fsinfo.fsdev, fsinfo.mount_point,
fsinfo.fstype, fsinfo.mount_flags | MS_RDONLY,
fsinfo.mount_opts);
- CHECK(ret == 0);
+ if (ret)
+ return -1;
flags = fsinfo.mount_flags | MS_REMOUNT;
flags &= ~((unsigned long)MS_RDONLY);
ret = mount(fsinfo.fsdev, fsinfo.mount_point,
fsinfo.fstype, flags, fsinfo.mount_opts);
- CHECK(ret == 0);
+ if (ret)
+ return -1;
}
}
@@ -2147,18 +2153,21 @@ void remount_tested_fs(void)
flags = fsinfo.mount_flags | MS_RDONLY | MS_REMOUNT;
ret = mount(fsinfo.fsdev, fsinfo.mount_point, fsinfo.fstype,
flags, fsinfo.mount_opts);
- CHECK(ret == 0);
+ if (ret)
+ return -1;
flags = fsinfo.mount_flags | MS_REMOUNT;
flags &= ~((unsigned long)MS_RDONLY);
ret = mount(fsinfo.fsdev, fsinfo.mount_point, fsinfo.fstype,
flags, fsinfo.mount_opts);
- CHECK(ret == 0);
+ if (ret)
+ return -1;
}
/* Restore the previous working directory */
CHECK(chdir(wd_save) == 0);
free(wd_save);
+ return 0;
}
/*
@@ -2188,7 +2197,9 @@ static int integck(void)
if (fsinfo.is_rootfs) {
close_open_files();
- remount_tested_fs();
+ ret = remount_tested_fs();
+ if (ret)
+ return -1;
}
/* Check everything */
@@ -2201,7 +2212,9 @@ static int integck(void)
if (!fsinfo.is_rootfs) {
close_open_files();
- remount_tested_fs();
+ ret = remount_tested_fs();
+ if (ret)
+ return -1;
}
/* Check everything */