summaryrefslogtreecommitdiff
path: root/tests/misc
diff options
context:
space:
mode:
authorLuther Thompson <lutheroto@gmail.com>2015-11-22 21:47:59 +0000
committerPádraig Brady <P@draigBrady.com>2015-11-23 12:58:10 +0000
commit9fd0662faa4db68dea4fb4ba3f918b6a8f9598c4 (patch)
treead24dd918bd5eb04c1fff1584c622326a68b5ca5 /tests/misc
parent561f759b01cedda112d696071d205d26b9196d89 (diff)
downloadcoreutils-9fd0662faa4db68dea4fb4ba3f918b6a8f9598c4.tar.xz
md5sum,sha*sum: add --ignore-missing for checking a subset of files
* doc/coreutils.texi (md5sum invocation): Document the new option. * src/md5sum.c (digest_file): Return an empty digest to indicate a missing file. (digest_check): Don't fail or output status given an empty checksum. (usage): Document the new option. (main): Process and validate the new option. * tests/misc/md5sum.pl: Add new test cases. * NEWS: Mention the new feature. Fixes http://bugs.gnu.org/15604
Diffstat (limited to 'tests/misc')
-rwxr-xr-xtests/misc/md5sum.pl23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/misc/md5sum.pl b/tests/misc/md5sum.pl
index ad1896d53..3a7744bde 100755
--- a/tests/misc/md5sum.pl
+++ b/tests/misc/md5sum.pl
@@ -25,6 +25,8 @@ my $prog = 'md5sum';
my $degenerate = "d41d8cd98f00b204e9800998ecf8427e";
+my $try_help = "Try 'md5sum --help' for more information.\n";
+
my @Tests =
(
['1', {IN=> {f=> ''}}, {OUT=>"$degenerate f\n"}],
@@ -120,6 +122,27 @@ my @Tests =
['check-openssl3', '--check', '--status',
{IN=> {'f.md5' => "MD5(f)= $degenerate\n"}},
{AUX=> {f=> 'bar'}}, {EXIT=> 1}],
+ ['check-ignore-missing-1', '--check', '--ignore-missing',
+ {AUX=> {f=> ''}},
+ {IN=> {'f.md5' => "$degenerate f\n".
+ "$degenerate f.missing\n"}},
+ {OUT=>"f: OK\n"}],
+ ['check-ignore-missing-2', '--check', '--ignore-missing',
+ {AUX=> {f=> ''}},
+ {IN=> {'f.md5' => "$degenerate f\n".
+ "$degenerate f.missing\n"}},
+ {OUT=>"f: OK\n"}],
+ ['check-ignore-missing-3', '--check', '--quiet', '--ignore-missing',
+ {AUX=> {f=> ''}},
+ {IN=> {'f.md5' => "$degenerate missing/f\n".
+ "$degenerate f\n"}},
+ {OUT=>""}],
+ ['check-ignore-missing-4', '--ignore-missing',
+ {IN=> {f=> ''}},
+ {ERR=>"md5sum: the --ignore-missing option is ".
+ "meaningful only when verifying checksums\n".
+ $try_help},
+ {EXIT=> 1}],
['bsd-segv', '--check', {IN=> {'z' => "MD5 ("}}, {EXIT=> 1},
{ERR=> "$prog: z: no properly formatted MD5 checksum lines found\n"}],