2021-09-09 Mark Wielaard <mark@klomp.org>
+ * 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 <mark@klomp.org>
+
* debuginfod-subr.sh: set -o errtrace.
(cleanup): Don't fail kill or wait. Only trap on normal exit.
(err): Don't fail curl metrics. Call cleanup.
# 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
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*
errfiles_list=
err() {
+ # Don't trap any new errors from now on
+ trap - ERR
+
echo ERROR REPORTS
for port in $PORT1 $PORT2
do
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