[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
<< " {-q|--quiet}" << 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";
@ -266,14 +270,30 @@ int main(int argc, char **argv)
flags fs;
const char shortopts[] = "qhV";
const struct option longopts[] = {
{ "quiet", no_argument, NULL, 'q'},
{ "help", no_argument, NULL, 'h'},
{ "version", no_argument, NULL, 'V'},
{ "quiet", no_argument, NULL, 'q' },
{ "superblock-only", no_argument, NULL, 1 },
{ "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 }
};
while ((c = getopt_long(argc, argv, shortopts, longopts, NULL)) != -1) {
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':
usage(cout, basename(argv[0]));
return 0;

View File

@ -76,6 +76,13 @@ Feature: cache_check
Then it should fail
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
Given metadata containing:
"""

View File

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