]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
debuginfod test: assert curl & rpm2cpio during test prologue
authorFrank Ch. Eigler <fche@redhat.com>
Mon, 3 Feb 2020 19:11:53 +0000 (14:11 -0500)
committerFrank Ch. Eigler <fche@redhat.com>
Mon, 3 Feb 2020 19:11:53 +0000 (14:11 -0500)
On debian & ubuntu hosts, rpm2cpio is not available by default,
and heck, curl might not be either.  Check for both these programs
during tests/run-debuginfod-find.sh startup, else exit-77 (skip).

Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
tests/run-debuginfod-find.sh

index 83ab3388f6e9963ab35954afd15cf757bf3856a5..6b5dbf8421a6eedb14a8d10aa3f41a60a6284b69 100755 (executable)
@@ -18,6 +18,9 @@
 
 . $srcdir/test-subr.sh  # includes set -e
 
+type curl 2>/dev/null || (echo "need curl"; exit 77)
+type rpm2cpio 2>/dev/null || (echo "need rpm2cpio"; exit 77)
+
 # for test case debugging, uncomment:
 # set -x
 # VERBOSE=-vvvv
@@ -330,15 +333,13 @@ testrun ${abs_builddir}/debuginfod_build_id_find -e F/prog2 1
 
 ########################################################################
 
-# Fetch some metrics, if curl program is installed
-if type curl 2>/dev/null; then
-    curl -s http://127.0.0.1:$PORT1/badapi
-    curl -s http://127.0.0.1:$PORT1/metrics
-    curl -s http://127.0.0.1:$PORT2/metrics
-    curl -s http://127.0.0.1:$PORT1/metrics | grep -q 'http_responses_total.*result.*error'
-    curl -s http://127.0.0.1:$PORT1/metrics | grep -q 'http_responses_total.*result.*fdcache'
-    curl -s http://127.0.0.1:$PORT2/metrics | grep -q 'http_responses_total.*result.*upstream'
-fi
+# Fetch some metrics
+curl -s http://127.0.0.1:$PORT1/badapi
+curl -s http://127.0.0.1:$PORT1/metrics
+curl -s http://127.0.0.1:$PORT2/metrics
+curl -s http://127.0.0.1:$PORT1/metrics | grep -q 'http_responses_total.*result.*error'
+curl -s http://127.0.0.1:$PORT1/metrics | grep -q 'http_responses_total.*result.*fdcache'
+curl -s http://127.0.0.1:$PORT2/metrics | grep -q 'http_responses_total.*result.*upstream'
 
 ########################################################################