diff --git a/features/thin_check.feature b/features/thin_check.feature index 69f9c74..098218e 100644 --- a/features/thin_check.feature +++ b/features/thin_check.feature @@ -38,6 +38,7 @@ Feature: thin_check {-h|--help} {-V|--version} {--super-block-only} + {--skip-mappings} """ Scenario: Unrecognised option should cause failure @@ -57,4 +58,9 @@ Feature: thin_check examining superblock superblock is corrupt bad checksum in superblock - """ \ No newline at end of file + """ + + Scenario: --skip-mappings check passes on valid metadata + Given valid metadata + When I run thin_check with --skip-mappings + Then it should pass \ No newline at end of file diff --git a/thin-provisioning/thin_check.cc b/thin-provisioning/thin_check.cc index 1858b7a..202f739 100644 --- a/thin-provisioning/thin_check.cc +++ b/thin-provisioning/thin_check.cc @@ -308,7 +308,8 @@ namespace { << " {-q|--quiet}" << endl << " {-h|--help}" << 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 } }; + 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) { switch(c) { case 'h': @@ -350,8 +355,6 @@ int main(int argc, char **argv) case 2: // skip-mappings - fs.check_device_tree = true; - fs.check_mapping_tree_level1 = true; fs.check_mapping_tree_level2 = false; break;