[thin_check] Add cucumber test for --skip-mappings

This commit is contained in:
Joe Thornber 2013-05-23 11:45:08 +01:00
parent 35538378fe
commit f8efc4f58c
2 changed files with 13 additions and 4 deletions

View File

@ -38,6 +38,7 @@ Feature: thin_check
{-h|--help} {-h|--help}
{-V|--version} {-V|--version}
{--super-block-only} {--super-block-only}
{--skip-mappings}
""" """
Scenario: Unrecognised option should cause failure Scenario: Unrecognised option should cause failure
@ -58,3 +59,8 @@ Feature: thin_check
superblock is corrupt superblock is corrupt
bad checksum in superblock bad checksum in superblock
""" """
Scenario: --skip-mappings check passes on valid metadata
Given valid metadata
When I run thin_check with --skip-mappings
Then it should pass

View File

@ -308,7 +308,8 @@ namespace {
<< " {-q|--quiet}" << endl << " {-q|--quiet}" << endl
<< " {-h|--help}" << endl << " {-h|--help}" << endl
<< " {-V|--version}" << endl << " {-V|--version}" << endl
<< " {--super-block-only}" << endl; << " {--super-block-only}" << endl
<< " {--skip-mappings}" << endl;
} }
} }
@ -327,6 +328,10 @@ int main(int argc, char **argv)
{ NULL, no_argument, NULL, 0 } { NULL, no_argument, NULL, 0 }
}; };
fs.check_device_tree = true;
fs.check_mapping_tree_level1 = true;
fs.check_mapping_tree_level2 = true;
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 'h': case 'h':
@ -350,8 +355,6 @@ int main(int argc, char **argv)
case 2: case 2:
// skip-mappings // skip-mappings
fs.check_device_tree = true;
fs.check_mapping_tree_level1 = true;
fs.check_mapping_tree_level2 = false; fs.check_mapping_tree_level2 = false;
break; break;