summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2021-09-07 23:56:42 +0200
committerMark Wielaard <mark@klomp.org>2021-09-07 23:56:42 +0200
commit5ce85e424907d82797f5efe59a8416ec537ebd9e (patch)
tree0f2e3ee614e7888276bfef54f36660c3fc9a67e4
parenttests: Make sure to wait for initial scan and groom cycle (diff)
downloadelfutils-5ce85e424907d82797f5efe59a8416ec537ebd9e.tar.gz
elfutils-5ce85e424907d82797f5efe59a8416ec537ebd9e.tar.bz2
elfutils-5ce85e424907d82797f5efe59a8416ec537ebd9e.tar.xz
tests: Make sure to wait for initial scan and groom cycle earlier
At startup the debuginfod server does a scan and groom cycle. Make sure to wait for that before making any changes to the scan dirs. And not just right before triggering a new one with SIGUSR1 for scan or SIGURS2 for groom. Signed-off-by: Mark Wielaard <mark@klomp.org>
-rw-r--r--tests/ChangeLog12
-rwxr-xr-xtests/run-debuginfod-archive-groom.sh10
-rwxr-xr-xtests/run-debuginfod-archive-rename.sh11
-rwxr-xr-xtests/run-debuginfod-artifact-running.sh12
-rwxr-xr-xtests/run-debuginfod-dlopen.sh7
-rwxr-xr-xtests/run-debuginfod-extraction.sh6
-rwxr-xr-xtests/run-debuginfod-federation-link.sh3
7 files changed, 42 insertions, 19 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 61080c52..42989d19 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,15 @@
12021-09-07 Mark Wielaard <mark@klomp.org>
2
3 * run-debuginfod-archive-groom.sh: Wait for initial scan and groom
4 cycle before making any changes to the scan dirs.
5 * run-debuginfod-archive-rename.sh: Likewise.
6 * run-debuginfod-artifact-running.sh: Wait for initial scan cycle
7 before making any changes to the scan dirs.
8 * run-debuginfod-dlopen.sh: Likewise.
9 * run-debuginfod-extraction.sh: Likewise.
10 * run-debuginfod-federation-link.sh: Don't wait twice for the initial
11 scan.
12
12021-09-06 Mark Wielaard <mark@klomp.org> 132021-09-06 Mark Wielaard <mark@klomp.org>
2 14
3 * run-debuginfod-archive-groom.sh: Wait for initial scan and groom 15 * run-debuginfod-archive-groom.sh: Wait for initial scan and groom
diff --git a/tests/run-debuginfod-archive-groom.sh b/tests/run-debuginfod-archive-groom.sh
index 1e7bd67a..7813ee28 100755
--- a/tests/run-debuginfod-archive-groom.sh
+++ b/tests/run-debuginfod-archive-groom.sh
@@ -46,6 +46,13 @@ ps -q $PID1 -e -L -o '%p %c %a' | grep groom
46ps -q $PID1 -e -L -o '%p %c %a' | grep scan 46ps -q $PID1 -e -L -o '%p %c %a' | grep scan
47ps -q $PID1 -e -L -o '%p %c %a' | grep traverse 47ps -q $PID1 -e -L -o '%p %c %a' | grep traverse
48 48
49# wait till the initial scan is done before triggering a new one
50# and before dropping new file into the scan dirs
51wait_ready $PORT1 'thread_work_total{role="traverse"}' 1
52# Same for the initial groom cycle, we don't want it to be done
53# half way initializing the file setup
54wait_ready $PORT1 'thread_work_total{role="groom"}' 1
55
49# Build a non-stripped binary 56# Build a non-stripped binary
50echo "int main() { return 0; }" > ${PWD}/F/prog.c 57echo "int main() { return 0; }" > ${PWD}/F/prog.c
51gcc -Wl,--build-id -g -o ${PWD}/F/prog ${PWD}/F/prog.c 58gcc -Wl,--build-id -g -o ${PWD}/F/prog ${PWD}/F/prog.c
@@ -58,8 +65,6 @@ if [ "$zstd" = "false" ]; then # nuke the zstd fedora 31 ones
58 rm -vrf R/debuginfod-rpms/fedora31 65 rm -vrf R/debuginfod-rpms/fedora31
59fi 66fi
60 67
61# wait till the initial scan is done before triggering a new one
62wait_ready $PORT1 'thread_work_total{role="traverse"}' 1
63kill -USR1 $PID1 68kill -USR1 $PID1
64# Now there should be 1 files in the index 69# Now there should be 1 files in the index
65wait_ready $PORT1 'thread_work_total{role="traverse"}' 2 70wait_ready $PORT1 'thread_work_total{role="traverse"}' 2
@@ -140,7 +145,6 @@ RPM_BUILDID=d44d42cbd7d915bc938c81333a21e355a6022fb7 # in rhel6/ subdir
140# debuginfod has forgotten them, but remembers others 145# debuginfod has forgotten them, but remembers others
141rm -r R/debuginfod-rpms/rhel6/* 146rm -r R/debuginfod-rpms/rhel6/*
142 147
143wait_ready $PORT1 'thread_work_total{role="groom"}' 1
144kill -USR2 $PID1 # groom cycle 148kill -USR2 $PID1 # groom cycle
145## 1 groom cycle already took place at/soon-after startup, so -USR2 makes 2 149## 1 groom cycle already took place at/soon-after startup, so -USR2 makes 2
146wait_ready $PORT1 'thread_work_total{role="groom"}' 2 150wait_ready $PORT1 'thread_work_total{role="groom"}' 2
diff --git a/tests/run-debuginfod-archive-rename.sh b/tests/run-debuginfod-archive-rename.sh
index 4fc1b441..5369949b 100755
--- a/tests/run-debuginfod-archive-rename.sh
+++ b/tests/run-debuginfod-archive-rename.sh
@@ -44,13 +44,18 @@ ps -q $PID1 -e -L -o '%p %c %a' | grep groom
44ps -q $PID1 -e -L -o '%p %c %a' | grep scan 44ps -q $PID1 -e -L -o '%p %c %a' | grep scan
45ps -q $PID1 -e -L -o '%p %c %a' | grep traverse 45ps -q $PID1 -e -L -o '%p %c %a' | grep traverse
46 46
47# wait till the initial scan is done before triggering a new one
48# and before dropping new file into the scan dirs
49wait_ready $PORT1 'thread_work_total{role="traverse"}' 1
50# Same for the initial groom cycle, we don't want it to be done
51# half way initializing the file setup
52wait_ready $PORT1 'thread_work_total{role="groom"}' 1
53
47cp -rvp ${abs_srcdir}/debuginfod-rpms R 54cp -rvp ${abs_srcdir}/debuginfod-rpms R
48if [ "$zstd" = "false" ]; then # nuke the zstd fedora 31 ones 55if [ "$zstd" = "false" ]; then # nuke the zstd fedora 31 ones
49 rm -vrf R/debuginfod-rpms/fedora31 56 rm -vrf R/debuginfod-rpms/fedora31
50fi 57fi
51 58
52# Make sure the initial scan is done
53wait_ready $PORT1 'thread_work_total{role="traverse"}' 1
54kill -USR1 $PID1 59kill -USR1 $PID1
55# Now there should be 1 files in the index 60# Now there should be 1 files in the index
56wait_ready $PORT1 'thread_work_total{role="traverse"}' 2 61wait_ready $PORT1 'thread_work_total{role="traverse"}' 2
@@ -65,8 +70,6 @@ SHA=f4a1a8062be998ae93b8f1cd744a398c6de6dbb1
65# there are two copies of the same buildid in the index, one for the 70# there are two copies of the same buildid in the index, one for the
66# no-longer-existing file name, and one under the new name. 71# no-longer-existing file name, and one under the new name.
67 72
68# Make sure the initial groom cycle has been done
69wait_ready $PORT1 'thread_work_total{role="groom"}' 1
70# run a groom cycle to force server to drop its fdcache 73# run a groom cycle to force server to drop its fdcache
71kill -USR2 $PID1 # groom cycle 74kill -USR2 $PID1 # groom cycle
72wait_ready $PORT1 'thread_work_total{role="groom"}' 2 75wait_ready $PORT1 'thread_work_total{role="groom"}' 2
diff --git a/tests/run-debuginfod-artifact-running.sh b/tests/run-debuginfod-artifact-running.sh
index 4eae0200..51fa9c0a 100755
--- a/tests/run-debuginfod-artifact-running.sh
+++ b/tests/run-debuginfod-artifact-running.sh
@@ -42,6 +42,13 @@ env LD_LIBRARY_PATH=$ldpath ${abs_builddir}/../debuginfod/debuginfod $VERBOSE -d
42PID1=$! 42PID1=$!
43tempfiles vlog$PORT1 43tempfiles vlog$PORT1
44errfiles vlog$PORT1 44errfiles vlog$PORT1
45
46# Server must become ready
47wait_ready $PORT1 'ready' 1
48# And the initial scan should have been done before moving
49# files under the scan dirs.
50wait_ready $PORT1 'thread_work_total{role="traverse"}' 1
51
45mv prog F 52mv prog F
46mv prog.debug F 53mv prog.debug F
47tempfiles prog/F 54tempfiles prog/F
@@ -49,11 +56,6 @@ tempfiles prog/F
49# Be patient when run on a busy machine things might take a bit. 56# Be patient when run on a busy machine things might take a bit.
50export DEBUGINFOD_TIMEOUT=10 57export DEBUGINFOD_TIMEOUT=10
51 58
52# Server must become ready
53wait_ready $PORT1 'ready' 1
54# And the initial scan should have been done
55wait_ready $PORT1 'thread_work_total{role="traverse"}' 1
56
57kill -USR1 $PID1 59kill -USR1 $PID1
58wait_ready $PORT1 'thread_work_total{role="traverse"}' 2 60wait_ready $PORT1 'thread_work_total{role="traverse"}' 2
59wait_ready $PORT1 'thread_work_pending{role="scan"}' 0 61wait_ready $PORT1 'thread_work_pending{role="scan"}' 0
diff --git a/tests/run-debuginfod-dlopen.sh b/tests/run-debuginfod-dlopen.sh
index 5f33394a..39ee5190 100755
--- a/tests/run-debuginfod-dlopen.sh
+++ b/tests/run-debuginfod-dlopen.sh
@@ -51,6 +51,10 @@ ps -q $PID1 -e -L -o '%p %c %a' | grep groom
51ps -q $PID1 -e -L -o '%p %c %a' | grep scan 51ps -q $PID1 -e -L -o '%p %c %a' | grep scan
52ps -q $PID1 -e -L -o '%p %c %a' | grep traverse 52ps -q $PID1 -e -L -o '%p %c %a' | grep traverse
53 53
54# Make sure the initial scan has finished.
55# Before moving files under the scan dirs.
56wait_ready $PORT1 'thread_work_total{role="traverse"}' 1
57
54# We use -t0 and -g0 here to turn off time-based scanning & grooming. 58# We use -t0 and -g0 here to turn off time-based scanning & grooming.
55# For testing purposes, we just sic SIGUSR1 / SIGUSR2 at the process. 59# For testing purposes, we just sic SIGUSR1 / SIGUSR2 at the process.
56 60
@@ -71,9 +75,6 @@ BUILDID=`env LD_LIBRARY_PATH=$ldpath ${abs_builddir}/../src/readelf \
71mv p+r%o\$g F 75mv p+r%o\$g F
72mv p+r%o\$g.debug F 76mv p+r%o\$g.debug F
73 77
74# Make sure the initial scan has finished.
75wait_ready $PORT1 'thread_work_total{role="traverse"}' 1
76
77kill -USR1 $PID1 78kill -USR1 $PID1
78# Wait till both files are in the index. 79# Wait till both files are in the index.
79wait_ready $PORT1 'thread_work_total{role="traverse"}' 2 80wait_ready $PORT1 'thread_work_total{role="traverse"}' 2
diff --git a/tests/run-debuginfod-extraction.sh b/tests/run-debuginfod-extraction.sh
index 4750f184..06f60e78 100755
--- a/tests/run-debuginfod-extraction.sh
+++ b/tests/run-debuginfod-extraction.sh
@@ -47,6 +47,10 @@ ps -q $PID1 -e -L -o '%p %c %a' | grep groom
47ps -q $PID1 -e -L -o '%p %c %a' | grep scan 47ps -q $PID1 -e -L -o '%p %c %a' | grep scan
48ps -q $PID1 -e -L -o '%p %c %a' | grep traverse 48ps -q $PID1 -e -L -o '%p %c %a' | grep traverse
49 49
50# Make sure the initial scan has finished before copying the new files in
51# We might remove some, which we don't want to be accidentially scanned.
52wait_ready $PORT1 'thread_work_total{role="traverse"}' 1
53
50cp -rvp ${abs_srcdir}/debuginfod-rpms R 54cp -rvp ${abs_srcdir}/debuginfod-rpms R
51if [ "$zstd" = "false" ]; then # nuke the zstd fedora 31 ones 55if [ "$zstd" = "false" ]; then # nuke the zstd fedora 31 ones
52 rm -vrf R/debuginfod-rpms/fedora31 56 rm -vrf R/debuginfod-rpms/fedora31
@@ -54,8 +58,6 @@ fi
54 58
55cp -rvp ${abs_srcdir}/debuginfod-tars Z 59cp -rvp ${abs_srcdir}/debuginfod-tars Z
56 60
57# Make sure the initial scan has finished
58wait_ready $PORT1 'thread_work_total{role="traverse"}' 1
59kill -USR1 $PID1 61kill -USR1 $PID1
60# Wait till both files are in the index and scan/index fully finished 62# Wait till both files are in the index and scan/index fully finished
61wait_ready $PORT1 'thread_work_total{role="traverse"}' 2 63wait_ready $PORT1 'thread_work_total{role="traverse"}' 2
diff --git a/tests/run-debuginfod-federation-link.sh b/tests/run-debuginfod-federation-link.sh
index 1aef7174..050bcbcf 100755
--- a/tests/run-debuginfod-federation-link.sh
+++ b/tests/run-debuginfod-federation-link.sh
@@ -43,6 +43,7 @@ tempfiles vlog$PORT1
43errfiles vlog$PORT1 43errfiles vlog$PORT1
44 44
45wait_ready $PORT1 'ready' 1 45wait_ready $PORT1 'ready' 1
46# Make sure initial scan was done
46wait_ready $PORT1 'thread_work_total{role="traverse"}' 1 47wait_ready $PORT1 'thread_work_total{role="traverse"}' 1
47wait_ready $PORT1 'thread_work_pending{role="scan"}' 0 48wait_ready $PORT1 'thread_work_pending{role="scan"}' 0
48wait_ready $PORT1 'thread_busy{role="scan"}' 0 49wait_ready $PORT1 'thread_busy{role="scan"}' 0
@@ -63,8 +64,6 @@ BUILDID=`env LD_LIBRARY_PATH=$ldpath ${abs_builddir}/../src/readelf \
63mv prog F 64mv prog F
64mv prog.debug F 65mv prog.debug F
65 66
66# Make sure initial scan was done
67wait_ready $PORT1 'thread_work_total{role="traverse"}' 1
68kill -USR1 $PID1 67kill -USR1 $PID1
69# Wait till both files are in the index. 68# Wait till both files are in the index.
70wait_ready $PORT1 'thread_work_total{role="traverse"}' 2 69wait_ready $PORT1 'thread_work_total{role="traverse"}' 2