]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: accept getopt errors without single-quotes
authorAssaf Gordon <assafgordon@gmail.com>
Tue, 26 Jun 2018 11:04:45 +0000 (05:04 -0600)
committerPádraig Brady <P@draigBrady.com>
Wed, 27 Jun 2018 09:38:59 +0000 (02:38 -0700)
On OpenBSD 6.2, invalid single options produce error messages
without single quotes:

    $ ./src/chroot -/
    chroot: unknown option -- /

As opposed to other systems:

    ./src/chroot: invalid option -- '/'

Modify the grep search to accept this.

* tests/misc/usage_vs_getopt.sh (checkprg): Change the grep pattern
to accomodate no-single-quotes cases.

tests/misc/usage_vs_getopt.sh

index aec1c6da22c2a664576af38b6558d981b80017e9..2ca16ffb368f6757e85030ad34643dc3dd93c44a 100755 (executable)
@@ -36,7 +36,9 @@ checkprg () {
 
   # Append the pattern for a short unknown option.
   returns_ $rcexp $prg -/ >/dev/null 2> err || fail=1
-  grep -F "'/'" err || framework_failure_
+  grep " '*/'*" err || framework_failure_
+  # The following only handles the common case that has single quotes,
+  # as it simplifies to identify missing options only on common systems.
   sed -n "1s/'\/'/'OPT'/p" < err >> pat || framework_failure_
 
   # Get output for --help.