This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH 4/4] binutils/testsuite: Check additional server metrics at start-up
- From: Aaron Merey <amerey at redhat dot com>
- To: binutils at sourceware dot org
- Date: Thu, 16 Jan 2020 22:33:52 -0500
- Subject: [PATCH 4/4] binutils/testsuite: Check additional server metrics at start-up
binutils/testsuite: Check additional server metrics at start-up.
Check additional server metrics to confirm that it has finished
scanning the directory of debug files.
* binutils/testsuite/binutils-all/debuginfod.exp:
Check additional server metrics at start-up.
---
.../testsuite/binutils-all/debuginfod.exp | 29 ++++++++++++-------
1 file changed, 19 insertions(+), 10 deletions(-)
diff --git a/binutils/testsuite/binutils-all/debuginfod.exp b/binutils/testsuite/binutils-all/debuginfod.exp
index 42a861d084..7e1c6380a5 100644
--- a/binutils/testsuite/binutils-all/debuginfod.exp
+++ b/binutils/testsuite/binutils-all/debuginfod.exp
@@ -122,23 +122,32 @@ if { !$debuginfod_pid } {
return
}
-# Wait for debuginfod indicate it's ready.
-set ready 0
-for {set timelim 30} {$timelim != 0} {incr timelim -1} {
- sleep 1
- set want ".*ready 1.*"
+set metrics [list "ready 1" \
+ "thread_work_total{role=\"traverse\"} 1" \
+ "thread_work_pending{role=\"scan\"} 0" \
+ "thread_busy{role=\"scan\"} 0" \
+ "groom{statistic=\"buildids\"} 2"]
+
+# Check server metrics to confirm init has completed.
+foreach m $metrics {
+ set timelim 20
+ while { $timelim != 0 } {
+ sleep 0.5
+
catch {exec curl -s http://127.0.0.1:$port/metrics} got
- if { [regexp $want $got] } {
- set ready 1
+ if { [regexp $m $got] } {
break
}
-}
-if { !$ready } {
- fail "$test (server ready)"
+ incr timelim -1
+ }
+
+ if { $timelim == 0 } {
+ fail "$test (server init timeout)"
catch {exec kill -INT $debuginfod_pid}
return
+ }
}
setenv DEBUGINFOD_URLS http://127.0.0.1:$port
--
2.23.0