aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/vminfo/linux_syscalls.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2024-05-07 17:20:52 +0200
committerDmitry Vyukov <dvyukov@google.com>2024-05-07 15:42:03 +0000
commit560bf7dcd4369d4633568a2b9912c71bb9928322 (patch)
treed697bdacd688822382025b21387f47f047759702 /pkg/vminfo/linux_syscalls.go
parentfc7348e9d52ba26a91ae1fcf1d602bbf84bbdcd2 (diff)
pkg/vminfo: deduplicate syscall test programs
Properly dedup syscall tests. This reduces number of test programs for linux from 4349 to 641.
Diffstat (limited to 'pkg/vminfo/linux_syscalls.go')
-rw-r--r--pkg/vminfo/linux_syscalls.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/pkg/vminfo/linux_syscalls.go b/pkg/vminfo/linux_syscalls.go
index a11eb06b4..529fed3bd 100644
--- a/pkg/vminfo/linux_syscalls.go
+++ b/pkg/vminfo/linux_syscalls.go
@@ -20,7 +20,19 @@ func (linux) syscallCheck(ctx *checkContext, call *prog.Syscall) string {
check := linuxSyscallChecks[call.CallName]
if check == nil {
check = func(ctx *checkContext, call *prog.Syscall) string {
- return ctx.supportedSyscalls([]string{call.Name})
+ // Execute plain syscall (rather than a variation with $) to make test program
+ // deduplication effective. However, if the plain syscall does not exist take
+ // the first variant for this syscall, this still allows to dedup all variants.
+ // This works b/c in syscall test we only check for ENOSYS result.
+ name := call.CallName
+ if ctx.target.SyscallMap[name] == nil {
+ for _, call1 := range ctx.target.Syscalls {
+ if name == call1.CallName {
+ name = call1.Name
+ }
+ }
+ }
+ return ctx.supportedSyscalls([]string{name})
}
}
if reason := check(ctx, call); reason != "" {