From: Simon McVittie Date: Fri, 15 Sep 2017 15:15:43 +0100 Subject: Fix test-help.sh for the case where ostree trivial-httpd is enabled MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit It's deprecated, but as long as it's still supported at all, it shouldn't make the tests fail. $ ostree trivial-httpd --help Usage: /usr/lib/libostree/ostree-trivial-httpd [OPTION…] [DIR] - Simple webserver Signed-off-by: Simon McVittie --- tests/test-help.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tests/test-help.sh b/tests/test-help.sh index 75fe0c1..2fda2c3 100755 --- a/tests/test-help.sh +++ b/tests/test-help.sh @@ -25,13 +25,13 @@ echo "1..1" test_usage_output() { file=$1; shift - cmd=$1; shift + regex=$1; shift assert_file_has_content $file '^Usage' # check that it didn't print twice somehow if [ "$(grep --count '^Usage' $file)" != 1 ]; then _fatal_print_file "$file" "File '$file' has '^Usage' more than once." fi - assert_file_has_content $file "$cmd" + assert_file_has_content $file "$regex" } # check that we found at least one command with subcommands @@ -42,8 +42,13 @@ test_recursive() { echo "$cmd" 1>&2 $cmd --help 1>out 2>err + + # Usage for "ostree foo" can contain either "ostree foo" or "ostree-foo" + # (the latter for ostree trivial-httpd) + regex="${cmd/ostree /ostree[- ]}" + # --help message goes to standard output - test_usage_output out "$cmd" + test_usage_output out "$regex" assert_file_empty err builtins=`sed -n '/^Builtin \("[^"]*" \)\?Commands:$/,/^$/p'