Fix test-help patch to allow for build-time testing
Signed-off-by: Simon McVittie <smcv@debian.org>
This commit is contained in:
parent
8fcb5110c9
commit
a5cff569b7
|
|
@ -1,72 +0,0 @@
|
||||||
From: Simon McVittie <smcv@collabora.com>
|
|
||||||
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 <smcv@collabora.com>
|
|
||||||
---
|
|
||||||
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' <out | tail -n +2`
|
|
||||||
@@ -60,7 +65,7 @@ test_recursive() {
|
|
||||||
fi
|
|
||||||
|
|
||||||
# error message and usage goes to standard error
|
|
||||||
- test_usage_output err "$cmd"
|
|
||||||
+ test_usage_output err "$regex"
|
|
||||||
assert_file_has_content err 'No \("[^"]*" sub\)\?command specified'
|
|
||||||
assert_file_empty out
|
|
||||||
|
|
||||||
@@ -70,7 +75,7 @@ test_recursive() {
|
|
||||||
assert_not_reached "non-existent subcommand but 0 exit status"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- test_usage_output err "$cmd"
|
|
||||||
+ test_usage_output err "$regex"
|
|
||||||
assert_file_has_content err 'Unknown \("[^"]*" sub\)\?command'
|
|
||||||
assert_file_empty out
|
|
||||||
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
Fix-test-help.sh-for-the-case-where-ostree-trivial-httpd-.patch
|
|
||||||
Fix-JavaScript-tests-with-gjs-1.50.0.patch
|
Fix-JavaScript-tests-with-gjs-1.50.0.patch
|
||||||
|
test-help.sh-Skip-trivial-httpd-if-enabled.patch
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
From: Simon McVittie <smcv@collabora.com>
|
||||||
|
Date: Fri, 15 Sep 2017 16:05:48 +0100
|
||||||
|
Subject: test-help.sh: Skip trivial-httpd if enabled
|
||||||
|
|
||||||
|
Because it runs a binary in ${libexecdir}, it will only work if
|
||||||
|
libostree was already installed, which makes the build-time test fail.
|
||||||
|
It also doesn't produce the output we expect: its usage mechanism
|
||||||
|
mentions "ostree-trivial-httpd", not "ostree trivial-httpd".
|
||||||
|
|
||||||
|
Signed-off-by: Simon McVittie <smcv@collabora.com>
|
||||||
|
---
|
||||||
|
tests/test-help.sh | 11 ++++++++++-
|
||||||
|
1 file changed, 10 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/tests/test-help.sh b/tests/test-help.sh
|
||||||
|
index 75fe0c1..ad74aaf 100755
|
||||||
|
--- a/tests/test-help.sh
|
||||||
|
+++ b/tests/test-help.sh
|
||||||
|
@@ -75,7 +75,16 @@ test_recursive() {
|
||||||
|
assert_file_empty out
|
||||||
|
|
||||||
|
for subcmd in $builtins; do
|
||||||
|
- test_recursive "$cmd $subcmd"
|
||||||
|
+ case "$subcmd" in
|
||||||
|
+ (trivial-httpd)
|
||||||
|
+ # Skip trivial-httpd if enabled, it doesn't work
|
||||||
|
+ # uninstalled (and also doesn't produce the output
|
||||||
|
+ # we expect).
|
||||||
|
+ ;;
|
||||||
|
+ (*)
|
||||||
|
+ test_recursive "$cmd $subcmd"
|
||||||
|
+ ;;
|
||||||
|
+ esac
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue