tests: trigger and test for md5sum's new diagnostics
authorJim Meyering <meyering@redhat.com>
Tue, 19 Oct 2010 07:19:59 +0000 (09:19 +0200)
committerJim Meyering <meyering@redhat.com>
Tue, 19 Oct 2010 07:35:44 +0000 (09:35 +0200)
* tests/misc/md5sum: Test for new diagnostics.

tests/misc/md5sum

index 92cc0fb..819a819 100755 (executable)
@@ -54,6 +54,29 @@ my @Tests =
                                 {ERR=>"md5sum: WARNING: 1 computed"
                                        . " checksum did NOT match\n"},
                                 {EXIT=> 1}],
+     # Exercise new-after-8.6, easier-to-translate diagnostics.
+     ['check-multifail', '--check',
+                                {IN=>{'f.md5' =>
+                                      "$degenerate  f\n"
+                                      . "$degenerate  f\n"
+                                      . "invalid\n" }},
+                                {AUX=> {f=> 'foo'}},
+                                {OUT=>"f: FAILED\nf: FAILED\n"},
+                  {ERR=>"md5sum: WARNING: 1 line is improperly formatted\n"
+                      . "md5sum: WARNING: 2 computed checksums did NOT match\n"},
+                                {EXIT=> 1}],
+     # Similar to the above, but use --warn to evoke one more diagnostic.
+     ['check-multifail-warn', '--check', '--warn',
+                                {IN=>{'f.md5' =>
+                                      "$degenerate  f\n"
+                                      . "$degenerate  f\n"
+                                      . "invalid\n" }},
+                                {AUX=> {f=> 'foo'}},
+                                {OUT=>"f: FAILED\nf: FAILED\n"},
+              {ERR=>"md5sum: f.md5: 3: improperly formatted MD5 checksum line\n"
+                  . "md5sum: WARNING: 1 line is improperly formatted\n"
+                  . "md5sum: WARNING: 2 computed checksums did NOT match\n"},
+                                {EXIT=> 1}],
      # The sha1sum and md5sum drivers share a lot of code.
      # Ensure that md5sum does *not* share the part that makes
      # sha1sum accept BSD format.