diff mbox series

PATCH: testsuite debuginfod

Message ID 20210930145030.GC11484@redhat.com
State Under Review
Headers show
Series PATCH: testsuite debuginfod | expand

Commit Message

Frank Ch. Eigler Sept. 30, 2021, 2:50 p.m. UTC
commit 85602ff68179053f19a2005df4fc653a69757584 (HEAD -> master)
Author: Frank Ch. Eigler <fche@redhat.com>
Date:   Thu Sep 30 10:48:00 2021 -0400

    debuginfod testsuite: Use ! CMD syntax.
    
    Previously, we had a mishmash of iffy && || constructs to
    reverse the rc of a subprocess that we expected to fail.
    Now use
       ! CMD
    or
       ! (CMD | CMD)
    more systematically where possible.
    
    Signed-off-by: Frank Ch. Eigler <fche@redhat.com>

Comments

Mark Wielaard Oct. 5, 2021, 4:55 p.m. UTC | #1
Hi Frank,

On Thu, 2021-09-30 at 10:50 -0400, Frank Ch. Eigler via Elfutils-devel
wrote:
> commit 85602ff68179053f19a2005df4fc653a69757584 (HEAD -> master)
> Author: Frank Ch. Eigler <fche@redhat.com>
> Date:   Thu Sep 30 10:48:00 2021 -0400
> 
>     debuginfod testsuite: Use ! CMD syntax.
>     
>     Previously, we had a mishmash of iffy && || constructs to
>     reverse the rc of a subprocess that we expected to fail.
>     Now use
>        ! CMD
>     or
>        ! (CMD | CMD)
>     more systematically where possible.
>     
>     Signed-off-by: Frank Ch. Eigler <fche@redhat.com>

Thanks, the && || conditionals do make my head hurt (I am not as
logical as I like). This looks much simpler.

I wish we can use this. But we use -e to make any failing command
(pipeline) fail the script/test. And man bash says (under -e Exit
immediately):

   The shell does not exit if the command that fails is part of the
   command list immediately following a while or until keyword, part
   of the test following the if or elif reserved words, part of any
   command executed in a && or || list except the command following
   the final && or ||, any command in a pipeline but the last, or if
   the command's return value is being inverted with !.

So I am afraid any '! should_fail_but_does_not' will not actually exit
and so doesn't FAIL the test. Could you double check that?

Thanks,

Mark
diff mbox series

Patch

diff --git a/tests/ChangeLog b/tests/ChangeLog
index b62bb3507fd1..578e8cb15502 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,7 @@ 
+2021-09-30  Frank Ch. Eigler  <fche@redhat.com>
+
+	* run-debuginfod-*.sh: Use ! CMD to assert expected failure.
+
 2021-09-17  Noah Sanci  <nsanci@redhat.com>
 
 	* run-debuginfod-response-header.sh: removed checking for Connection
diff --git a/tests/run-debuginfod-000-permission.sh b/tests/run-debuginfod-000-permission.sh
index 1e92bdb8cc34..8480ad486886 100755
--- a/tests/run-debuginfod-000-permission.sh
+++ b/tests/run-debuginfod-000-permission.sh
@@ -50,7 +50,7 @@  ps -q $PID1 -e -L -o '%p %c %a' | grep traverse
 rm -rf $DEBUGINFOD_CACHE_PATH # clean it from previous tests
 
 # The query is designed to fail, while the 000-permission file should be created.
-testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo 01234567 || true
+! testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo 01234567
 if [ ! -f $DEBUGINFOD_CACHE_PATH/01234567/debuginfo ]; then
   echo "could not find cache in $DEBUGINFOD_CACHE_PATH"
   err
@@ -62,7 +62,7 @@  if [ -r $DEBUGINFOD_CACHE_PATH/01234567/debuginfo ]; then
 fi
 
 bytecount_before=`curl -s http://127.0.0.1:$PORT1/metrics | grep 'http_responses_transfer_bytes_count{code="404"}'`
-testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo 01234567 || true
+! testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo 01234567
 bytecount_after=`curl -s http://127.0.0.1:$PORT1/metrics | grep 'http_responses_transfer_bytes_count{code="404"}'`
 if [ "$bytecount_before" != "$bytecount_after" ]; then
   echo "http_responses_transfer_bytes_count{code="404"} has changed."
@@ -73,7 +73,7 @@  fi
 echo 0 > $DEBUGINFOD_CACHE_PATH/cache_miss_s
 sleep 1
 bytecount_before=`curl -s http://127.0.0.1:$PORT1/metrics | grep 'http_responses_transfer_bytes_count{code="404"}'`
-testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo 01234567 || true
+! testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo 01234567
 bytecount_after=`curl -s http://127.0.0.1:$PORT1/metrics | grep 'http_responses_transfer_bytes_count{code="404"}'`
 if [ "$bytecount_before" == "$bytecount_after" ]; then
   echo "http_responses_transfer_bytes_count{code="404"} should be incremented."
diff --git a/tests/run-debuginfod-archive-groom.sh b/tests/run-debuginfod-archive-groom.sh
index 7813ee28b8f2..3a062ed278d6 100755
--- a/tests/run-debuginfod-archive-groom.sh
+++ b/tests/run-debuginfod-archive-groom.sh
@@ -154,10 +154,10 @@  wait_ready $PORT1 'groomed_total{decision="stale"}' 4
 rm -rf $DEBUGINFOD_CACHE_PATH # clean it from previous tests
 
 # this is one of the buildids from the groom-deleted rpms
-testrun ${abs_top_builddir}/debuginfod/debuginfod-find executable $RPM_BUILDID && false || true
+! testrun ${abs_top_builddir}/debuginfod/debuginfod-find executable $RPM_BUILDID
 
 # but this one was not deleted so should be still around
-testrun ${abs_top_builddir}/debuginfod/debuginfod-find executable $BUILDID || true
+testrun ${abs_top_builddir}/debuginfod/debuginfod-find executable $BUILDID
 
 kill $PID1
 wait $PID1
diff --git a/tests/run-debuginfod-duplicate-urls.sh b/tests/run-debuginfod-duplicate-urls.sh
index 50e39cb2df95..fbcae4716977 100755
--- a/tests/run-debuginfod-duplicate-urls.sh
+++ b/tests/run-debuginfod-duplicate-urls.sh
@@ -41,8 +41,8 @@  wait_ready $PORT1 'ready' 1
 ## PR27983
 # Ensure no duplicate urls are used in when querying servers for files
 rm -rf $DEBUGINFOD_CACHE_PATH # clean it from previous tests
-env DEBUGINFOD_URLS="http://127.0.0.1:$PORT1 http://127.0.0.1:$PORT1 http://127.0.0.1:$PORT1 http://127.0.0.1:7999" \
- LD_LIBRARY_PATH=$ldpath ${abs_top_builddir}/debuginfod/debuginfod-find -vvv executable 0 > vlog1 2>&1 || true
+! env DEBUGINFOD_URLS="http://127.0.0.1:$PORT1 http://127.0.0.1:$PORT1 http://127.0.0.1:$PORT1 http://127.0.0.1:7999" \
+ LD_LIBRARY_PATH=$ldpath ${abs_top_builddir}/debuginfod/debuginfod-find -vvv executable 0 > vlog1 2>&1
 tempfiles vlog1
 cat vlog1
 if [ $( grep -c 'duplicate url: http://127.0.0.1:'$PORT1'.*' vlog1 ) -ne 2 ]; then
diff --git a/tests/run-debuginfod-fd-prefetch-caches.sh b/tests/run-debuginfod-fd-prefetch-caches.sh
index 7fbf7b20a6e8..f65ec31b9a9c 100755
--- a/tests/run-debuginfod-fd-prefetch-caches.sh
+++ b/tests/run-debuginfod-fd-prefetch-caches.sh
@@ -50,7 +50,7 @@  grep 'fdcache mbs ' vlog$PORT1 #$FDCACHE_MBS
 grep 'prefetch fds ' vlog$PORT1 #$PREFETCH_FDS
 grep 'prefetch mbs ' vlog$PORT1 #$PREFETCH_MBS
 # search the vlog to find what metric counts should be and check the correct metrics
-# were incrimented
+# were incremented
 enqueue_nr=$(grep -c 'interned.*front=1' vlog$PORT1 || true)
 wait_ready $PORT1 'fdcache_op_count{op="enqueue"}' $enqueue_nr
 evict_nr=$(grep -c 'evicted a=.*' vlog$PORT1 || true)
diff --git a/tests/run-debuginfod-federation-link.sh b/tests/run-debuginfod-federation-link.sh
index 1347e7b8cc21..1dc6b8b17a6b 100755
--- a/tests/run-debuginfod-federation-link.sh
+++ b/tests/run-debuginfod-federation-link.sh
@@ -124,7 +124,7 @@  testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo $BUILDID
 
 # send a request to stress XFF and User-Agent federation relay;
 # we'll grep for the two patterns in vlog$PORT1
-curl -s -H 'User-Agent: TESTCURL' -H 'X-Forwarded-For: TESTXFF' $DEBUGINFOD_URLS/buildid/deaddeadbeef00000000/debuginfo -o /dev/null || true
+! curl -s -H 'User-Agent: TESTCURL' -H 'X-Forwarded-For: TESTXFF' $DEBUGINFOD_URLS/buildid/deaddeadbeef00000000/debuginfo -o /dev/null
 
 grep UA:TESTCURL vlog$PORT1
 grep XFF:TESTXFF vlog$PORT1
@@ -136,7 +136,7 @@  file L/foo
 file -L L/foo
 export DEBUGINFOD_URLS=http://127.0.0.1:$PORT1
 rm -rf $DEBUGINFOD_CACHE_PATH
-testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo $BUILDID && false || true
+! testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo $BUILDID
 rm -f $DEBUGINFOD_CACHE_PATH/$BUILDID/debuginfo # drop 000-perm negative-hit file
 export DEBUGINFOD_URLS=http://127.0.0.1:$PORT2
 testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo $BUILDID
@@ -144,7 +144,7 @@  testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo $BUILDID
 # test again with scheme free url
 export DEBUGINFOD_URLS=127.0.0.1:$PORT1
 rm -rf $DEBUGINFOD_CACHE_PATH
-testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo $BUILDID && false || true
+! testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo $BUILDID
 rm -f $DEBUGINFOD_CACHE_PATH/$BUILDID/debuginfo # drop 000-perm negative-hit file
 export DEBUGINFOD_URLS=127.0.0.1:$PORT2
 testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo $BUILDID
diff --git a/tests/run-debuginfod-federation-metrics.sh b/tests/run-debuginfod-federation-metrics.sh
index 2d0fd6d42c1f..448eae268346 100755
--- a/tests/run-debuginfod-federation-metrics.sh
+++ b/tests/run-debuginfod-federation-metrics.sh
@@ -118,7 +118,7 @@  testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo $BUILDID
 
 # send a request to stress XFF and User-Agent federation relay;
 # we'll grep for the two patterns in vlog$PORT1
-curl -s -H 'User-Agent: TESTCURL' -H 'X-Forwarded-For: TESTXFF' $DEBUGINFOD_URLS/buildid/deaddeadbeef00000000/debuginfo -o /dev/null || true
+! curl -s -H 'User-Agent: TESTCURL' -H 'X-Forwarded-For: TESTXFF' $DEBUGINFOD_URLS/buildid/deaddeadbeef00000000/debuginfo -o /dev/null
 
 grep UA:TESTCURL vlog$PORT1
 grep XFF:TESTXFF vlog$PORT1
@@ -130,7 +130,7 @@  file L/foo
 file -L L/foo
 export DEBUGINFOD_URLS=http://127.0.0.1:$PORT1
 rm -rf $DEBUGINFOD_CACHE_PATH
-testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo $BUILDID && false || true
+! testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo $BUILDID
 rm -f $DEBUGINFOD_CACHE_PATH/$BUILDID/debuginfo # drop 000-perm negative-hit file
 export DEBUGINFOD_URLS=http://127.0.0.1:$PORT2
 testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo $BUILDID
@@ -138,7 +138,7 @@  testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo $BUILDID
 # test again with scheme free url
 export DEBUGINFOD_URLS=127.0.0.1:$PORT1
 rm -rf $DEBUGINFOD_CACHE_PATH
-testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo $BUILDID && false || true
+! testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo $BUILDID
 rm -f $DEBUGINFOD_CACHE_PATH/$BUILDID/debuginfo # drop 000-perm negative-hit file
 export DEBUGINFOD_URLS=127.0.0.1:$PORT2
 testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo $BUILDID
@@ -166,13 +166,13 @@  curl -s http://127.0.0.1:$PORT1/metrics | grep 'traversed_total'
 curl -s http://127.0.0.1:$PORT1/metrics | grep 'scanned_bytes_total'
 
 # And generate a few errors into the second debuginfod's logs, for analysis just below
-curl -s http://127.0.0.1:$PORT2/badapi > /dev/null || true
-curl -s http://127.0.0.1:$PORT2/buildid/deadbeef/debuginfo > /dev/null || true
+! curl -s http://127.0.0.1:$PORT2/badapi > /dev/null
+! curl -s http://127.0.0.1:$PORT2/buildid/deadbeef/debuginfo > /dev/null
 # NB: this error is used to seed the 404 failure for the survive-404 tests
 
 # Confirm bad artifact types are rejected without leaving trace
-curl -s http://127.0.0.1:$PORT2/buildid/deadbeef/badtype > /dev/null || true
-(curl -s http://127.0.0.1:$PORT2/metrics | grep 'badtype') && false
+! curl -s http://127.0.0.1:$PORT2/buildid/deadbeef/badtype > /dev/null
+! (curl -s http://127.0.0.1:$PORT2/metrics | grep 'badtype')
 
 # Confirm that reused curl connections survive 404 errors.
 # The rm's force an uncached fetch (in both servers and client cache)
diff --git a/tests/run-debuginfod-federation-sqlite.sh b/tests/run-debuginfod-federation-sqlite.sh
index 45761ed73dff..71d594921fad 100755
--- a/tests/run-debuginfod-federation-sqlite.sh
+++ b/tests/run-debuginfod-federation-sqlite.sh
@@ -105,7 +105,7 @@  testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo $BUILDID
 
 # send a request to stress XFF and User-Agent federation relay;
 # we'll grep for the two patterns in vlog$PORT1
-curl -s -H 'User-Agent: TESTCURL' -H 'X-Forwarded-For: TESTXFF' $DEBUGINFOD_URLS/buildid/deaddeadbeef00000000/debuginfo -o /dev/null || true
+! curl -s -H 'User-Agent: TESTCURL' -H 'X-Forwarded-For: TESTXFF' $DEBUGINFOD_URLS/buildid/deaddeadbeef00000000/debuginfo -o /dev/null
 
 grep UA:TESTCURL vlog$PORT1
 grep XFF:TESTXFF vlog$PORT1
@@ -117,7 +117,7 @@  file L/foo
 file -L L/foo
 export DEBUGINFOD_URLS=http://127.0.0.1:$PORT1
 rm -rf $DEBUGINFOD_CACHE_PATH
-testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo $BUILDID && false || true
+! testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo $BUILDID
 rm -f $DEBUGINFOD_CACHE_PATH/$BUILDID/debuginfo # drop 000-perm negative-hit file
 export DEBUGINFOD_URLS=http://127.0.0.1:$PORT2
 testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo $BUILDID
@@ -125,7 +125,7 @@  testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo $BUILDID
 # test again with scheme free url
 export DEBUGINFOD_URLS=127.0.0.1:$PORT1
 rm -rf $DEBUGINFOD_CACHE_PATH
-testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo $BUILDID && false || true
+! testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo $BUILDID
 rm -f $DEBUGINFOD_CACHE_PATH/$BUILDID/debuginfo # drop 000-perm negative-hit file
 export DEBUGINFOD_URLS=127.0.0.1:$PORT2
 testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo $BUILDID
@@ -136,13 +136,13 @@  export DEBUGINFOD_URLS="BAD http://127.0.0.1:$PORT1 127.0.0.1:$PORT1 http://127.
 testrun ${abs_builddir}/debuginfod_build_id_find -e F/prog 1
 
 # And generate a few errors into the second debuginfod's logs, for analysis just below
-curl -s http://127.0.0.1:$PORT2/badapi > /dev/null || true
-curl -s http://127.0.0.1:$PORT2/buildid/deadbeef/debuginfo > /dev/null || true
+! curl -s http://127.0.0.1:$PORT2/badapi > /dev/null
+! curl -s http://127.0.0.1:$PORT2/buildid/deadbeef/debuginfo > /dev/null
 # NB: this error is used to seed the 404 failure for the survive-404 tests
 
 # Confirm bad artifact types are rejected without leaving trace
-curl -s http://127.0.0.1:$PORT2/buildid/deadbeef/badtype > /dev/null || true
-(curl -s http://127.0.0.1:$PORT2/metrics | grep 'badtype') && false
+! curl -s http://127.0.0.1:$PORT2/buildid/deadbeef/badtype > /dev/null
+! (curl -s http://127.0.0.1:$PORT2/metrics | grep 'badtype')
 
 # Confirm that reused curl connections survive 404 errors.
 # The rm's force an uncached fetch (in both servers and client cache)
@@ -179,7 +179,7 @@  wait_ready $PORT1 'thread_work_pending{role="scan"}' 0
 wait_ready $PORT1 'thread_busy{role="scan"}' 0
 kill -USR2 $PID1
 wait_ready $PORT1 'thread_work_total{role="groom"}' 2
-curl -s http://127.0.0.1:$PORT1/buildid/beefbeefbeefd00dd00d/debuginfo > /dev/null || true
+! curl -s http://127.0.0.1:$PORT1/buildid/beefbeefbeefd00dd00d/debuginfo > /dev/null
 curl -s http://127.0.0.1:$PORT1/metrics | grep 'error_count.*sqlite'
 # Run the tests again without the servers running. The target file should
 # be found in the cache.
diff --git a/tests/run-debuginfod-file.sh b/tests/run-debuginfod-file.sh
index 341bbc6813ad..7289bf65485f 100755
--- a/tests/run-debuginfod-file.sh
+++ b/tests/run-debuginfod-file.sh
@@ -31,7 +31,7 @@  mkdir -p ${local_dir}
 echo "int main() { return 0; }" > ${local_dir}/main.c
 # first test that is doesn't work, when no DEBUGINFOD_URLS is set
 export DEBUGINFOD_URLS=""
-testrun ${abs_top_builddir}/debuginfod/debuginfod-find source aaaaaaaaaabbbbbbbbbbccccccccccdddddddddd /my/path/main.c && false || true
+! testrun ${abs_top_builddir}/debuginfod/debuginfod-find source aaaaaaaaaabbbbbbbbbbccccccccccdddddddddd /my/path/main.c
 
 # Now test is with proper DEBUGINFOD_URLS
 export DEBUGINFOD_URLS="file://${PWD}/mocktree/"
diff --git a/tests/run-debuginfod-malformed.sh b/tests/run-debuginfod-malformed.sh
index 3bc9e7995844..2616c6ee91b0 100755
--- a/tests/run-debuginfod-malformed.sh
+++ b/tests/run-debuginfod-malformed.sh
@@ -95,7 +95,7 @@  echo 0 > $DEBUGINFOD_CACHE_PATH/max_unused_age_s
 
 testrun ${abs_builddir}/debuginfod_build_id_find -e F/p+r%o\$g 1
 
-testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo $BUILDID && false || true
+! testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo $BUILDID
 
 if [ ! -f $DEBUGINFOD_CACHE_PATH/malformed0 ] \
     || [ ! -f $DEBUGINFOD_CACHE_PATH/malformed/malformed1 ]; then
diff --git a/tests/run-debuginfod-percent-escape.sh b/tests/run-debuginfod-percent-escape.sh
index f7d8dc66ea48..d8ececb23541 100755
--- a/tests/run-debuginfod-percent-escape.sh
+++ b/tests/run-debuginfod-percent-escape.sh
@@ -49,8 +49,8 @@  wait_ready $PORT1 'thread_work_pending{role="scan"}' 0
 wait_ready $PORT1 'thread_busy{role="scan"}' 0
 rm -rf $DEBUGINFOD_CACHE_PATH # clean it from previous tests
 ls F
-env DEBUGINFOD_CACHE_PATH=${PWD}/.client_cache DEBUGINFOD_URLS="http://127.0.0.1:$PORT1" \
-    LD_LIBRARY_PATH=$ldpath ${abs_top_builddir}/debuginfod/debuginfod-find -vvv source F/p++r\$\#o^^g ${abs_builddir}/F/p++r\$\#o^^g.c > vlog1 2>&1 || true
+! env DEBUGINFOD_CACHE_PATH=${PWD}/.client_cache DEBUGINFOD_URLS="http://127.0.0.1:$PORT1" \
+    LD_LIBRARY_PATH=$ldpath ${abs_top_builddir}/debuginfod/debuginfod-find -vvv source F/p++r\$\#o^^g ${abs_builddir}/F/p++r\$\#o^^g.c > vlog1 2>&1
 tempfiles vlog1
 grep 'F/p%2B%2Br%24%23o%5E%5Eg.c' vlog1
 
diff --git a/tests/run-debuginfod-sizetime.sh b/tests/run-debuginfod-sizetime.sh
index 2cf6f252c50d..28a872d4cee3 100755
--- a/tests/run-debuginfod-sizetime.sh
+++ b/tests/run-debuginfod-sizetime.sh
@@ -50,8 +50,8 @@  wait_ready $PORT1 'thread_busy{role="scan"}' 0
 ## PR27892
 # Ensure DEBUGINFOD_MAXSIZE is functional and sends back the correct http
 # code
-env LD_LIBRARY_PATH=$ldpath DEBUGINFOD_RETRY_LIMIT=1 DEBUGINFOD_URLS="http://127.0.0.1:$PORT1/" DEBUGINFOD_MAXSIZE=1 \
-    ${abs_top_builddir}/debuginfod/debuginfod-find -v executable ${PWD}/prog 2> find-vlog$PORT1 || true
+! (env LD_LIBRARY_PATH=$ldpath DEBUGINFOD_RETRY_LIMIT=1 DEBUGINFOD_URLS="http://127.0.0.1:$PORT1/" DEBUGINFOD_MAXSIZE=1 \
+    ${abs_top_builddir}/debuginfod/debuginfod-find -v executable ${PWD}/prog 2> find-vlog$PORT1)
 tempfiles find-vlog$PORT1
 errfiles  find-vlog$PORT1
 echo "Checking maxsize"
@@ -65,8 +65,8 @@  if [ -f ${DEBUGINFOD_CACHE_PATH}/${BUILDID} ]; then
   err
 fi
 # Ensure no file is downloaded for longer than DEBUGINFOD_MAXTIME
-env LD_LIBRARY_PATH=$ldpath DEBUGINFOD_URLS="http://127.0.0.1:$PORT1/" DEBUGINFOD_MAXTIME=1 \
-    ${abs_top_builddir}/debuginfod/debuginfod-find -v debuginfo ${PWD}/prog.debug 2> find-vlog$PORT1 || true
+! (env LD_LIBRARY_PATH=$ldpath DEBUGINFOD_URLS="http://127.0.0.1:$PORT1/" DEBUGINFOD_MAXTIME=1 \
+    ${abs_top_builddir}/debuginfod/debuginfod-find -v debuginfo ${PWD}/prog.debug 2> find-vlog$PORT1)
 tempfiles find-vlog$PORT1
 grep 'using max time' find-vlog$PORT1
 # Ensure p+r%o\$g.debug is NOT cached
diff --git a/tests/run-debuginfod-x-forwarded-for.sh b/tests/run-debuginfod-x-forwarded-for.sh
index 5b756b22f86e..e5262ebd1408 100755
--- a/tests/run-debuginfod-x-forwarded-for.sh
+++ b/tests/run-debuginfod-x-forwarded-for.sh
@@ -45,11 +45,11 @@  wait_ready $PORT1 'ready' 1
 wait_ready $PORT2 'ready' 1
 
 export DEBUGINFOD_URLS="http://127.0.0.1:$PORT1/"
-testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo 01234567 || true
+! testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo 01234567
 
 # Use a different buildid to avoid using same cache.
 export DEBUGINFOD_URLS="http://127.0.0.1:$PORT2/"
-testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo 11234567 || true
+! testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo 11234567
 
 grep "forwared-ttl-limit reached and will not query the upstream servers" vlog$PORT1
 grep -v "forwared-ttl-limit reached and will not query the upstream servers" vlog$PORT2 | grep "not found" vlog$PORT2