summaryrefslogtreecommitdiff
path: root/internal/generate/classify_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-05-29 22:28:21 +0300
committerPaul Buetow <paul@buetow.org>2026-05-29 22:28:21 +0300
commit5aadfad3a145de9967120065587d830f09ad87aa (patch)
treec45532534ebb029bd55966ad5d94d13ecb3ed480 /internal/generate/classify_test.go
parent521964a730d828d63c324301deb206ea4b33089b (diff)
test(generate): lock in sync(2) void-but-returns classification
Audit of bare sync(2) per man 2 sync: void sync(void) takes no args and returns no value. Confirmed it is correctly classified KindNull in FamilyFS, its ret is UNCLASSIFIED, and — unlike noreturn exit/exit_group — its exit handler IS emitted because sync does return (void != noreturn). Docs and generated maps already match; no code or doc changes needed. Add lock-in tests: - TestGenerateSyncHandler: enter null_event with no arg capture (sync has no args at all), live exit handler emitted, ret recorded UNCLASSIFIED. - TestClassifyRetSyncUnclassified: meaningless void ret stays UNCLASSIFIED. - TestSyncIsNotNoreturn: guards sync from the noreturn suppression list. - Add sync (FamilyFS) to the family/exit-handler table test. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'internal/generate/classify_test.go')
-rw-r--r--internal/generate/classify_test.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/internal/generate/classify_test.go b/internal/generate/classify_test.go
index f0278e2..838d643 100644
--- a/internal/generate/classify_test.go
+++ b/internal/generate/classify_test.go
@@ -1757,6 +1757,11 @@ func TestClassifySyscallPairEmitsAllFamilies(t *testing.T) {
{"listns", FormatListns, FormatExitListns, FamilyFS},
{"swapon", FormatSwapon, FormatExitSwapon, FamilyFS},
{"swapoff", FormatSwapoff, FormatExitSwapoff, FamilyFS},
+ // Bare sync() takes no args and returns void, but it DOES return (it is
+ // not noreturn like exit/exit_group), so it belongs in FamilyFS and must
+ // still emit a live exit handler. Its fd-taking siblings (syncfs/fsync/
+ // fdatasync/sync_file_range) are FamilyFS+KindFd and covered elsewhere.
+ {"sync", FormatSync, FormatExitSync, FamilyFS},
{"kill", FormatKill, FormatExitKill, FamilySignals},
{"exit_group", syntheticEnter("exit_group", 9316), syntheticExit("exit_group", 9315), FamilyProcess},
}