From 560bf7dcd4369d4633568a2b9912c71bb9928322 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 7 May 2024 17:20:52 +0200 Subject: pkg/vminfo: deduplicate syscall test programs Properly dedup syscall tests. This reduces number of test programs for linux from 4349 to 641. --- pkg/vminfo/linux_syscalls.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'pkg/vminfo/linux_syscalls.go') 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 != "" { -- cgit mrf-deployment