]> www.infradead.org Git - mtd-utils.git/commitdiff
fs-tests: integck: make -v work -e
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Mon, 16 May 2011 14:04:49 +0000 (17:04 +0300)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Fri, 20 May 2011 09:48:42 +0000 (12:48 +0300)
Make the verify option -v work with power cut emulation option -e. We can
verify all operations except of writing to the file, because of write-back.
Indeed, even if we write successfully, the pages may still be in the page-cache
and if an emulated power cut happens they will be dropped, and our verification
will fail.

I am not 100% sure it is save to verify non-write operation in other FSes, but
only UBIFS has power cut emulation mode now, so we do not really care about
other FSes at this point.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
tests/fs-tests/integrity/integck.c

index 1483f62ea40ea103ff2fcc5038d672e921849058..944ff3ceecf85658fe4c134407e5d71fe42ecf3b 100644 (file)
@@ -552,7 +552,7 @@ static int dir_new(struct dir_info *parent, const char *name)
                return -1;
        }
 
-       if (args.verify_ops && !args.power_cut_mode) {
+       if (args.verify_ops) {
                struct stat st;
 
                CHECK(lstat(path, &st) == 0);
@@ -598,7 +598,7 @@ static int dir_remove(struct dir_info *dir)
                return -1;
        }
 
-       if (args.verify_ops && !args.power_cut_mode) {
+       if (args.verify_ops) {
                struct stat st;
 
                CHECK(lstat(path, &st) == -1);
@@ -635,7 +635,7 @@ static int file_new(struct dir_info *parent, const char *name)
                return -1;
        }
 
-       if (args.verify_ops && !args.power_cut_mode) {
+       if (args.verify_ops) {
                struct stat st;
 
                CHECK(lstat(path, &st) == 0);
@@ -663,7 +663,7 @@ static int link_new(struct dir_info *parent, const char *name,
        path = dir_path(parent, name);
        target = dir_path(entry->parent, entry->name);
 
-       if (args.verify_ops && !args.power_cut_mode)
+       if (args.verify_ops)
                CHECK(lstat(target, &st1) == 0);
 
        ret = link(target, path);
@@ -679,7 +679,7 @@ static int link_new(struct dir_info *parent, const char *name,
                return ret;
        }
 
-       if (args.verify_ops && !args.power_cut_mode) {
+       if (args.verify_ops) {
                CHECK(lstat(path, &st2) == 0);
                CHECK(S_ISREG(st2.st_mode));
                CHECK(st1.st_ino == st2.st_ino);
@@ -725,7 +725,7 @@ static int file_unlink(struct dir_entry_info *entry)
                return -1;
        }
 
-       if (args.verify_ops && !args.power_cut_mode) {
+       if (args.verify_ops) {
                struct stat st;
 
                CHECK(lstat(path, &st) == -1);
@@ -1109,7 +1109,7 @@ static int file_ftruncate(struct file_info *file, int fd, off_t new_length)
                return -1;
        }
 
-       if (args.verify_ops && !args.power_cut_mode)
+       if (args.verify_ops)
                CHECK(lseek(fd, 0, SEEK_END) == new_length);
 
        return 0;
@@ -1914,7 +1914,7 @@ static int rename_entry(struct dir_entry_info *entry)
        if (!path)
                return 0;
 
-       if (args.verify_ops && !args.power_cut_mode)
+       if (args.verify_ops)
                CHECK(lstat(path, &st1) == 0);
 
        ret = rename(path, to);
@@ -1932,7 +1932,7 @@ static int rename_entry(struct dir_entry_info *entry)
                return ret;
        }
 
-       if (args.verify_ops && !args.power_cut_mode) {
+       if (args.verify_ops) {
                CHECK(lstat(to, &st2) == 0);
                CHECK(st1.st_ino == st2.st_ino);
        }
@@ -2074,7 +2074,7 @@ static int symlink_new(struct dir_info *dir, const char *nm)
                return ret;
        }
 
-       if (args.verify_ops && !args.power_cut_mode)
+       if (args.verify_ops)
                verify_symlink(target, path);
 
        s = add_dir_entry(dir, 's', name, NULL);
@@ -2096,7 +2096,7 @@ static int symlink_remove(struct symlink_info *symlink)
                return -1;
        }
 
-       if (args.verify_ops && !args.power_cut_mode) {
+       if (args.verify_ops) {
                struct stat st;
 
                CHECK(lstat(path, &st) == -1);
@@ -2434,7 +2434,7 @@ static int rm_minus_rf_dir(const char *dir_name)
        CHECK(chdir(buf) == 0);
        CHECK(closedir(dir) == 0);
 
-       if (args.verify_ops && !args.power_cut_mode) {
+       if (args.verify_ops) {
                dir = opendir(dir_name);
                CHECK(dir != NULL);
                do {
@@ -2454,7 +2454,7 @@ static int rm_minus_rf_dir(const char *dir_name)
                return -1;
        }
 
-       if (args.verify_ops && !args.power_cut_mode) {
+       if (args.verify_ops) {
                struct stat st;
 
                CHECK(lstat(dir_name, &st) == -1);