diff options
author | Elliott Hughes <enh@google.com> | 2018-12-19 08:58:36 -0800 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2018-12-19 13:50:38 -0600 |
commit | 880e41fa961173652b4a414b1e6740f610421a21 (patch) | |
tree | 1c11ec1a08611e32a5b43725f584e827c94e2d41 /tests | |
parent | b6c12d25bce1c923e44a5c6c897b9e8ffa801e2c (diff) | |
download | toybox-880e41fa961173652b4a414b1e6740f610421a21.tar.gz |
md5sum/sha1sum: add --status and --check, fix --check with multiple files.
Annoyingly coreutils and busybox both have the --status functionality,
but coreutils only accepts --status and busybox only accepts -s. Although
all extant users known to me use --status I've supported both (a) for
maximum compatibility and (b) because Rob hates longopts :-)
Also, -c/--check don't take argument(s): they alter the interpretation
of all the FILE... arguments.
I removed a bunch of dead code here, but I couldn't switch us over to
loopfiles_lines because I didn't want to regress on the "warn if any
check file contains no hashes", and loopfiles_lines doesn't give you
any way to recognize that you've moved on to the next file.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/md5sum.test | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/md5sum.test b/tests/md5sum.test index f159d1ed..cda9871f 100755 --- a/tests/md5sum.test +++ b/tests/md5sum.test @@ -28,3 +28,12 @@ testing "-c spaces" "md5sum -c input || echo ok" \ rm "te st" empty testing "-c nolines" "md5sum -c input 2>/dev/null || echo ok" "ok\n" "" "" + +touch empty +echo "d41d8cd98f00b204e9800998ecf8427e empty" > list +echo "041d8cd98f00b204e9800998ecf8427e empty" > badlist +testing "--status okay" "md5sum --status -c list ; echo \$?" "0\n" "" "" +testing "--status fail" "md5sum --status -c badlist ; echo \$?" "1\n" "" "" +testing "-c multiple" "md5sum -c list badlist --status ; echo \$?" "1\n" "" "" + +rm empty list badlist |