summaryrefslogtreecommitdiff
path: root/internal/generate/family_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-05-30 16:47:26 +0300
committerPaul Buetow <paul@buetow.org>2026-05-30 16:47:26 +0300
commitd37ed0371dbe8ed49b48ea56bb3b6fe701f6e48a (patch)
treee20c7391527604ed514e369c2c295abbd121bb32 /internal/generate/family_test.go
parentc0d86b578475e8df4a861d955ba56080c0548cb3 (diff)
test(gettid): lock in KindNull/FamilyProcess/UNCLASSIFIED classification
Audit of gettid(2) ('pid_t gettid(void)', no args, always succeeds) found the classification correct and consistent with its no-arg id-returning siblings getpid/getppid/getuid/getgid (FamilyProcess, KindNull enter, ret_event UNCLASSIFIED exit), and mage generate produces no diff. However gettid lacked dedicated lock-in coverage and was missing entirely from the family_test.go Process table despite its siblings being asserted there. Add TestClassifyGettidNullEnter and TestClassifyExitGettidUnclassifiedRet (mirroring the getgid pattern: enter null_event capturing nothing, exit ret classified UNCLASSIFIED so the returned tid is never mistaken for a byte count) plus gettid enter+exit FamilyProcess assertions in family_test.go. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'internal/generate/family_test.go')
-rw-r--r--internal/generate/family_test.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/internal/generate/family_test.go b/internal/generate/family_test.go
index d86cc4a..475a75f 100644
--- a/internal/generate/family_test.go
+++ b/internal/generate/family_test.go
@@ -67,6 +67,14 @@ func TestClassifySyscallFamily(t *testing.T) {
{"sys_enter_getpgrp", FamilyProcess},
{"sys_enter_getpid", FamilyProcess},
{"sys_enter_getppid", FamilyProcess},
+ // gettid(2) ("pid_t gettid(void)") returns the caller's thread ID and
+ // belongs with the no-arg id-returning reader cluster
+ // getpid/getppid/getuid/getgid under FamilyProcess (it is a per-thread
+ // identity query, not Time/Sched/Misc). Assert enter+exit so a stray
+ // reclassification trips this test. Keep in sync with the Process list in
+ // docs/syscall-tracing-plan.md.
+ {"sys_enter_gettid", FamilyProcess},
+ {"sys_exit_gettid", FamilyProcess},
{"sys_enter_rt_sigaction", FamilySignals},
{"sys_enter_clock_gettime", FamilyTime},
// gettimeofday(2) gets wall-clock time via a userspace timeval/timezone