Bug 508777 - amd64-linux: add minimal scalar test
Summary: amd64-linux: add minimal scalar test
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: memcheck (other bugs)
Version First Reported In: 3.25 GIT
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Paul Floyd
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-08-26 19:21 UTC by Matthias Schwarzott
Modified: 2025-08-29 17:26 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
add minimal scalar test for amd64-linux (9.60 KB, patch)
2025-08-26 19:21 UTC, Matthias Schwarzott
Details
add minimal scalar test for amd64-linux (V2) (9.59 KB, patch)
2025-08-29 09:41 UTC, Matthias Schwarzott
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Schwarzott 2025-08-26 19:21:23 UTC
Created attachment 184479 [details]
add minimal scalar test for amd64-linux

To test the amd64 syscall wrappers I added a minimal scalar.c based on the existing versions.
I added a filter to suppress the line numbers as they only cause unnecessary large patches when new syscalls get added.
Comment 1 Mark Wielaard 2025-08-28 10:26:28 UTC
A minimal scalar test for amd64-linux would indeed be nice to have.
And this one looks fine. Thanks.

But as you already seen it is slightly messy to extend this.
So we have been reusing the Linux Test Project testsuite to more fully test all syscalls.

make ltpchecks
Of course the trouble with that is that there are some syscalls (corner cases) valgrind just cannot support.
But there are auxprogs/ltp-excludes.txt and auxprogs/ltp-error-patterns.txt

The goal of the scalar tests and the ltpchecks are slightly different though.
The scalar test make sure valgrind memcheck reports on bad/undefined arguments.
The ltpchecks make sure valgrind none/memcheck work exactly the same as when the test wasn't run under valgrind.
Comment 2 Paul Floyd 2025-08-28 12:48:05 UTC
My experience of messiness in the scalar tests is with any new syscalls. The problem is that you may need to handle several different kernel versions, some with and some without new syscalls.

The way that this was handled in Solaris / illumos was to add a new scalar test for each new syscall, each having a configure test.

On FreeBSD I added fake output for older kernels that don't support new syscalls.

On Linux there's also the issue of different syscall numbers on different platforms.

Still, I like the syscall test. It does a lot of quick testing.
Comment 3 Matthias Schwarzott 2025-08-29 09:41:00 UTC
Created attachment 184550 [details]
add minimal scalar test for amd64-linux (V2)
Comment 4 Paul Floyd 2025-08-29 17:26:29 UTC
Thanks for the patch!

commit 446ee179cec7dae91534bb781ef3defae26a4e10 (HEAD -> master, origin/master, origin/HEAD)
Author: Matthias Schwarzott <zzam@gentoo.org>
Date:   Sat Aug 23 13:37:46 2025 +0200

    Bug 508777 - amd64-linux: add minimal scalar test