public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 4/4] binutils/testsuite: Check additional server metrics at start-up
@ 2020-01-17  3:34 Aaron Merey
  0 siblings, 0 replies; only message in thread
From: Aaron Merey @ 2020-01-17  3:34 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 2 bytes --]



[-- Attachment #2: 0004-binutils-testsuite-Check-additional-server-metrics-a.patch --]
[-- Type: text/x-patch, Size: 1691 bytes --]

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-01-17  3:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-17  3:34 [PATCH 4/4] binutils/testsuite: Check additional server metrics at start-up Aaron Merey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).