summaryrefslogtreecommitdiff
path: root/tests/fs-tests/integrity/integck.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/fs-tests/integrity/integck.c')
-rw-r--r--tests/fs-tests/integrity/integck.c31
1 files changed, 25 insertions, 6 deletions
diff --git a/tests/fs-tests/integrity/integck.c b/tests/fs-tests/integrity/integck.c
index 61fb12c..73b6622 100644
--- a/tests/fs-tests/integrity/integck.c
+++ b/tests/fs-tests/integrity/integck.c
@@ -65,6 +65,8 @@
/* The variables below are set by command line arguments */
static struct {
long repeat_cnt;
+ int power_cut_mode;
+ int verbose;
const char *mount_point;
} args = {
.repeat_cnt = 1,
@@ -2339,18 +2341,29 @@ static const char doc[] = PROGRAM_NAME " version " PROGRAM_VERSION
"and hardlinks, randomly writes and truncate files, sometimes makes holes in\n"
"files, sometimes fsync()'s them. Then it un-mounts and re-mounts the test file\n"
"system and checks the contents - everything (files, dirs, etc) should be there\n"
-"and the contents of the files should be correct.\n"
-"This is repeated a number of times (set with -n, default 1).";
+"and the contents of the files should be correct. This is repeated a number of\n"
+"times (set with -n, default 1).\n\n"
+"This test is also able to perform powe cut testing. The underlying file-system\n"
+"or the device driver should be able to emulate power-cuts, e.g., but switching\n"
+"to R/O mode at random points of time. And the file-system should return EROFS\n"
+"(read-only file-system error) for all operations which modify it. In this case\n"
+"this test program re-mounts the file-system and checks that all files and\n"
+"directories which have been successfully synchronized before the power cut are\n"
+"there and contains correct data. Then the test continues.\n";
static const char optionsstr[] =
"-n, --repeat=<count> repeat count, default is 1; zero value - repeat forever\n"
+"-p, --power-cut power cut testing mode\n"
+"-v, --verbose be verbose about failure during power cut testing\n"
"-h, -?, --help print help message\n"
"-V, --version print program version\n";
static const struct option long_options[] = {
- { .name = "repeat", .has_arg = 1, .flag = NULL, .val = 'n' },
- { .name = "help", .has_arg = 0, .flag = NULL, .val = 'h' },
- { .name = "version", .has_arg = 0, .flag = NULL, .val = 'V' },
+ { .name = "repeat", .has_arg = 1, .flag = NULL, .val = 'n' },
+ { .name = "power-cut", .has_arg = 0, .flag = NULL, .val = 'p' },
+ { .name = "verbose", .has_arg = 0, .flag = NULL, .val = 'v' },
+ { .name = "help", .has_arg = 0, .flag = NULL, .val = 'h' },
+ { .name = "version", .has_arg = 0, .flag = NULL, .val = 'V' },
{ NULL, 0, NULL, 0},
};
@@ -2365,7 +2378,7 @@ static int parse_opts(int argc, char * const argv[])
while (1) {
int key, error = 0;
- key = getopt_long(argc, argv, "n:Vh?", long_options, NULL);
+ key = getopt_long(argc, argv, "n:pvVh?", long_options, NULL);
if (key == -1)
break;
@@ -2375,6 +2388,12 @@ static int parse_opts(int argc, char * const argv[])
if (error || args.repeat_cnt < 0)
return errmsg("bad repeat count: \"%s\"", optarg);
break;
+ case 'p':
+ args.power_cut_mode = 1;
+ break;
+ case 'v':
+ args.verbose = 1;
+ break;
case 'V':
fprintf(stderr, "%s\n", PROGRAM_VERSION);
exit(EXIT_SUCCESS);