From 49ebd9d55c7555589a6b37eafa1d8fe9b5577e62 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Fri, 20 Nov 2026 01:12:54 +0900 Subject: internal/testsuite: notify on long proc scans This prints a message every second for a long-running proc scan. Signed-off-by: Ophestra --- cmd/hakurei/testsuite/sandbox/main.go | 2 +- internal/testsuite/testsuite.go | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/cmd/hakurei/testsuite/sandbox/main.go b/cmd/hakurei/testsuite/sandbox/main.go index 4eb36f8c..e340b829 100644 --- a/cmd/hakurei/testsuite/sandbox/main.go +++ b/cmd/hakurei/testsuite/sandbox/main.go @@ -43,7 +43,7 @@ func mustStart( ) var stat syscall.Stat_t - pid = testsuite.MustScanFor(func(s *testsuite.StatScanner) bool { + pid = testsuite.MustScanFor(nil, func(s *testsuite.StatScanner) bool { select { case err := <-done: if err == nil { diff --git a/internal/testsuite/testsuite.go b/internal/testsuite/testsuite.go index aada7721..e6bc3a49 100644 --- a/internal/testsuite/testsuite.go +++ b/internal/testsuite/testsuite.go @@ -626,7 +626,17 @@ func MustStartPipeWire(cred *syscall.Credential, dbusEnv string) (version string // MustScanFor continuously scans the proc filesystem and calls f for each entry // visited. -func MustScanFor(f func(ps *StatScanner) bool) int { +func MustScanFor(n func(), f func(ps *StatScanner) bool) int { + if n != nil { + m := time.NewTicker(1 * time.Second) + defer m.Stop() + go func() { + for range m.C { + n() + } + }() + } + var ps StatScanner for ps.Scan() { @@ -863,7 +873,13 @@ func StartHakurei( } var stat syscall.Stat_t - pid = MustScanFor(func(ps *StatScanner) bool { + pid = MustScanFor(func() { + log.Printf( + "still scanning for %s, output:\n%s", + c.Container.Hostname, + output.String(), + ) + }, func(ps *StatScanner) bool { select { case err = <-done: if err == nil { -- cgit v1.3.1