]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
FreeBSD regtest: add scalar_arg_check for arm64
authorPaul Floyd <pjfloyd@wanadoo.fr>
Sat, 20 Sep 2025 19:01:22 +0000 (21:01 +0200)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Sat, 20 Sep 2025 19:01:22 +0000 (21:01 +0200)
Much the same as arm64. x86 otoh is the only FreeBSD platform to use
PRE_REG_READ8 (again for sendfile).

.gitignore
configure.ac
memcheck/tests/Makefile.am
memcheck/tests/arm64-freebsd/Makefile.am [new file with mode: 0644]
memcheck/tests/arm64-freebsd/filter_arg_check [new file with mode: 0755]
memcheck/tests/arm64-freebsd/filter_stderr [new file with mode: 0755]
memcheck/tests/arm64-freebsd/scalar_arg_check.c [new symlink]
memcheck/tests/arm64-freebsd/scalar_arg_check.stderr.exp [new file with mode: 0644]
memcheck/tests/arm64-freebsd/scalar_arg_check.vgtest [new symlink]

index 75675b1310aae48b9af13b747fcf075a5592ec9b..a5e97008be62723a2a6644953a55039e666392ae 100644 (file)
 /memcheck/tests/x86-freebsd/posix_fallocate
 /memcheck/tests/x86-freebsd/reallocarray
 
+# /memcheck/tests/arm64-freebsd
+/memcheck/tests/arm64-freebsd/*.stderr.diff
+/memcheck/tests/arm64-freebsd/*.stderr.out
+/memcheck/tests/arm64-freebsd/*.stdout.diff
+/memcheck/tests/arm64-freebsd/*.stdout.out
+/memcheck/tests/arm64-freebsd/.deps
+/memcheck/tests/arm64-freebsd/Makefile
+/memcheck/tests/arm64-freebsd/Makefile.in
+/memcheck/tests/arm64-freebsd/scalar_arg_check
+
 # /mpi/
 /mpi/*.dSYM
 /mpi/*.so
index 1740008a6163af01709e89b72ccaf95b646a0d76..1e7d506557dda6c4eea5de3e7b504dc2ee7b3437 100755 (executable)
@@ -5779,6 +5779,7 @@ AC_CONFIG_FILES([
    memcheck/tests/amd64-solaris/Makefile
    memcheck/tests/x86-solaris/Makefile
    memcheck/tests/amd64-freebsd/Makefile
+   memcheck/tests/arm64-freebsd/Makefile
    memcheck/tests/x86-freebsd/Makefile
    memcheck/tests/ppc32/Makefile
    memcheck/tests/ppc64/Makefile
index c1779a7bb35415d7f46121002c1084c2c6b536b2..c9a617c48697e4d97b63fe6092e25b3754c54c7c 100644 (file)
@@ -68,6 +68,9 @@ endif
 if VGCONF_PLATFORMS_INCLUDE_AMD64_FREEBSD
 SUBDIRS += amd64-freebsd
 endif
+if VGCONF_PLATFORMS_INCLUDE_ARM64_FREEBSD
+SUBDIRS += arm64-freebsd
+endif
 
 DIST_SUBDIRS = x86 amd64 arm64 ppc32 ppc64 s390x linux \
                darwin solaris x86-linux amd64-linux arm64-linux riscv64-linux \
diff --git a/memcheck/tests/arm64-freebsd/Makefile.am b/memcheck/tests/arm64-freebsd/Makefile.am
new file mode 100644 (file)
index 0000000..6652322
--- /dev/null
@@ -0,0 +1,16 @@
+
+include $(top_srcdir)/Makefile.tool-tests.am
+
+dist_noinst_SCRIPTS = filter_stderr filter_arg_check
+
+EXTRA_DIST = \
+       scalar_arg_check.vgtest \
+       scalar_arg_check.stderr.exp
+
+check_PROGRAMS = \
+       scalar_arg_check
+
+AM_CFLAGS    += @FLAG_M64@
+AM_CXXFLAGS  += @FLAG_M64@
+AM_CCASFLAGS += @FLAG_M64@
+
diff --git a/memcheck/tests/arm64-freebsd/filter_arg_check b/memcheck/tests/arm64-freebsd/filter_arg_check
new file mode 100755 (executable)
index 0000000..334a326
--- /dev/null
@@ -0,0 +1,22 @@
+#! /bin/sh
+
+# Only one test uses this which calls syscall(SYS_sendfile)
+# which is the only amd64 syscall that uses 7 arguments
+# The output includes --trace-syscalls=yes which is very verbose
+# but we only want to see the sendfile line
+
+# the libc signature for sendfile is
+#     int sendfile(int fd, int s, off_t offset, size_t nbytes,
+#                  struct sf_hdtr *hdtr, off_t *sbytes, int flags);
+# The testcase uses values from 101 to 107 for the arguments
+# (to make it easy to match the testcase to the log output)
+# Some of the arguments are printed as hex, not too bad.
+# Argument 6 is an offset which seems to get added to some
+# variable length base address before being sent to the syscall.
+# I've checked with truss and ktrace, this doesn't come from Valgrind
+
+grep "SYSCALL.*sendfile" |
+sed 's/==.*//' |
+awk '{l=length($9);$9="0x"substr($9, l-2, l);print}' |
+sed -E 's/\[[0-9]{5}/[xxxxx/'
+
diff --git a/memcheck/tests/arm64-freebsd/filter_stderr b/memcheck/tests/arm64-freebsd/filter_stderr
new file mode 100755 (executable)
index 0000000..a778e97
--- /dev/null
@@ -0,0 +1,3 @@
+#! /bin/sh
+
+../filter_stderr "$@"
diff --git a/memcheck/tests/arm64-freebsd/scalar_arg_check.c b/memcheck/tests/arm64-freebsd/scalar_arg_check.c
new file mode 120000 (symlink)
index 0000000..629936b
--- /dev/null
@@ -0,0 +1 @@
+../amd64-freebsd/scalar_arg_check.c
\ No newline at end of file
diff --git a/memcheck/tests/arm64-freebsd/scalar_arg_check.stderr.exp b/memcheck/tests/arm64-freebsd/scalar_arg_check.stderr.exp
new file mode 100644 (file)
index 0000000..7b9fc63
--- /dev/null
@@ -0,0 +1 @@
+SYSCALL[xxxxx,1](393) sys_sendfile ( 101, 102, 103, 104, 0x69, 0x6a, 107 )
diff --git a/memcheck/tests/arm64-freebsd/scalar_arg_check.vgtest b/memcheck/tests/arm64-freebsd/scalar_arg_check.vgtest
new file mode 120000 (symlink)
index 0000000..5b2d7ff
--- /dev/null
@@ -0,0 +1 @@
+../amd64-freebsd/scalar_arg_check.vgtest
\ No newline at end of file