]> www.infradead.org Git - mtd-utils.git/commitdiff
Add more information to integrity test error message
authorAdrian Hunter <ext-adrian.hunter@nokia.com>
Wed, 18 Jul 2007 08:50:53 +0000 (11:50 +0300)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Wed, 18 Jul 2007 12:26:07 +0000 (15:26 +0300)
When the integrity test encounters a file that does not contain
the expected data, it lists the data that it expected to find
in terms of writes to the file.

Now the test also displays a list of "raw" writes that includes
writes that have been truncated away, or completely overwritten
by other writes.

The test also now displays the pid because it is used as the
initial random seed.

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
tests/fs-tests/integrity/integck.c

index 62123d59e2e2f4b3ba3fb8e3984a74246a625d3f..753a3179b4092330f8517704ba3b4cc7b478b105 100644 (file)
@@ -48,7 +48,9 @@ struct file_info /* Each file has one of these */
 {
        char *name;
        struct dir_info *parent; /* Parent directory */
-       struct write_info *writes; /* Record all writes to the file */
+       struct write_info *writes; /* Record accumulated writes to the file */
+       struct write_info *raw_writes;
+                               /* Record in order all writes to the file */
        struct fd_info *fds; /* All open file descriptors for this file */
        off_t length;
        int deleted; /* File has been deleted but is still open */
@@ -434,6 +436,21 @@ static void file_info_display(struct file_info *file)
        }
        fprintf(stderr, "    %u writes\n", wcnt);
        fprintf(stderr, "    ============================================\n");
+       fprintf(stderr, "    Raw Write Info:\n");
+       wcnt = 0;
+       w = file->raw_writes;
+       while (w) {
+               fprintf(stderr, "        Offset: %u  Size: %u  Seed: %u"
+                               "  R.Off: %u\n",
+                               (unsigned) w->offset,
+                               (unsigned) w->size,
+                               (unsigned) w->random_seed,
+                               (unsigned) w->random_offset);
+               wcnt += 1;
+               w = w->next;
+       }
+       fprintf(stderr, "    %u writes\n", wcnt);
+       fprintf(stderr, "    ============================================\n");
 }
 
 static struct fd_info *file_open(struct file_info *file)
@@ -510,6 +527,15 @@ static void file_write_info(struct file_info *file,
        new_write->size = size;
        new_write->random_seed = seed;
 
+       w = (struct write_info *) malloc(sz);
+       CHECK(w != NULL);
+       memset(w, 0, sz);
+       w->next = file->raw_writes;
+       w->offset = offset;
+       w->size = size;
+       w->random_seed = seed;
+       file->raw_writes = w;
+
        /* Insert it into file->writes */
        inserted = 0;
        end = offset + size;
@@ -1300,6 +1326,7 @@ void integck(void)
 
        /* Make our top directory */
        pid = getpid();
+       printf("pid is %u\n", (unsigned) pid);
        tests_cat_pid(dir_name, "integck_test_dir_", pid);
        if (chdir(dir_name) != -1) {
                /* Remove it if it is already there */