aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/internal/testsuite/proc_test.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-10-03 19:01:53 +0900
committerOphestra <cat@gensokyo.uk>2026-10-03 21:03:10 +0900
commitaa35067f0caeb709edd60dc76fc68ac33c3e1a25 (patch)
tree928cbdb953a31514781b4e10b43b914275087a1c /test/internal/testsuite/proc_test.go
parentf2e188c4a0f472bcbd87189f63099d2c73936789 (diff)
test/internal/testsuite: simple proc scanner
This replaces procps in the replacement test suite and enables faster and much more precise matching. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'test/internal/testsuite/proc_test.go')
-rw-r--r--test/internal/testsuite/proc_test.go33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/internal/testsuite/proc_test.go b/test/internal/testsuite/proc_test.go
new file mode 100644
index 00000000..a8698e73
--- /dev/null
+++ b/test/internal/testsuite/proc_test.go
@@ -0,0 +1,33 @@
+package testsuite_test
+
+import (
+ "testing"
+
+ "hakurei.app/test/internal/testsuite"
+)
+
+func BenchmarkStatScanner(b *testing.B) {
+ var s testsuite.StatScanner
+
+ for b.Loop() {
+ if !s.Scan() {
+ b.Fatal(s.Err())
+ }
+ }
+}
+
+func BenchmarkStatScannerFull(b *testing.B) {
+ var s testsuite.StatScanner
+
+ for b.Loop() {
+ for s.Scan() {
+ if s.Repopulated() {
+ break
+ }
+ }
+
+ if err := s.Err(); err != nil {
+ b.Fatal(err)
+ }
+ }
+}