summaryrefslogtreecommitdiff
path: root/internal/generate/classify_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-05-20 14:37:41 +0300
committerPaul Buetow <paul@buetow.org>2026-05-20 14:37:41 +0300
commit96355c79a38032ab4bd880b3b3ff4192ae709795 (patch)
tree7a395706e3db680f6e695c8602501741eed6ad45 /internal/generate/classify_test.go
parentf063e626a28339735da583142e5af864a60c2111 (diff)
task 27: add KindSleep and requested sleep metric
Diffstat (limited to 'internal/generate/classify_test.go')
-rw-r--r--internal/generate/classify_test.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/internal/generate/classify_test.go b/internal/generate/classify_test.go
index 2bc0e88..daf008a 100644
--- a/internal/generate/classify_test.go
+++ b/internal/generate/classify_test.go
@@ -439,6 +439,20 @@ func TestClassifyMremap(t *testing.T) {
}
}
+func TestClassifyNanosleep(t *testing.T) {
+ r := classifyFromData(t, FormatNanosleep)
+ if r.Kind != KindSleep {
+ t.Errorf("nanosleep: got kind %d, want KindSleep", r.Kind)
+ }
+}
+
+func TestClassifyClockNanosleep(t *testing.T) {
+ r := classifyFromData(t, FormatClockNanosleep)
+ if r.Kind != KindSleep {
+ t.Errorf("clock_nanosleep: got kind %d, want KindSleep", r.Kind)
+ }
+}
+
func TestClassifyKillRequiresGenerationFallback(t *testing.T) {
r := classifyFromData(t, FormatKill)
if r.Kind != KindNone {
@@ -493,6 +507,8 @@ func TestClassifySyscallPairAccepted(t *testing.T) {
{"pselect6", FormatPselect6, FormatExitPselect6, KindPoll},
{"munmap", FormatMunmap, FormatExitMunmap, KindMem},
{"mremap", FormatMremap, FormatExitMremap, KindMem},
+ {"nanosleep", FormatNanosleep, FormatExitNanosleep, KindSleep},
+ {"clock_nanosleep", FormatClockNanosleep, FormatExitClockNanosleep, KindSleep},
{"kill", FormatKill, FormatExitKill, KindNull},
}
@@ -532,6 +548,8 @@ func TestClassifySyscallPairEmitsAllFamilies(t *testing.T) {
{"pselect6", FormatPselect6, FormatExitPselect6, FamilyPolling},
{"munmap", FormatMunmap, FormatExitMunmap, FamilyMemory},
{"mremap", FormatMremap, FormatExitMremap, FamilyMemory},
+ {"nanosleep", FormatNanosleep, FormatExitNanosleep, FamilyTime},
+ {"clock_nanosleep", FormatClockNanosleep, FormatExitClockNanosleep, FamilyTime},
{"kill", FormatKill, FormatExitKill, FamilySignals},
}