]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
tests: Make sure to wait for initial scan and groom cycle
authorMark Wielaard <mark@klomp.org>
Mon, 6 Sep 2021 23:50:51 +0000 (01:50 +0200)
committerMark Wielaard <mark@klomp.org>
Mon, 6 Sep 2021 23:50:51 +0000 (01:50 +0200)
At startup the debuginfod server does a scan and groom cycle. Make
sure to wait for that before triggering a new one with SIGUSR1 or
SIGURST2.

Signed-off-by: Mark Wielaard <mark@klomp.org>
14 files changed:
tests/ChangeLog
tests/run-debuginfod-archive-groom.sh
tests/run-debuginfod-archive-rename.sh
tests/run-debuginfod-archive-test.sh
tests/run-debuginfod-artifact-running.sh
tests/run-debuginfod-dlopen.sh
tests/run-debuginfod-extraction.sh
tests/run-debuginfod-federation-link.sh
tests/run-debuginfod-federation-metrics.sh
tests/run-debuginfod-federation-sqlite.sh
tests/run-debuginfod-malformed.sh
tests/run-debuginfod-regex.sh
tests/run-debuginfod-tmp-home.sh
tests/run-debuginfod-writable.sh

index 436a1c452f173290bff3753a1d62c439525eb6b5..61080c52d4e23afc4b981d9214c671b86e82bc0e 100644 (file)
@@ -1,3 +1,20 @@
+2021-09-06  Mark Wielaard  <mark@klomp.org>
+
+       * run-debuginfod-archive-groom.sh: Wait for initial scan and groom
+       cycle.
+       * run-debuginfod-archive-rename.sh: Likewise.
+       * run-debuginfod-federation-sqlite.sh: Likewise.
+       * run-debuginfod-archive-test.sh: Wait for initial scan cycle.
+       * run-debuginfod-artifact-running.sh: Likewise.
+       * run-debuginfod-dlopen.sh: Likewise.
+       * run-debuginfod-extraction.sh: Likewise.
+       * run-debuginfod-federation-link.sh: Likewise.
+       * run-debuginfod-federation-metrics.sh: Likewise.
+       * run-debuginfod-malformed.sh: Likewise.
+       * run-debuginfod-regex.sh: Likewise.
+       * run-debuginfod-tmp-home.sh: Likewise.
+       * run-debuginfod-writable.sh: Likewise.
+
 2021-09-06  Mark Wielaard  <mark@klomp.org>
 
        * run-debuginfod-archive-groom.sh: Set DEBUGINFOD_URLS after starting
index 1e61644809a7fe2c25f50b9bb1d6fa6d4e03c259..1e7bd67a8d5f0c15a1700d89855afcbaebe22d44 100755 (executable)
@@ -57,9 +57,12 @@ cp -rvp ${abs_srcdir}/debuginfod-rpms R
 if [ "$zstd" = "false" ]; then  # nuke the zstd fedora 31 ones
     rm -vrf R/debuginfod-rpms/fedora31
 fi
+
+# wait till the initial scan is done before triggering a new one
+wait_ready $PORT1 'thread_work_total{role="traverse"}' 1
 kill -USR1 $PID1
 # Now there should be 1 files in the index
-wait_ready $PORT1 'thread_work_total{role="traverse"}' 1
+wait_ready $PORT1 'thread_work_total{role="traverse"}' 2
 wait_ready $PORT1 'thread_work_pending{role="scan"}' 0
 wait_ready $PORT1 'thread_busy{role="scan"}' 0
 
@@ -72,7 +75,7 @@ tempfiles vlog3
 cp -rvp ${abs_srcdir}/debuginfod-tars Z
 kill -USR1 $PID1
 # Wait till both files are in the index and scan/index fully finished
-wait_ready $PORT1 'thread_work_total{role="traverse"}' 2
+wait_ready $PORT1 'thread_work_total{role="traverse"}' 3
 wait_ready $PORT1 'thread_work_pending{role="scan"}' 0
 wait_ready $PORT1 'thread_busy{role="scan"}' 0
 ########################################################################
@@ -83,7 +86,7 @@ txz=$(find Z -name \*tar.xz | wc -l)
 
 kill -USR1 $PID1  # two hits of SIGUSR1 may be needed to resolve .debug->dwz->srefs
 # Wait till both files are in the index and scan/index fully finished
-wait_ready $PORT1 'thread_work_total{role="traverse"}' 3
+wait_ready $PORT1 'thread_work_total{role="traverse"}' 4
 wait_ready $PORT1 'thread_work_pending{role="scan"}' 0
 wait_ready $PORT1 'thread_busy{role="scan"}' 0
 
@@ -136,9 +139,11 @@ RPM_BUILDID=d44d42cbd7d915bc938c81333a21e355a6022fb7 # in rhel6/ subdir
 # Drop some of the artifacts, run a groom cycle; confirm that
 # debuginfod has forgotten them, but remembers others
 rm -r R/debuginfod-rpms/rhel6/*
+
+wait_ready $PORT1 'thread_work_total{role="groom"}' 1
 kill -USR2 $PID1  # groom cycle
 ## 1 groom cycle already took place at/soon-after startup, so -USR2 makes 2
-wait_ready $PORT1 'thread_work_total{role="groom"}' 1
+wait_ready $PORT1 'thread_work_total{role="groom"}' 2
 # Expect 4 rpms containing 2 buildids to be deleted by the groom
 wait_ready $PORT1 'groomed_total{decision="stale"}' 4
 
index 7ad4786ec6b882748236ed5e1c9774aa3189f589..4fc1b441fe5031a18e36907c77ef0272244acf5c 100755 (executable)
@@ -49,9 +49,11 @@ if [ "$zstd" = "false" ]; then  # nuke the zstd fedora 31 ones
     rm -vrf R/debuginfod-rpms/fedora31
 fi
 
+# Make sure the initial scan is done
+wait_ready $PORT1 'thread_work_total{role="traverse"}' 1
 kill -USR1 $PID1
 # Now there should be 1 files in the index
-wait_ready $PORT1 'thread_work_total{role="traverse"}' 1
+wait_ready $PORT1 'thread_work_total{role="traverse"}' 2
 wait_ready $PORT1 'thread_work_pending{role="scan"}' 0
 wait_ready $PORT1 'thread_busy{role="scan"}' 0
 
@@ -63,23 +65,25 @@ SHA=f4a1a8062be998ae93b8f1cd744a398c6de6dbb1
 # there are two copies of the same buildid in the index, one for the
 # no-longer-existing file name, and one under the new name.
 
+# Make sure the initial groom cycle has been done
+wait_ready $PORT1 'thread_work_total{role="groom"}' 1
 # run a groom cycle to force server to drop its fdcache
 kill -USR2 $PID1  # groom cycle
 wait_ready $PORT1 'thread_work_total{role="groom"}' 2
 # move it around a couple of times to make it likely to hit a nonexistent entry during iteration
 mv R/debuginfod-rpms/rhel7 R/debuginfod-rpms/rhel7renamed
 kill -USR1 $PID1  # scan cycle
-wait_ready $PORT1 'thread_work_total{role="traverse"}' 2
+wait_ready $PORT1 'thread_work_total{role="traverse"}' 3
 wait_ready $PORT1 'thread_work_pending{role="scan"}' 0
 wait_ready $PORT1 'thread_busy{role="scan"}' 0
 mv R/debuginfod-rpms/rhel7renamed R/debuginfod-rpms/rhel7renamed2
 kill -USR1 $PID1  # scan cycle
-wait_ready $PORT1 'thread_work_total{role="traverse"}' 3
+wait_ready $PORT1 'thread_work_total{role="traverse"}' 4
 wait_ready $PORT1 'thread_work_pending{role="scan"}' 0
 wait_ready $PORT1 'thread_busy{role="scan"}' 0
 mv R/debuginfod-rpms/rhel7renamed2 R/debuginfod-rpms/rhel7renamed3
 kill -USR1 $PID1  # scan cycle
-wait_ready $PORT1 'thread_work_total{role="traverse"}' 4
+wait_ready $PORT1 'thread_work_total{role="traverse"}' 5
 wait_ready $PORT1 'thread_work_pending{role="scan"}' 0
 wait_ready $PORT1 'thread_busy{role="scan"}' 0
 
index 1ec57bbaa5b5f1ffa6f4f44fef97a451416164cd..9f7454bcc47956d06dc4f2c4766aede02298d751 100755 (executable)
@@ -38,6 +38,8 @@ tempfiles vlog$PORT1
 errfiles vlog$PORT1
 # Server must become ready
 wait_ready $PORT1 'ready' 1
+# And make sure first scan is done
+wait_ready $PORT1 'thread_work_total{role="traverse"}' 1
 
 # Be patient when run on a busy machine things might take a bit.
 export DEBUGINFOD_TIMEOUT=10
@@ -55,7 +57,7 @@ fi
 
 kill -USR1 $PID1
 # Wait till both files are in the index and scan/index fully finished
-wait_ready $PORT1 'thread_work_total{role="traverse"}' 1
+wait_ready $PORT1 'thread_work_total{role="traverse"}' 2
 wait_ready $PORT1 'thread_work_pending{role="scan"}' 0
 wait_ready $PORT1 'thread_busy{role="scan"}' 0
 
index e96cb9664adc7a421862f98d5382613ebd691ad5..4eae0200437953cb092390fb3e47c443cb870f4e 100755 (executable)
@@ -51,9 +51,11 @@ export DEBUGINFOD_TIMEOUT=10
 
 # Server must become ready
 wait_ready $PORT1 'ready' 1
-kill -USR1 $PID1
-
+# And the initial scan should have been done
 wait_ready $PORT1 'thread_work_total{role="traverse"}' 1
+
+kill -USR1 $PID1
+wait_ready $PORT1 'thread_work_total{role="traverse"}' 2
 wait_ready $PORT1 'thread_work_pending{role="scan"}' 0
 wait_ready $PORT1 'thread_busy{role="scan"}' 0
 
@@ -76,7 +78,7 @@ tempfiles F/prog2 F/prog2.debug
 
 kill -USR1 $PID1
 # Now there should be 3 files in the index
-wait_ready $PORT1 'thread_work_total{role="traverse"}' 2
+wait_ready $PORT1 'thread_work_total{role="traverse"}' 3
 wait_ready $PORT1 'thread_work_pending{role="scan"}' 0
 wait_ready $PORT1 'thread_busy{role="scan"}' 0
 
index 0f2d13e263b21e4fa38d31cf9727d8a3aedfead7..5f33394aed5a0708c71839fd39e2f4a060681f66 100755 (executable)
@@ -70,9 +70,13 @@ BUILDID=`env LD_LIBRARY_PATH=$ldpath ${abs_builddir}/../src/readelf \
 
 mv p+r%o\$g F
 mv p+r%o\$g.debug F
+
+# Make sure the initial scan has finished.
+wait_ready $PORT1 'thread_work_total{role="traverse"}' 1
+
 kill -USR1 $PID1
 # Wait till both files are in the index.
-wait_ready $PORT1 'thread_work_total{role="traverse"}' 1
+wait_ready $PORT1 'thread_work_total{role="traverse"}' 2
 wait_ready $PORT1 'thread_work_pending{role="scan"}' 0
 wait_ready $PORT1 'thread_busy{role="scan"}' 0
 
index e984f32f1296fa913bcebfae01ea518840640dee..4750f1849191db90d929993fc6dd68eb05b67021 100755 (executable)
@@ -54,9 +54,11 @@ fi
 
 cp -rvp ${abs_srcdir}/debuginfod-tars Z
 
+# Make sure the initial scan has finished
+wait_ready $PORT1 'thread_work_total{role="traverse"}' 1
 kill -USR1 $PID1
 # Wait till both files are in the index and scan/index fully finished
-wait_ready $PORT1 'thread_work_total{role="traverse"}' 1
+wait_ready $PORT1 'thread_work_total{role="traverse"}' 2
 wait_ready $PORT1 'thread_work_pending{role="scan"}' 0
 wait_ready $PORT1 'thread_busy{role="scan"}' 0
 
@@ -71,7 +73,7 @@ wait_ready $PORT1 'scanned_files_total{source=".tar.bz2 archive"}' $tb2
 
 kill -USR1 $PID1  # two hits of SIGUSR1 may be needed to resolve .debug->dwz->srefs
 # Wait till both files are in the index and scan/index fully finished
-wait_ready $PORT1 'thread_work_total{role="traverse"}' 2
+wait_ready $PORT1 'thread_work_total{role="traverse"}' 3
 wait_ready $PORT1 'thread_work_pending{role="scan"}' 0
 wait_ready $PORT1 'thread_busy{role="scan"}' 0
 
index 42b8f1014750ea530e308a1bb8671af8deb058ef..1aef7174f867ee1e45d3220bd44bfe322e845163 100755 (executable)
@@ -62,6 +62,9 @@ BUILDID=`env LD_LIBRARY_PATH=$ldpath ${abs_builddir}/../src/readelf \
 
 mv prog F
 mv prog.debug F
+
+# Make sure initial scan was done
+wait_ready $PORT1 'thread_work_total{role="traverse"}' 1
 kill -USR1 $PID1
 # Wait till both files are in the index.
 wait_ready $PORT1 'thread_work_total{role="traverse"}' 2
@@ -83,9 +86,11 @@ tempfiles ${DB}_2
 
 wait_ready $PORT2 'ready' 1
 
+# Make sure initial scan was done
+wait_ready $PORT2 'thread_work_total{role="traverse"}' 1
 kill -USR1 $PID2
 # Wait till both files are in the index.
-wait_ready $PORT2 'thread_work_total{role="traverse"}' 1
+wait_ready $PORT2 'thread_work_total{role="traverse"}' 2
 wait_ready $PORT2 'thread_work_pending{role="scan"}' 0
 wait_ready $PORT2 'thread_busy{role="scan"}' 0
 
@@ -99,7 +104,7 @@ if type bsdtar 2>/dev/null; then
     # copy in the deb files
     cp -rvp ${abs_srcdir}/debuginfod-debs/*deb D
     kill -USR1 $PID2
-    wait_ready $PORT2 'thread_work_total{role="traverse"}' 2
+    wait_ready $PORT2 'thread_work_total{role="traverse"}' 3
     wait_ready $PORT2 'thread_work_pending{role="scan"}' 0
     wait_ready $PORT2 'thread_busy{role="scan"}' 0
 
index 2e7550a649dddba58bae6704b07444ca32284d2a..0cc4c2f7177774783c44e419fd1e25aa9a72227a 100755 (executable)
@@ -45,7 +45,7 @@ errfiles vlog$PORT1
 
 wait_ready $PORT1 'ready' 1
 
-kill -USR1 $PID1
+# Wait till initial scan is done
 wait_ready $PORT1 'thread_work_total{role="traverse"}' 1
 wait_ready $PORT1 'thread_work_pending{role="scan"}' 0
 wait_ready $PORT1 'thread_busy{role="scan"}' 0
index a323b98e6e548fc86933f76c21479c798bf7d3b8..5a18b4bbb93c02bb047f6d869c40e8706f4fff2a 100755 (executable)
@@ -59,7 +59,7 @@ errfiles vlog$PORT1
 
 wait_ready $PORT1 'ready' 1
 
-kill -USR1 $PID1
+# Wait till initial scan is done
 wait_ready $PORT1 'thread_work_total{role="traverse"}' 1
 wait_ready $PORT1 'thread_work_pending{role="scan"}' 0
 wait_ready $PORT1 'thread_busy{role="scan"}' 0
@@ -73,13 +73,17 @@ tempfiles vlog$PORT2
 errfiles vlog$PORT2
 tempfiles ${DB}_2
 wait_ready $PORT2 'ready' 1
+# Wait till initial scan is done
+wait_ready $PORT2 'thread_work_total{role="traverse"}' 1
+# And initial groom cycle
+wait_ready $PORT1 'thread_work_total{role="groom"}' 1
 
 export DEBUGINFOD_URLS='http://127.0.0.1:'$PORT2 
 if type bsdtar 2>/dev/null; then
     # copy in the deb files
     cp -rvp ${abs_srcdir}/debuginfod-debs/*deb D
     kill -USR1 $PID2
-    wait_ready $PORT2 'thread_work_total{role="traverse"}' 1
+    wait_ready $PORT2 'thread_work_total{role="traverse"}' 2
     wait_ready $PORT2 'thread_work_pending{role="scan"}' 0
     wait_ready $PORT2 'thread_busy{role="scan"}' 0
 
@@ -177,7 +181,7 @@ wait_ready $PORT1 'thread_work_total{role="traverse"}' 2
 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"}' 1
+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/metrics | grep 'error_count.*sqlite'
 # Run the tests again without the servers running. The target file should
index eb504181d48aeb641ed6511f38ab34df4ea3ca95..3bc9e7995844d431e9e9cc6d564dde5cf9aad8d3 100755 (executable)
@@ -40,6 +40,9 @@ tempfiles vlog$PORT1
 errfiles vlog$PORT1
 # Server must become ready
 wait_ready $PORT1 'ready' 1
+# And an initial scan should be done
+wait_ready $PORT1 'thread_work_total{role="traverse"}' 1
+
 export DEBUGINFOD_URLS=http://127.0.0.1:$PORT1/   # or without trailing /
 
 # Be patient when run on a busy machine things might take a bit.
@@ -70,7 +73,7 @@ mv p+r%o\$g F
 mv p+r%o\$g.debug F
 kill -USR1 $PID1
 # Wait till both files are in the index.
-wait_ready $PORT1 'thread_work_total{role="traverse"}' 1
+wait_ready $PORT1 'thread_work_total{role="traverse"}' 2
 wait_ready $PORT1 'thread_work_pending{role="scan"}' 0
 wait_ready $PORT1 'thread_busy{role="scan"}' 0
 
index 32ddf6ff96fa916c734743d7e1f47c1c0af30db2..6837ea8648b3563caf24adb8759c9148f0c112d4 100755 (executable)
@@ -37,7 +37,10 @@ env LD_LIBRARY_PATH=$ldpath ${abs_builddir}/../debuginfod/debuginfod \
 PID1=$!
 tempfiles vlog$PORT1
 errfiles vlog$PORT1
+
+# Wait till the server is ready and an initial scan has been done
 wait_ready $PORT1 'ready' 1
+wait_ready $PORT1 'thread_work_total{role="traverse"}' 1
 
 # Compile a simple program, strip its debuginfo and save the build-id.
 # Also move the debuginfo into another directory so that elfutils
@@ -55,7 +58,7 @@ tempfiles F/prog.debug F/prog
 
 kill -USR1 $PID1
 # Wait till both files are in the index.
-wait_ready $PORT1 'thread_work_total{role="traverse"}' 1
+wait_ready $PORT1 'thread_work_total{role="traverse"}' 2
 wait_ready $PORT1 'thread_work_pending{role="scan"}' 0
 wait_ready $PORT1 'thread_busy{role="scan"}' 0
 cp ${DB} ${DB}.backup
@@ -79,7 +82,7 @@ errfiles vlog$PORT2
 # Server must become ready
 wait_ready $PORT2 'ready' 1
 
-kill -USR2 $PID1
+# Wait till the initial groom cycle has been done
 wait_ready $PORT2 'thread_work_total{role="groom"}' 1
 wait_ready $PORT2 'groom{statistic="archive d/e"}'  0
 wait_ready $PORT2 'groom{statistic="archive sdef"}' 0
index 25b89be46fd9105dc223f6a57d8bf3159a71078f..dc9accb06cc8910895fb933c9064d4df8c202d7d 100755 (executable)
@@ -40,6 +40,9 @@ tempfiles vlog$PORT1
 errfiles vlog$PORT1
 # Server must become ready
 wait_ready $PORT1 'ready' 1
+# And initial scan should be done
+wait_ready $PORT1 'thread_work_total{role="traverse"}' 1
+
 export DEBUGINFOD_URLS=http://127.0.0.1:$PORT1/   # or without trailing /
 
 # Be patient when run on a busy machine things might take a bit.
@@ -71,7 +74,7 @@ mv p+r%o\$g F
 mv p+r%o\$g.debug F
 kill -USR1 $PID1
 # Wait till both files are in the index.
-wait_ready $PORT1 'thread_work_total{role="traverse"}' 1
+wait_ready $PORT1 'thread_work_total{role="traverse"}' 2
 wait_ready $PORT1 'thread_work_pending{role="scan"}' 0
 wait_ready $PORT1 'thread_busy{role="scan"}' 0
 
index 0bc70379b4a5a9128b753bb009ca1fb22998eb5b..69ececb394545bf8982108bd2d75d861adfa1861 100755 (executable)
@@ -39,6 +39,9 @@ tempfiles vlog$PORT1
 errfiles vlog$PORT1
 # Server must become ready
 wait_ready $PORT1 'ready' 1
+# And initial scan should be done
+wait_ready $PORT1 'thread_work_total{role="traverse"}' 1
+
 export DEBUGINFOD_URLS=http://127.0.0.1:$PORT1/   # or without trailing /
 
 # Be patient when run on a busy machine things might take a bit.
@@ -67,7 +70,7 @@ mv p+r%o\$g F
 mv p+r%o\$g.debug F
 kill -USR1 $PID1
 # Wait till both files are in the index.
-wait_ready $PORT1 'thread_work_total{role="traverse"}' 1
+wait_ready $PORT1 'thread_work_total{role="traverse"}' 2
 wait_ready $PORT1 'thread_work_pending{role="scan"}' 0
 wait_ready $PORT1 'thread_busy{role="scan"}' 0