[cache_check] --super-block-only, --skip-mappings, --skip-hints

This commit is contained in:
Joe Thornber 2013-10-08 11:34:10 +01:00
parent bd06f58f6f
commit 505cf95109
3 changed files with 34 additions and 4 deletions

View File

@ -252,7 +252,11 @@ namespace {
<< "Options:" << endl << "Options:" << endl
<< " {-q|--quiet}" << endl << " {-q|--quiet}" << endl
<< " {-h|--help}" << endl << " {-h|--help}" << endl
<< " {-V|--version}" << endl; << " {-V|--version}" << endl
<< " {--super-block-only}" << endl
<< " {--skip-mappings}" << endl
<< " {--skip-hints}" << endl;
} }
char const *TOOLS_VERSION = "0.1.6"; char const *TOOLS_VERSION = "0.1.6";
@ -266,14 +270,30 @@ int main(int argc, char **argv)
flags fs; flags fs;
const char shortopts[] = "qhV"; const char shortopts[] = "qhV";
const struct option longopts[] = { const struct option longopts[] = {
{ "quiet", no_argument, NULL, 'q'}, { "quiet", no_argument, NULL, 'q' },
{ "help", no_argument, NULL, 'h'}, { "superblock-only", no_argument, NULL, 1 },
{ "version", no_argument, NULL, 'V'}, { "skip-mappings", no_argument, NULL, 2 },
{ "skip-hints", no_argument, NULL, 3 },
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'V' },
{ NULL, no_argument, NULL, 0 } { NULL, no_argument, NULL, 0 }
}; };
while ((c = getopt_long(argc, argv, shortopts, longopts, NULL)) != -1) { while ((c = getopt_long(argc, argv, shortopts, longopts, NULL)) != -1) {
switch(c) { switch(c) {
case 1:
fs.check_mappings_ = false;
fs.check_hints_ = false;
break;
case 2:
fs.check_mappings_ = false;
break;
case 3:
fs.check_hints_ = false;
break;
case 'h': case 'h':
usage(cout, basename(argv[0])); usage(cout, basename(argv[0]));
return 0; return 0;

View File

@ -76,6 +76,13 @@ Feature: cache_check
Then it should fail Then it should fail
And it should give no output And it should give no output
Scenario: -q is observed
Given input file
And block 1 is zeroed
When I run `cache_check -q input`
Then it should fail
And it should give no output
Scenario: A valid metadata area passes Scenario: A valid metadata area passes
Given metadata containing: Given metadata containing:
""" """

View File

@ -46,6 +46,9 @@ Options:
{-q|--quiet} {-q|--quiet}
{-h|--help} {-h|--help}
{-V|--version} {-V|--version}
{--super-block-only}
{--skip-mappings}
{--skip-hints}
EOF EOF
Then /^usage to stdout$/ do Then /^usage to stdout$/ do