From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (wildebeest.demon.nl [212.238.236.112]) by sourceware.org (Postfix) with ESMTPS id 819F63857402 for ; Thu, 9 Sep 2021 21:12:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 819F63857402 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org Received: from reform (deer0x11.wildebeest.org [172.31.17.147]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 16ED73000913; Thu, 9 Sep 2021 23:12:29 +0200 (CEST) Received: by reform (Postfix, from userid 1000) id B1CDF2E81595; Thu, 9 Sep 2021 23:12:29 +0200 (CEST) Date: Thu, 9 Sep 2021 23:12:29 +0200 From: Mark Wielaard To: elfutils-devel@sourceware.org Subject: Re: [COMMITTED] tests: Cleanup error handling and don't share cache between servers/client Message-ID: References: <20210909165810.26719-1-mark@klomp.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="S0OokrZPamWdCWar" Content-Disposition: inline In-Reply-To: <20210909165810.26719-1-mark@klomp.org> X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2021 21:12:33 -0000 --S0OokrZPamWdCWar Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, On Thu, Sep 09, 2021 at 06:58:10PM +0200, Mark Wielaard wrote: > Also the error handler for debuginfod tests wasn't called when a > command inside a function failed. Since testrun is a function, there > would be no metrics or error log files listed if the testrun command > failed. Making it hard to see what went wrong. Fix this by using > set -o errtrace So that showed run-debuginfod-fd-prefetch-caches.sh "failed". I "fixed" that with the attached patch which I just committed. And also make the cleanup and error handling slightly better (by only doing it once). But it doesn't really "fix" run-debuginfod-fd-prefetch-caches.sh. It now just does nothing. The debuginfod server gets to scan a non-existing directory and then nothing even tries to query anything from the server. So nothing ever gets prefetched. And testing for zero happily succeeds. Noah, could you take a peek at this testcase and see if you can make it do something "real"? Thanks, Mark --S0OokrZPamWdCWar Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-tests-Don-t-fail-run-debuginfod-fd-prefetch-caches.s.patch" >From bbf0dc0162e82770f296b2ecda77a2b5bd6f7405 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Thu, 9 Sep 2021 21:51:51 +0200 Subject: [PATCH] tests: Don't fail run-debuginfod-fd-prefetch-caches.sh if grep -c fails The set -o errtrace made run-debuginfod-fd-prefetch-caches.sh fail. On some systems. Add set -o functrace to make it fail consistently. The failure is because the grep -c for in the log file fails (it returns zero). Fix this by using || true. But this is only a workaround. It makes the test pass, but only because all values are always zero. The test doesn't currently test anything. Also make sure that err and cleanup are only executed once. Signed-off-by: Mark Wielaard --- tests/ChangeLog | 7 +++++++ tests/debuginfod-subr.sh | 7 +++++++ tests/run-debuginfod-fd-prefetch-caches.sh | 12 ++++++++---- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/tests/ChangeLog b/tests/ChangeLog index 05b31fd8..caee93d3 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,10 @@ +2021-09-09 Mark Wielaard + + * debuginfod-subr.sh: set -o functrace. + (cleanup): Disable trap 0. + (err): Disable trap ERR. + * run-debuginfod-fd-prefetch-caches.sh: Use || true when grep -c fails. + 2021-09-09 Mark Wielaard * debuginfod-subr.sh: set -o errtrace. diff --git a/tests/debuginfod-subr.sh b/tests/debuginfod-subr.sh index c21b7b8a..59033f35 100755 --- a/tests/debuginfod-subr.sh +++ b/tests/debuginfod-subr.sh @@ -17,6 +17,7 @@ # sourced from run-debuginfod-*.sh tests (must be bash scripts) # We trap ERR and like commands that fail in function to also trap +set -o functrace set -o errtrace . $srcdir/test-subr.sh # includes set -e @@ -30,6 +31,9 @@ echo "zstd=$zstd bsdtar=`bsdtar --version`" cleanup() { + # No more cleanups after this cleanup + trap - 0 + if [ $PID1 -ne 0 ]; then kill $PID1 || : ; wait $PID1 || :; fi if [ $PID2 -ne 0 ]; then kill $PID2 || : ; wait $PID2 || :; fi rm -rf F R D L Z ${PWD}/foobar ${PWD}/mocktree ${PWD}/.client_cache* ${PWD}/tmp* @@ -41,6 +45,9 @@ trap cleanup 0 errfiles_list= err() { + # Don't trap any new errors from now on + trap - ERR + echo ERROR REPORTS for port in $PORT1 $PORT2 do diff --git a/tests/run-debuginfod-fd-prefetch-caches.sh b/tests/run-debuginfod-fd-prefetch-caches.sh index 61fee9e9..7fbf7b20 100755 --- a/tests/run-debuginfod-fd-prefetch-caches.sh +++ b/tests/run-debuginfod-fd-prefetch-caches.sh @@ -51,10 +51,14 @@ 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 -wait_ready $PORT1 'fdcache_op_count{op="enqueue"}' $( grep -c 'interned.*front=1' vlog$PORT1 ) -wait_ready $PORT1 'fdcache_op_count{op="evict"}' $( grep -c 'evicted a=.*' vlog$PORT1 ) -wait_ready $PORT1 'fdcache_op_count{op="prefetch_enqueue"}' $( grep -c 'interned.*front=0' vlog$PORT1 ) -wait_ready $PORT1 'fdcache_op_count{op="prefetch_evict"}' $( grep -c 'evicted from prefetch a=.*front=0' vlog$PORT1 || true ) +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) +wait_ready $PORT1 'fdcache_op_count{op="evict"}' $evict_nr +prefetch_enqueue_nr=$(grep -c 'interned.*front=0' vlog$PORT1 || true) +wait_ready $PORT1 'fdcache_op_count{op="prefetch_enqueue"}' $prefetch_enqueue_nr +prefetch_evict_nr=$(grep -c 'evicted from prefetch a=.*front=0' vlog$PORT1 || true) +wait_ready $PORT1 'fdcache_op_count{op="prefetch_evict"}' $prefetch_evict_nr kill $PID1 wait $PID1 -- 2.32.0 --S0OokrZPamWdCWar--