]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Move close_range test from memcheck/tests/freebsd to memcheck/tests
authorMark Wielaard <mark@klomp.org>
Thu, 7 Mar 2024 16:40:54 +0000 (17:40 +0100)
committerMark Wielaard <mark@klomp.org>
Thu, 7 Mar 2024 16:40:54 +0000 (17:40 +0100)
The close_range call is also available under linux and we already
have an appropriate configure call to test it. The only difference
is how the syscall arguments are called.

memcheck/tests/Makefile.am
memcheck/tests/close_range.c [moved from memcheck/tests/freebsd/close_range.c with 92% similarity]
memcheck/tests/close_range.stderr.exp [moved from memcheck/tests/freebsd/close_range.stderr.exp with 72% similarity]
memcheck/tests/close_range.stderr.exp.linux [new file with mode: 0644]
memcheck/tests/close_range.vgtest [moved from memcheck/tests/freebsd/close_range.vgtest with 100% similarity]
memcheck/tests/freebsd/Makefile.am

index 96a469e5425a7e5a62565c5407c00be3bbca4af9..db55195ba384c75b2b1ea210aa59622c3162b7c1 100644 (file)
@@ -132,6 +132,8 @@ EXTRA_DIST = \
        clireq_nofill.stdout.exp clireq_nofill.vgtest \
        clo_redzone_default.vgtest clo_redzone_128.vgtest \
        clo_redzone_default.stderr.exp clo_redzone_128.stderr.exp \
+       close_range.vgtest close_range.stderr.exp \
+       close_range.stderr.exp.linux \
        cond_ld.vgtest cond_ld.stdout.exp cond_ld.stderr.exp-arm \
                cond_ld.stderr.exp-64bit-non-arm \
                cond_ld.stderr.exp-32bit-non-arm \
@@ -578,6 +580,13 @@ check_PROGRAMS += cxx17_aligned_new sized_aligned_new_delete_args \
        sized_aligned_new_delete_misaligned3
 endif
 
+if HAVE_CLOSE_RANGE
+check_PROGRAMS += close_range
+endif
+
+close_range_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_UNUSED_BUT_SET_VARIABLE@ \
+                    @FLAG_W_NO_UNINITIALIZED@
+
 if HAVE_PTHREAD_BARRIER
 check_PROGRAMS += reach_thread_register
 endif
similarity index 92%
rename from memcheck/tests/freebsd/close_range.c
rename to memcheck/tests/close_range.c
index ba1adf9b5ca315830913d0a2a3e6eed8b26d1516..6d8b5a0ba842cfe0fcf44074b659441217484bd7 100644 (file)
@@ -1,3 +1,4 @@
+#define _GNU_SOURCE
 #include <unistd.h>
 #include <errno.h>
 #include <sys/types.h>
@@ -6,6 +7,11 @@
 #include <fcntl.h>
 #include <assert.h>
 
+/* For the linux kernel the CLOSE_RANGE_* constants are in a separate header.  */
+#if defined(__linux__)
+#include <linux/close_range.h>
+#endif
+
 /* It looks like close_range was initially implemented for FreeBSD 13
  * but without CLOSE_RANGE_CLOEXEC
  * That implementation got back ported to FreeBSD 12.2
similarity index 72%
rename from memcheck/tests/freebsd/close_range.stderr.exp
rename to memcheck/tests/close_range.stderr.exp
index d286837060e43c841a4effe8744e624d4c0f4214..2f4d018f22e1a56c457c75ad21574791b6f2768f 100644 (file)
@@ -1,12 +1,12 @@
 Syscall param close_range(lowfd) contains uninitialised byte(s)
    at 0x........: close_range (in /...libc...)
-   by 0x........: main (close_range.c:83)
+   by 0x........: main (close_range.c:89)
 
 Syscall param close_range(highfd) contains uninitialised byte(s)
    at 0x........: close_range (in /...libc...)
-   by 0x........: main (close_range.c:83)
+   by 0x........: main (close_range.c:89)
 
 Syscall param close_range(flags) contains uninitialised byte(s)
    at 0x........: close_range (in /...libc...)
-   by 0x........: main (close_range.c:83)
+   by 0x........: main (close_range.c:89)
 
diff --git a/memcheck/tests/close_range.stderr.exp.linux b/memcheck/tests/close_range.stderr.exp.linux
new file mode 100644 (file)
index 0000000..3a0de78
--- /dev/null
@@ -0,0 +1,12 @@
+Syscall param close_range(first) contains uninitialised byte(s)
+   at 0x........: close_range (in /...libc...)
+   by 0x........: main (close_range.c:89)
+
+Syscall param close_range(last) contains uninitialised byte(s)
+   at 0x........: close_range (in /...libc...)
+   by 0x........: main (close_range.c:89)
+
+Syscall param close_range(flags) contains uninitialised byte(s)
+   at 0x........: close_range (in /...libc...)
+   by 0x........: main (close_range.c:89)
+
index bff8f618415e4476e17779ea3a0f8a04622a6ad8..a3bf0c660dc3d5954806ce74ebaa99371b433c46 100644 (file)
@@ -35,7 +35,6 @@ EXTRA_DIST = \
                chflags.stderr.exp-x86 \
        chmod_chown.vgtest \
        chmod_chown.stderr.exp \
-       close_range.vgtest close_range.stderr.exp \
        delete_sized_mismatch.vgtest \
        delete_sized_mismatch.stderr.exp \
        delete_sized_mismatch_xml.vgtest \
@@ -191,14 +190,8 @@ scalar_15_plus_CFLAGS = ${AM_CFLAGS} -g
 timerfd_LDFLAGS = -lm
 endif
 
-if HAVE_CLOSE_RANGE
-check_PROGRAMS += close_range
-endif
-
 aligned_alloc_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_NON_POWER_OF_TWO_ALIGNMENT@
 
-close_range_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_UNUSED_BUT_SET_VARIABLE@
-
 delete_sized_mismatch_CXXFLAGS = ${AM_CXXFLAGS} --std=c++14
 delete_sized_mismatch_SOURCES = delete_sized_mismatch.cpp