diff options
author | Mark Wielaard <mark@klomp.org> | 2021-09-07 23:56:42 +0200 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2021-09-07 23:56:42 +0200 |
commit | 5ce85e424907d82797f5efe59a8416ec537ebd9e (patch) | |
tree | 0f2e3ee614e7888276bfef54f36660c3fc9a67e4 | |
parent | tests: Make sure to wait for initial scan and groom cycle (diff) | |
download | elfutils-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/ChangeLog | 12 | ||||
-rwxr-xr-x | tests/run-debuginfod-archive-groom.sh | 10 | ||||
-rwxr-xr-x | tests/run-debuginfod-archive-rename.sh | 11 | ||||
-rwxr-xr-x | tests/run-debuginfod-artifact-running.sh | 12 | ||||
-rwxr-xr-x | tests/run-debuginfod-dlopen.sh | 7 | ||||
-rwxr-xr-x | tests/run-debuginfod-extraction.sh | 6 | ||||
-rwxr-xr-x | tests/run-debuginfod-federation-link.sh | 3 |
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 @@ | |||
1 | 2021-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 | |||
1 | 2021-09-06 Mark Wielaard <mark@klomp.org> | 13 | 2021-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 | |||
46 | ps -q $PID1 -e -L -o '%p %c %a' | grep scan | 46 | ps -q $PID1 -e -L -o '%p %c %a' | grep scan |
47 | ps -q $PID1 -e -L -o '%p %c %a' | grep traverse | 47 | ps -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 | ||
51 | wait_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 | ||
54 | wait_ready $PORT1 'thread_work_total{role="groom"}' 1 | ||
55 | |||
49 | # Build a non-stripped binary | 56 | # Build a non-stripped binary |
50 | echo "int main() { return 0; }" > ${PWD}/F/prog.c | 57 | echo "int main() { return 0; }" > ${PWD}/F/prog.c |
51 | gcc -Wl,--build-id -g -o ${PWD}/F/prog ${PWD}/F/prog.c | 58 | gcc -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 |
59 | fi | 66 | fi |
60 | 67 | ||
61 | # wait till the initial scan is done before triggering a new one | ||
62 | wait_ready $PORT1 'thread_work_total{role="traverse"}' 1 | ||
63 | kill -USR1 $PID1 | 68 | kill -USR1 $PID1 |
64 | # Now there should be 1 files in the index | 69 | # Now there should be 1 files in the index |
65 | wait_ready $PORT1 'thread_work_total{role="traverse"}' 2 | 70 | wait_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 |
141 | rm -r R/debuginfod-rpms/rhel6/* | 146 | rm -r R/debuginfod-rpms/rhel6/* |
142 | 147 | ||
143 | wait_ready $PORT1 'thread_work_total{role="groom"}' 1 | ||
144 | kill -USR2 $PID1 # groom cycle | 148 | kill -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 |
146 | wait_ready $PORT1 'thread_work_total{role="groom"}' 2 | 150 | wait_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 | |||
44 | ps -q $PID1 -e -L -o '%p %c %a' | grep scan | 44 | ps -q $PID1 -e -L -o '%p %c %a' | grep scan |
45 | ps -q $PID1 -e -L -o '%p %c %a' | grep traverse | 45 | ps -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 | ||
49 | wait_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 | ||
52 | wait_ready $PORT1 'thread_work_total{role="groom"}' 1 | ||
53 | |||
47 | cp -rvp ${abs_srcdir}/debuginfod-rpms R | 54 | cp -rvp ${abs_srcdir}/debuginfod-rpms R |
48 | if [ "$zstd" = "false" ]; then # nuke the zstd fedora 31 ones | 55 | if [ "$zstd" = "false" ]; then # nuke the zstd fedora 31 ones |
49 | rm -vrf R/debuginfod-rpms/fedora31 | 56 | rm -vrf R/debuginfod-rpms/fedora31 |
50 | fi | 57 | fi |
51 | 58 | ||
52 | # Make sure the initial scan is done | ||
53 | wait_ready $PORT1 'thread_work_total{role="traverse"}' 1 | ||
54 | kill -USR1 $PID1 | 59 | kill -USR1 $PID1 |
55 | # Now there should be 1 files in the index | 60 | # Now there should be 1 files in the index |
56 | wait_ready $PORT1 'thread_work_total{role="traverse"}' 2 | 61 | wait_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 | ||
69 | wait_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 |
71 | kill -USR2 $PID1 # groom cycle | 74 | kill -USR2 $PID1 # groom cycle |
72 | wait_ready $PORT1 'thread_work_total{role="groom"}' 2 | 75 | wait_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 | |||
42 | PID1=$! | 42 | PID1=$! |
43 | tempfiles vlog$PORT1 | 43 | tempfiles vlog$PORT1 |
44 | errfiles vlog$PORT1 | 44 | errfiles vlog$PORT1 |
45 | |||
46 | # Server must become ready | ||
47 | wait_ready $PORT1 'ready' 1 | ||
48 | # And the initial scan should have been done before moving | ||
49 | # files under the scan dirs. | ||
50 | wait_ready $PORT1 'thread_work_total{role="traverse"}' 1 | ||
51 | |||
45 | mv prog F | 52 | mv prog F |
46 | mv prog.debug F | 53 | mv prog.debug F |
47 | tempfiles prog/F | 54 | tempfiles 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. |
50 | export DEBUGINFOD_TIMEOUT=10 | 57 | export DEBUGINFOD_TIMEOUT=10 |
51 | 58 | ||
52 | # Server must become ready | ||
53 | wait_ready $PORT1 'ready' 1 | ||
54 | # And the initial scan should have been done | ||
55 | wait_ready $PORT1 'thread_work_total{role="traverse"}' 1 | ||
56 | |||
57 | kill -USR1 $PID1 | 59 | kill -USR1 $PID1 |
58 | wait_ready $PORT1 'thread_work_total{role="traverse"}' 2 | 60 | wait_ready $PORT1 'thread_work_total{role="traverse"}' 2 |
59 | wait_ready $PORT1 'thread_work_pending{role="scan"}' 0 | 61 | wait_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 | |||
51 | ps -q $PID1 -e -L -o '%p %c %a' | grep scan | 51 | ps -q $PID1 -e -L -o '%p %c %a' | grep scan |
52 | ps -q $PID1 -e -L -o '%p %c %a' | grep traverse | 52 | ps -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. | ||
56 | wait_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 \ | |||
71 | mv p+r%o\$g F | 75 | mv p+r%o\$g F |
72 | mv p+r%o\$g.debug F | 76 | mv p+r%o\$g.debug F |
73 | 77 | ||
74 | # Make sure the initial scan has finished. | ||
75 | wait_ready $PORT1 'thread_work_total{role="traverse"}' 1 | ||
76 | |||
77 | kill -USR1 $PID1 | 78 | kill -USR1 $PID1 |
78 | # Wait till both files are in the index. | 79 | # Wait till both files are in the index. |
79 | wait_ready $PORT1 'thread_work_total{role="traverse"}' 2 | 80 | wait_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 | |||
47 | ps -q $PID1 -e -L -o '%p %c %a' | grep scan | 47 | ps -q $PID1 -e -L -o '%p %c %a' | grep scan |
48 | ps -q $PID1 -e -L -o '%p %c %a' | grep traverse | 48 | ps -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. | ||
52 | wait_ready $PORT1 'thread_work_total{role="traverse"}' 1 | ||
53 | |||
50 | cp -rvp ${abs_srcdir}/debuginfod-rpms R | 54 | cp -rvp ${abs_srcdir}/debuginfod-rpms R |
51 | if [ "$zstd" = "false" ]; then # nuke the zstd fedora 31 ones | 55 | if [ "$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 | ||
55 | cp -rvp ${abs_srcdir}/debuginfod-tars Z | 59 | cp -rvp ${abs_srcdir}/debuginfod-tars Z |
56 | 60 | ||
57 | # Make sure the initial scan has finished | ||
58 | wait_ready $PORT1 'thread_work_total{role="traverse"}' 1 | ||
59 | kill -USR1 $PID1 | 61 | kill -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 |
61 | wait_ready $PORT1 'thread_work_total{role="traverse"}' 2 | 63 | wait_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 | |||
43 | errfiles vlog$PORT1 | 43 | errfiles vlog$PORT1 |
44 | 44 | ||
45 | wait_ready $PORT1 'ready' 1 | 45 | wait_ready $PORT1 'ready' 1 |
46 | # Make sure initial scan was done | ||
46 | wait_ready $PORT1 'thread_work_total{role="traverse"}' 1 | 47 | wait_ready $PORT1 'thread_work_total{role="traverse"}' 1 |
47 | wait_ready $PORT1 'thread_work_pending{role="scan"}' 0 | 48 | wait_ready $PORT1 'thread_work_pending{role="scan"}' 0 |
48 | wait_ready $PORT1 'thread_busy{role="scan"}' 0 | 49 | wait_ready $PORT1 'thread_busy{role="scan"}' 0 |
@@ -63,8 +64,6 @@ BUILDID=`env LD_LIBRARY_PATH=$ldpath ${abs_builddir}/../src/readelf \ | |||
63 | mv prog F | 64 | mv prog F |
64 | mv prog.debug F | 65 | mv prog.debug F |
65 | 66 | ||
66 | # Make sure initial scan was done | ||
67 | wait_ready $PORT1 'thread_work_total{role="traverse"}' 1 | ||
68 | kill -USR1 $PID1 | 67 | kill -USR1 $PID1 |
69 | # Wait till both files are in the index. | 68 | # Wait till both files are in the index. |
70 | wait_ready $PORT1 'thread_work_total{role="traverse"}' 2 | 69 | wait_ready $PORT1 'thread_work_total{role="traverse"}' 2 |