From 4b7595d751872442d043f6116a453d3b43b3253d Mon Sep 17 00:00:00 2001 From: Assaf Gordon Date: Tue, 26 Jun 2018 05:04:45 -0600 Subject: [PATCH] tests: accept getopt errors without single-quotes 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 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/misc/usage_vs_getopt.sh b/tests/misc/usage_vs_getopt.sh index aec1c6da22..2ca16ffb36 100755 --- a/tests/misc/usage_vs_getopt.sh +++ b/tests/misc/usage_vs_getopt.sh @@ -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. -- 2.47.2