Initial commit
This commit is contained in:
+27
@@ -0,0 +1,27 @@
|
||||
From 470399f3636c412b74f9daf6ae430b13c3126f02 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Thu, 15 Dec 2022 15:54:27 -0800
|
||||
Subject: [PATCH] configure: Use autoconf macro to detect largefile support
|
||||
|
||||
Adds --enable-largefile/--disable-largefile configure knobs
|
||||
where default is to detect the support
|
||||
|
||||
Upstream-Status: Submitted [https://github.com/strace/strace/pull/230]
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
configure.ac | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 4797b42dd..7d57fb254 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -43,6 +43,8 @@ AC_PROG_INSTALL
|
||||
AC_PROG_RANLIB
|
||||
AC_PROG_LN_S
|
||||
|
||||
+AC_SYS_LARGEFILE
|
||||
+
|
||||
AC_USE_SYSTEM_EXTENSIONS
|
||||
AX_CODE_COVERAGE
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
From 6309792c49ca900cec6a7f1dc5b51bf75b629e11 Mon Sep 17 00:00:00 2001
|
||||
From: Jeremy Puhlman <jpuhlman@mvista.com>
|
||||
Date: Wed, 11 Mar 2020 19:56:55 +0000
|
||||
Subject: [PATCH] strace: fix reproducibilty issues
|
||||
|
||||
The full path to the gen_tests.sh script is encoded in the tests
|
||||
|
||||
Upstream-Status: Pending
|
||||
|
||||
Signed-off-by: Jeremy Puhlman <jpuhlman@mvista.com>
|
||||
---
|
||||
tests/gen_tests.sh | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/tests/gen_tests.sh b/tests/gen_tests.sh
|
||||
index 5e1e7c9..1e65eac 100755
|
||||
--- a/tests/gen_tests.sh
|
||||
+++ b/tests/gen_tests.sh
|
||||
@@ -46,7 +46,7 @@ while read -r name arg0 args; do {
|
||||
|
||||
hdr="\
|
||||
#!/bin/sh -efu
|
||||
-# Generated by $0 from $input ($name $arg0 $args); do not edit."
|
||||
+# Generated by $(basename $0) from $input ($name $arg0 $args); do not edit."
|
||||
|
||||
case "$arg0" in
|
||||
+*)
|
||||
@@ -80,7 +80,7 @@ while read -r name arg0 args; do {
|
||||
|
||||
if [ -n "$names" ]; then
|
||||
{
|
||||
- printf '# Generated by %s from %s; do not edit.\n' "$0" "$input"
|
||||
+ printf '# Generated by %s from %s; do not edit.\n' "$(basename $0)" "$input"
|
||||
printf 'GEN_TESTS ='
|
||||
printf ' %s.gen.test' $names
|
||||
echo
|
||||
--
|
||||
2.24.1
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
From 579b2ebe52d4b97f954e6188df2d07e137820075 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Thu, 15 Dec 2022 15:56:13 -0800
|
||||
Subject: [PATCH] tests: Replace off64_t with off_t
|
||||
|
||||
when _FILE_OFFSET_BITS=64 then off_t is 64bit wide, this also fixes
|
||||
build on musl where off64_t is not available without _LARGEFILE64_SOURCE
|
||||
|
||||
Upstream-Status: Submitted [https://github.com/strace/strace/pull/230]
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
tests/readahead.c | 2 +-
|
||||
tests/sync_file_range2.c | 4 ++--
|
||||
2 files changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/tests/readahead.c
|
||||
+++ b/tests/readahead.c
|
||||
@@ -42,7 +42,7 @@ static const int fds[] = {
|
||||
0x7fffffff,
|
||||
};
|
||||
|
||||
-static const off64_t offsets[] = {
|
||||
+static const off_t offsets[] = {
|
||||
-0x8000000000000000LL,
|
||||
-0x5060708090a0b0c0LL,
|
||||
-1LL,
|
||||
--- a/tests/sync_file_range2.c
|
||||
+++ b/tests/sync_file_range2.c
|
||||
@@ -20,8 +20,8 @@ int
|
||||
main(void)
|
||||
{
|
||||
const int fd = -1;
|
||||
- const off64_t offset = 0xdeadbeefbadc0ded;
|
||||
- const off64_t nbytes = 0xfacefeedcafef00d;
|
||||
+ const off_t offset = 0xdeadbeefbadc0ded;
|
||||
+ const off_t nbytes = 0xfacefeedcafef00d;
|
||||
const unsigned int flags = -1;
|
||||
|
||||
int rc = sync_file_range(fd, offset, nbytes, flags);
|
||||
--- a/tests/sync_file_range.c
|
||||
+++ b/tests/sync_file_range.c
|
||||
@@ -20,8 +20,8 @@ int
|
||||
main(void)
|
||||
{
|
||||
const int fd = -1;
|
||||
- const off64_t offset = 0xdeadbeefbadc0dedULL;
|
||||
- const off64_t nbytes = 0xfacefeedcafef00dULL;
|
||||
+ const off_t offset = 0xdeadbeefbadc0dedULL;
|
||||
+ const off_t nbytes = 0xfacefeedcafef00dULL;
|
||||
const unsigned int flags = -1;
|
||||
|
||||
int rc = sync_file_range(fd, offset, nbytes, flags);
|
||||
+303
@@ -0,0 +1,303 @@
|
||||
From 00ace1392f5bd289239b755458dcdeeed69af1da Mon Sep 17 00:00:00 2001
|
||||
From: "Dmitry V. Levin" <ldv@strace.io>
|
||||
Date: Mon, 26 Jun 2023 10:00:00 +0000
|
||||
Subject: [PATCH] tests: avoid accept() libc function when tracing accept()
|
||||
syscall
|
||||
|
||||
The libc function is allowed to implement accept() using accept4()
|
||||
syscall, so migrate to accept4() those tests that trace accept() syscall
|
||||
but do not test accept() specifically, and change the test of accept()
|
||||
syscall to invoke either __NR_accept or __NR_socketcall(SYS_ACCEPT)
|
||||
directly.
|
||||
|
||||
* tests/accept_compat.h: Remove.
|
||||
* tests/Makefile.am (EXTRA_DIST): Remove accept_compat.h.
|
||||
* tests/accept.c [TEST_SYSCALL_NAME]: Do not invoke accept(),
|
||||
call __NR_accept or __NR_socketcall if available, or skip the test.
|
||||
* tests/net-y-unix.c: Do not include "accept_compat.h".
|
||||
(main): Invoke accept4() instead of accept().
|
||||
* tests/net-yy-inet.c: Likewise.
|
||||
* tests/net-yy-unix.c: Likewise.
|
||||
|
||||
Resolves: https://github.com/strace/strace/issues/260
|
||||
|
||||
Upstream-Status: Backport
|
||||
---
|
||||
tests/Makefile.am | 1 -
|
||||
tests/accept.c | 36 ++++++++++++++++++++----------------
|
||||
tests/accept_compat.h | 32 --------------------------------
|
||||
tests/net-y-unix.c | 16 ++++++++--------
|
||||
tests/net-yy-inet.c | 12 ++++++------
|
||||
tests/net-yy-unix.c | 16 ++++++++--------
|
||||
6 files changed, 42 insertions(+), 71 deletions(-)
|
||||
delete mode 100644 tests/accept_compat.h
|
||||
|
||||
Index: strace-6.3/tests/Makefile.am
|
||||
===================================================================
|
||||
--- strace-6.3.orig/tests/Makefile.am
|
||||
+++ strace-6.3/tests/Makefile.am
|
||||
@@ -776,7 +776,6 @@ check_DATA = \
|
||||
# end of check_DATA
|
||||
|
||||
EXTRA_DIST = \
|
||||
- accept_compat.h \
|
||||
attach-p-cmd.h \
|
||||
clock_adjtime-common.c \
|
||||
clock_xettime-common.c \
|
||||
Index: strace-6.3/tests/accept.c
|
||||
===================================================================
|
||||
--- strace-6.3.orig/tests/accept.c
|
||||
+++ strace-6.3/tests/accept.c
|
||||
@@ -9,38 +9,36 @@
|
||||
*/
|
||||
|
||||
#include "tests.h"
|
||||
-
|
||||
+#include "scno.h"
|
||||
#include <unistd.h>
|
||||
|
||||
-#include "scno.h"
|
||||
+#ifndef TEST_SYSCALL_NAME
|
||||
|
||||
-#if defined __NR_accept
|
||||
+# if defined __NR_accept || defined __NR_socketcall
|
||||
|
||||
-# ifndef TEST_SYSCALL_NAME
|
||||
# define TEST_SYSCALL_NAME do_accept
|
||||
-
|
||||
-# ifndef TEST_SYSCALL_STR
|
||||
-# define TEST_SYSCALL_STR "accept"
|
||||
-# endif
|
||||
+# define TEST_SYSCALL_STR "accept"
|
||||
|
||||
static int
|
||||
do_accept(int sockfd, void *addr, void *addrlen)
|
||||
{
|
||||
+# ifdef __NR_accept
|
||||
return syscall(__NR_accept, sockfd, addr, addrlen);
|
||||
+# else /* __NR_socketcall */
|
||||
+ const long args[] = { sockfd, (long) addr, (long) addrlen };
|
||||
+ return syscall(__NR_socketcall, 5, args);
|
||||
+# endif
|
||||
}
|
||||
-# endif /* !TEST_SYSCALL_NAME */
|
||||
|
||||
-#else /* !__NR_accept */
|
||||
+# endif /* __NR_accept || __NR_socketcall */
|
||||
|
||||
-# ifndef TEST_SYSCALL_NAME
|
||||
-# define TEST_SYSCALL_NAME accept
|
||||
-# endif
|
||||
+#endif /* !TEST_SYSCALL_NAME */
|
||||
|
||||
-#endif /* __NR_accept */
|
||||
+#ifdef TEST_SYSCALL_NAME
|
||||
|
||||
-#define TEST_SYSCALL_PREPARE connect_un()
|
||||
+# define TEST_SYSCALL_PREPARE connect_un()
|
||||
static void connect_un(void);
|
||||
-#include "sockname.c"
|
||||
+# include "sockname.c"
|
||||
|
||||
static void
|
||||
connect_un(void)
|
||||
@@ -90,3 +88,9 @@ main(void)
|
||||
puts("+++ exited with 0 +++");
|
||||
return 0;
|
||||
}
|
||||
+
|
||||
+#else
|
||||
+
|
||||
+SKIP_MAIN_UNDEFINED("__NR_accept || __NR_socketcall")
|
||||
+
|
||||
+#endif
|
||||
Index: strace-6.3/tests/accept_compat.h
|
||||
===================================================================
|
||||
--- strace-6.3.orig/tests/accept_compat.h
|
||||
+++ /dev/null
|
||||
@@ -1,32 +0,0 @@
|
||||
-/*
|
||||
- * Copyright (c) 2018-2019 The strace developers.
|
||||
- * All rights reserved.
|
||||
- *
|
||||
- * SPDX-License-Identifier: GPL-2.0-or-later
|
||||
- */
|
||||
-
|
||||
-#ifndef _STRACE_TESTS_ACCEPT_COMPAT_H_
|
||||
-# define _STRACE_TESTS_ACCEPT_COMPAT_H_
|
||||
-
|
||||
-# include <unistd.h>
|
||||
-# include <sys/socket.h>
|
||||
-# include "scno.h"
|
||||
-
|
||||
-# if defined __NR_socketcall && defined __sparc__
|
||||
-/*
|
||||
- * Work around the fact that
|
||||
- * - glibc >= 2.26 uses accept4 syscall to implement accept() call on sparc;
|
||||
- * - accept syscall had not been wired up on sparc until v4.4-rc8~4^2~1.
|
||||
- */
|
||||
-static inline int
|
||||
-do_accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen)
|
||||
-{
|
||||
- const long args[] = { sockfd, (long) addr, (long) addrlen };
|
||||
-
|
||||
- return syscall(__NR_socketcall, 5, args);
|
||||
-}
|
||||
-# else
|
||||
-# define do_accept accept
|
||||
-# endif
|
||||
-
|
||||
-#endif /* !_STRACE_TESTS_ACCEPT_COMPAT_H_ */
|
||||
Index: strace-6.3/tests/net-y-unix.c
|
||||
===================================================================
|
||||
--- strace-6.3.orig/tests/net-y-unix.c
|
||||
+++ strace-6.3/tests/net-y-unix.c
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#include "tests.h"
|
||||
#include <assert.h>
|
||||
+#include <fcntl.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -18,8 +19,6 @@
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
|
||||
-#include "accept_compat.h"
|
||||
-
|
||||
#define TEST_SOCKET "net-y-unix.socket"
|
||||
|
||||
int
|
||||
@@ -88,12 +87,12 @@ main(void)
|
||||
struct sockaddr * const accept_sa = tail_alloc(sizeof(addr));
|
||||
memset(accept_sa, 0, sizeof(addr));
|
||||
*len = sizeof(addr);
|
||||
- int accept_fd = do_accept(listen_fd, accept_sa, len);
|
||||
+ int accept_fd = accept4(listen_fd, accept_sa, len, O_CLOEXEC);
|
||||
if (accept_fd < 0)
|
||||
perror_msg_and_fail("accept");
|
||||
unsigned long accept_inode = inode_of_sockfd(accept_fd);
|
||||
- printf("accept(%d<socket:[%lu]>, {sa_family=AF_UNIX}"
|
||||
- ", [%d => %d]) = %d<socket:[%lu]>\n",
|
||||
+ printf("accept4(%d<socket:[%lu]>, {sa_family=AF_UNIX}"
|
||||
+ ", [%d => %d], SOCK_CLOEXEC) = %d<socket:[%lu]>\n",
|
||||
listen_fd, listen_inode,
|
||||
(int) sizeof(addr), (int) *len,
|
||||
accept_fd, accept_inode);
|
||||
@@ -160,14 +159,15 @@ main(void)
|
||||
|
||||
memset(accept_sa, 0, sizeof(addr));
|
||||
*len = sizeof(addr);
|
||||
- accept_fd = do_accept(listen_fd, accept_sa, len);
|
||||
+ accept_fd = accept4(listen_fd, accept_sa, len, O_CLOEXEC);
|
||||
if (accept_fd < 0)
|
||||
perror_msg_and_fail("accept");
|
||||
accept_inode = inode_of_sockfd(accept_fd);
|
||||
const char * const sun_path1 =
|
||||
((struct sockaddr_un *) accept_sa)->sun_path + 1;
|
||||
- printf("accept(%d<socket:[%lu]>, {sa_family=AF_UNIX"
|
||||
- ", sun_path=@\"%s\"}, [%d => %d]) = %d<socket:[%lu]>\n",
|
||||
+ printf("accept4(%d<socket:[%lu]>, {sa_family=AF_UNIX"
|
||||
+ ", sun_path=@\"%s\"}, [%d => %d], SOCK_CLOEXEC)"
|
||||
+ " = %d<socket:[%lu]>\n",
|
||||
listen_fd, listen_inode, sun_path1,
|
||||
(int) sizeof(addr), (int) *len,
|
||||
accept_fd, accept_inode);
|
||||
Index: strace-6.3/tests/net-yy-inet.c
|
||||
===================================================================
|
||||
--- strace-6.3.orig/tests/net-yy-inet.c
|
||||
+++ strace-6.3/tests/net-yy-inet.c
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#include "tests.h"
|
||||
#include <assert.h>
|
||||
+#include <fcntl.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -19,8 +20,6 @@
|
||||
#include <netinet/tcp.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
-#include "accept_compat.h"
|
||||
-
|
||||
#ifndef ADDR_FAMILY
|
||||
# define ADDR_FAMILY_FIELD sin_family
|
||||
# define ADDR_FAMILY AF_INET
|
||||
@@ -104,14 +103,15 @@ main(void)
|
||||
struct sockaddr * const accept_sa = tail_alloc(sizeof(addr));
|
||||
memset(accept_sa, 0, sizeof(addr));
|
||||
*len = sizeof(addr);
|
||||
- const int accept_fd = do_accept(listen_fd, accept_sa, len);
|
||||
+ const int accept_fd = accept4(listen_fd, accept_sa, len, O_CLOEXEC);
|
||||
if (accept_fd < 0)
|
||||
perror_msg_and_fail("accept");
|
||||
const unsigned int connect_port =
|
||||
ntohs(((struct SOCKADDR_TYPE *) accept_sa)->INPORT);
|
||||
- printf("accept(%d<" TCP_STR ":[" LOOPBACK ":%u]>, {sa_family=" AF_STR
|
||||
- ", " INPORT_STR "=htons(%u), " INADDR_STR SA_FIELDS "}"
|
||||
- ", [%u]) = %d<" TCP_STR ":[" LOOPBACK ":%u->" LOOPBACK ":%u]>\n",
|
||||
+ printf("accept4(%d<" TCP_STR ":[" LOOPBACK ":%u]>, {sa_family=" AF_STR
|
||||
+ ", " INPORT_STR "=htons(%u), " INADDR_STR SA_FIELDS "}, [%u]"
|
||||
+ ", SOCK_CLOEXEC) = %d<" TCP_STR ":[" LOOPBACK ":%u->" LOOPBACK
|
||||
+ ":%u]>\n",
|
||||
listen_fd, listen_port, connect_port, (unsigned) *len,
|
||||
accept_fd, listen_port, connect_port);
|
||||
|
||||
Index: strace-6.3/tests/net-yy-unix.c
|
||||
===================================================================
|
||||
--- strace-6.3.orig/tests/net-yy-unix.c
|
||||
+++ strace-6.3/tests/net-yy-unix.c
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#include "tests.h"
|
||||
#include <assert.h>
|
||||
+#include <fcntl.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -22,8 +23,6 @@
|
||||
# include "xmalloc.h"
|
||||
#endif
|
||||
|
||||
-#include "accept_compat.h"
|
||||
-
|
||||
#define TEST_SOCKET "net-yy-unix.socket"
|
||||
|
||||
int
|
||||
@@ -112,12 +111,12 @@ main(void)
|
||||
struct sockaddr * const accept_sa = tail_alloc(sizeof(addr));
|
||||
memset(accept_sa, 0, sizeof(addr));
|
||||
*len = sizeof(addr);
|
||||
- int accept_fd = do_accept(listen_fd, accept_sa, len);
|
||||
+ int accept_fd = accept4(listen_fd, accept_sa, len, O_CLOEXEC);
|
||||
if (accept_fd < 0)
|
||||
perror_msg_and_fail("accept");
|
||||
unsigned long accept_inode = inode_of_sockfd(accept_fd);
|
||||
- printf("accept(%d<%s:[%lu,\"%s\"]>, {sa_family=AF_UNIX}"
|
||||
- ", [%d => %d]) = %d<%s:[%lu->%lu,\"%s\"]>\n",
|
||||
+ printf("accept4(%d<%s:[%lu,\"%s\"]>, {sa_family=AF_UNIX}"
|
||||
+ ", [%d => %d], SOCK_CLOEXEC) = %d<%s:[%lu->%lu,\"%s\"]>\n",
|
||||
listen_fd, sock_proto_name, listen_inode, TEST_SOCKET,
|
||||
(int) sizeof(addr), (int) *len,
|
||||
accept_fd, sock_proto_name, accept_inode, connect_inode,
|
||||
@@ -191,14 +190,15 @@ main(void)
|
||||
|
||||
memset(accept_sa, 0, sizeof(addr));
|
||||
*len = sizeof(addr);
|
||||
- accept_fd = do_accept(listen_fd, accept_sa, len);
|
||||
+ accept_fd = accept4(listen_fd, accept_sa, len, O_CLOEXEC);
|
||||
if (accept_fd < 0)
|
||||
perror_msg_and_fail("accept");
|
||||
accept_inode = inode_of_sockfd(accept_fd);
|
||||
const char * const sun_path1 =
|
||||
((struct sockaddr_un *) accept_sa)->sun_path + 1;
|
||||
- printf("accept(%d<%s:[%lu,\"%s\"]>, {sa_family=AF_UNIX"
|
||||
- ", sun_path=@\"%s\"}, [%d => %d]) = %d<%s:[%lu->%lu,\"%s\"]>\n",
|
||||
+ printf("accept4(%d<%s:[%lu,\"%s\"]>, {sa_family=AF_UNIX"
|
||||
+ ", sun_path=@\"%s\"}, [%d => %d], SOCK_CLOEXEC)"
|
||||
+ " = %d<%s:[%lu->%lu,\"%s\"]>\n",
|
||||
listen_fd, sock_proto_name, listen_inode, TEST_SOCKET,
|
||||
sun_path1, (int) sizeof(addr), (int) *len,
|
||||
accept_fd, sock_proto_name, accept_inode, connect_inode,
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
From 3bbfb541b258baec9eba674b5d8dc30007a61542 Mon Sep 17 00:00:00 2001
|
||||
From: "Dmitry V. Levin" <ldv@strace.io>
|
||||
Date: Wed, 21 Jun 2023 08:00:00 +0000
|
||||
Subject: [PATCH] net: enhance getsockopt decoding
|
||||
|
||||
When getsockopt syscall fails the kernel sometimes updates the optlen
|
||||
argument, for example, NETLINK_LIST_MEMBERSHIPS updates it even if
|
||||
optval is not writable.
|
||||
|
||||
* src/net.c (SYS_FUNC(getsockopt)): Try to fetch and print optlen
|
||||
argument on exiting syscall regardless of getsockopt exit status.
|
||||
|
||||
Upstream-Status: Backport
|
||||
---
|
||||
src/net.c | 15 ++++++++++++++-
|
||||
1 file changed, 14 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/net.c b/src/net.c
|
||||
index f68ccb947..7244b5e57 100644
|
||||
--- a/src/net.c
|
||||
+++ b/src/net.c
|
||||
@@ -1038,7 +1038,7 @@ SYS_FUNC(getsockopt)
|
||||
} else {
|
||||
ulen = get_tcb_priv_ulong(tcp);
|
||||
|
||||
- if (syserror(tcp) || umove(tcp, tcp->u_arg[4], &rlen) < 0) {
|
||||
+ if (umove(tcp, tcp->u_arg[4], &rlen) < 0) {
|
||||
/* optval */
|
||||
printaddr(tcp->u_arg[3]);
|
||||
tprint_arg_next();
|
||||
@@ -1047,6 +1047,19 @@ SYS_FUNC(getsockopt)
|
||||
tprint_indirect_begin();
|
||||
PRINT_VAL_D(ulen);
|
||||
tprint_indirect_end();
|
||||
+ } else if (syserror(tcp)) {
|
||||
+ /* optval */
|
||||
+ printaddr(tcp->u_arg[3]);
|
||||
+ tprint_arg_next();
|
||||
+
|
||||
+ /* optlen */
|
||||
+ tprint_indirect_begin();
|
||||
+ if (ulen != rlen) {
|
||||
+ PRINT_VAL_D(ulen);
|
||||
+ tprint_value_changed();
|
||||
+ }
|
||||
+ PRINT_VAL_D(rlen);
|
||||
+ tprint_indirect_end();
|
||||
} else {
|
||||
/* optval */
|
||||
print_getsockopt(tcp, tcp->u_arg[1], tcp->u_arg[2],
|
||||
@@ -0,0 +1,50 @@
|
||||
From 1f50e0a09d828be8f5b1f28db9af0b12492a1553 Mon Sep 17 00:00:00 2001
|
||||
From: Gabriel Barbu <gabriel.barbu@enea.com>
|
||||
Date: Thu, 25 Jul 2013 15:28:33 +0200
|
||||
Subject: [PATCH] strace: Add ptest
|
||||
|
||||
Upstream-Status: Inappropriate
|
||||
|
||||
Signed-off-by: Gabriel Barbu <gabriel.barbu@enea.com>
|
||||
Signed-off-by: Chong Lu <Chong.Lu@windriver.com>
|
||||
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
|
||||
|
||||
---
|
||||
tests/Makefile.am | 20 ++++++++++++++++++++
|
||||
1 file changed, 20 insertions(+)
|
||||
|
||||
diff --git a/tests/Makefile.am b/tests/Makefile.am
|
||||
index 55566ee..a7ae6f9 100644
|
||||
--- a/tests/Makefile.am
|
||||
+++ b/tests/Makefile.am
|
||||
@@ -16,6 +16,7 @@ SIZEOF_LONG = @SIZEOF_LONG@
|
||||
MPERS_NAME =
|
||||
MPERS_CC_FLAGS =
|
||||
ARCH_MFLAGS =
|
||||
+TEST_SUITE_LOG = test-suite.log
|
||||
AM_CFLAGS = $(WARN_CFLAGS)
|
||||
bundled_CPPFLAGS =
|
||||
if USE_BUNDLED_HEADERS
|
||||
@@ -703,3 +704,22 @@ BUILT_SOURCES = ksysent.h
|
||||
CLEANFILES = ksysent.h
|
||||
|
||||
include ../src/scno.am
|
||||
+
|
||||
+buildtest-TESTS: $(check_PROGRAMS) $(TESTS)
|
||||
+
|
||||
+install-ptest:
|
||||
+ install -d $(DESTDIR)/src
|
||||
+ install $(BUILDDIR)/src/strace $(DESTDIR)/src
|
||||
+ install $(srcdir)/../src/strace-log-merge $(DESTDIR)/src
|
||||
+ install -d $(DESTDIR)/$(TESTDIR)
|
||||
+ cp $(BUILDDIR)/$(TESTDIR)/Makefile $(DESTDIR)/$(TESTDIR)
|
||||
+ sed -i -e 's/^Makefile:/_Makefile:/' $(DESTDIR)/$(TESTDIR)/Makefile
|
||||
+ sed -i -e 's/bash/sh/' $(DESTDIR)/$(TESTDIR)/Makefile
|
||||
+ for file in $(check_PROGRAMS); do \
|
||||
+ install $(BUILDDIR)/$(TESTDIR)/$$file $(DESTDIR)/$(TESTDIR); \
|
||||
+ done
|
||||
+ for file in $(EXTRA_DIST); do \
|
||||
+ install $(srcdir)/$$file $(DESTDIR)/$(TESTDIR); \
|
||||
+ #sed -i -e 's/$${srcdir=.}/./g' $(DESTDIR)/$(TESTDIR)/$$file; \
|
||||
+ done
|
||||
+ for i in net scm_rights-fd rt_sigaction; do sed -i -e 's/$$srcdir/./g' $(DESTDIR)/$(TESTDIR)/$$i.test; done
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
From f31c2f4494779e5c5f170ad10539bfc2dfafe967 Mon Sep 17 00:00:00 2001
|
||||
From: "Dmitry V. Levin" <ldv@strace.io>
|
||||
Date: Sat, 24 Jun 2023 08:00:00 +0000
|
||||
Subject: [PATCH] tests: update sockopt-sol_netlink test
|
||||
|
||||
Update sockopt-sol_netlink test that started to fail, likely
|
||||
due to recent linux kernel commit f4e4534850a9 ("net/netlink: fix
|
||||
NETLINK_LIST_MEMBERSHIPS length report").
|
||||
|
||||
* tests/sockopt-sol_netlink.c (main): Always print changing optlen value
|
||||
on exiting syscall.
|
||||
|
||||
Reported-by: Alexander Gordeev <agordeev@linux.ibm.com>
|
||||
---
|
||||
tests/sockopt-sol_netlink.c | 13 ++++++++++---
|
||||
1 file changed, 10 insertions(+), 3 deletions(-)
|
||||
|
||||
Upstream-Status: Backport
|
||||
|
||||
diff --git a/tests/sockopt-sol_netlink.c b/tests/sockopt-sol_netlink.c
|
||||
index 82b98adc23..1c33219ac5 100644
|
||||
--- a/tests/sockopt-sol_netlink.c
|
||||
+++ b/tests/sockopt-sol_netlink.c
|
||||
@@ -94,7 +94,10 @@ main(void)
|
||||
printf("%p", val);
|
||||
else
|
||||
printf("[%d]", *val);
|
||||
- printf(", [%d]) = %s\n", *len, errstr);
|
||||
+ printf(", [%d", (int) sizeof(*val));
|
||||
+ if ((int) sizeof(*val) != *len)
|
||||
+ printf(" => %d", *len);
|
||||
+ printf("]) = %s\n", errstr);
|
||||
|
||||
/* optlen larger than necessary - shortened */
|
||||
*len = sizeof(*val) + 1;
|
||||
@@ -150,8 +153,12 @@ main(void)
|
||||
/* optval EFAULT - print address */
|
||||
*len = sizeof(*val);
|
||||
get_sockopt(fd, names[i].val, efault, len);
|
||||
- printf("getsockopt(%d, SOL_NETLINK, %s, %p, [%d]) = %s\n",
|
||||
- fd, names[i].str, efault, *len, errstr);
|
||||
+ printf("getsockopt(%d, SOL_NETLINK, %s, %p",
|
||||
+ fd, names[i].str, efault);
|
||||
+ printf(", [%d", (int) sizeof(*val));
|
||||
+ if ((int) sizeof(*val) != *len)
|
||||
+ printf(" => %d", *len);
|
||||
+ printf("]) = %s\n", errstr);
|
||||
|
||||
/* optlen EFAULT - print address */
|
||||
get_sockopt(fd, names[i].val, val, len + 1);
|
||||
@@ -0,0 +1,28 @@
|
||||
From 3fad4821d90cd264d1b94253b9cf4fdf5d4034b8 Mon Sep 17 00:00:00 2001
|
||||
From: Richard Purdie <richard.purdie@linuxfoundation.org>
|
||||
Date: Wed, 29 May 2019 00:10:32 +0100
|
||||
Subject: [PATCH] strace: Tweak ptest disk space management
|
||||
|
||||
If the test is successful, remove the log and exp files. This stops strace
|
||||
using around 600MB of disk space and running our ptest images out of space.
|
||||
|
||||
RP 2019/5/29
|
||||
|
||||
Upstream-Status: Inappropriate [specific to OE image space issues]
|
||||
|
||||
---
|
||||
tests/gen_tests.sh | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/tests/gen_tests.sh b/tests/gen_tests.sh
|
||||
index 3540204..5e1e7c9 100755
|
||||
--- a/tests/gen_tests.sh
|
||||
+++ b/tests/gen_tests.sh
|
||||
@@ -62,6 +62,7 @@ while read -r name arg0 args; do {
|
||||
$hdr
|
||||
. "\${srcdir=.}/init.sh"
|
||||
run_strace_match_diff $arg0 $args
|
||||
+ rm -rf log exp
|
||||
EOF
|
||||
;;
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -u
|
||||
|
||||
export TIMEOUT_DURATION=240
|
||||
make -B -C tests -k test-suite.log
|
||||
res=$?
|
||||
if [ $res -ne 0 ]; then
|
||||
cat tests/test-suite.log
|
||||
fi
|
||||
exit $res
|
||||
@@ -0,0 +1,49 @@
|
||||
Skip tests which are known to be unreliable under load, typically because they
|
||||
care about timing.
|
||||
|
||||
Upstream-Status: Inappropriate
|
||||
Signed-off-by: Ross Burton <ross.burton@arm.com>
|
||||
|
||||
---
|
||||
tests/clock_nanosleep.gen.test | 1 +
|
||||
tests/delay.test | 1 +
|
||||
tests/strace-r.test | 1 +
|
||||
3 files changed, 3 insertions(+)
|
||||
|
||||
diff --git a/tests/clock_nanosleep.gen.test b/tests/clock_nanosleep.gen.test
|
||||
index 7a6025b..f0e6dbb 100755
|
||||
--- a/tests/clock_nanosleep.gen.test
|
||||
+++ b/tests/clock_nanosleep.gen.test
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/sh -efu
|
||||
# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (clock_nanosleep -e trace=clock_nanosleep,clock_gettime); do not edit.
|
||||
. "${srcdir=.}/init.sh"
|
||||
+skip_ "Test not reliable under load"
|
||||
run_strace_match_diff -e trace=clock_nanosleep,clock_gettime
|
||||
diff --git a/tests/delay.test b/tests/delay.test
|
||||
index f74e27f..6172c04 100755
|
||||
--- a/tests/delay.test
|
||||
+++ b/tests/delay.test
|
||||
@@ -8,6 +8,7 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
. "${srcdir=.}/init.sh"
|
||||
+skip_ "Test not reliable under load"
|
||||
|
||||
while read -r denter dexit denter_us dexit_us; do
|
||||
[ -n "$denter" ] || continue
|
||||
diff --git a/tests/strace-r.test b/tests/strace-r.test
|
||||
index 8299737..d89c7df 100755
|
||||
--- a/tests/strace-r.test
|
||||
+++ b/tests/strace-r.test
|
||||
@@ -8,6 +8,7 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
. "${srcdir=.}/init.sh"
|
||||
+skip_ "Test not reliable under load"
|
||||
|
||||
r_opt="${1:--r}"
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
From 4cd26cfaec255ec87f22abe886e0be89312a9671 Mon Sep 17 00:00:00 2001
|
||||
From: Andre McCurdy <armccurdy@gmail.com>
|
||||
Date: Mon, 18 Jan 2016 11:01:00 -0800
|
||||
Subject: [PATCH] update gawk paths, /bin/gawk -> /usr/bin/gawk
|
||||
|
||||
The default path to gawk is /usr/bin/gawk, so update test scripts etc
|
||||
from #!/bin/gawk to #!/usr/bin/gawk. Fixes missing RDPENDS QA tests:
|
||||
|
||||
WARNING: QA Issue: /usr/lib/strace/ptest/tests/unix-yy-accept.awk_strace-ptest contained in package strace-ptest requires /bin/gawk, but no providers found in its RDEPENDS [file-rdeps]
|
||||
|
||||
Upstream-Status: Inappropriate [configuration]
|
||||
|
||||
Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
|
||||
|
||||
---
|
||||
src/mpers.awk | 2 +-
|
||||
tests-m32/caps.awk | 2 +-
|
||||
tests-m32/match.awk | 2 +-
|
||||
tests-m32/rt_sigaction.awk | 2 +-
|
||||
tests-mx32/caps.awk | 2 +-
|
||||
tests-mx32/match.awk | 2 +-
|
||||
tests-mx32/rt_sigaction.awk | 2 +-
|
||||
tests/caps.awk | 2 +-
|
||||
tests/match.awk | 2 +-
|
||||
tests/rt_sigaction.awk | 2 +-
|
||||
10 files changed, 10 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/src/mpers.awk b/src/mpers.awk
|
||||
index 25a212f..b2ff53f 100644
|
||||
--- a/src/mpers.awk
|
||||
+++ b/src/mpers.awk
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/bin/gawk
|
||||
+#!/usr/bin/gawk
|
||||
#
|
||||
# Copyright (c) 2015 Elvira Khabirova <lineprinter0@gmail.com>
|
||||
# Copyright (c) 2015-2016 Dmitry V. Levin <ldv@strace.io>
|
||||
diff --git a/tests-m32/caps.awk b/tests-m32/caps.awk
|
||||
index 69500ec..e5dfd87 100644
|
||||
--- a/tests-m32/caps.awk
|
||||
+++ b/tests-m32/caps.awk
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/bin/gawk
|
||||
+#!/usr/bin/gawk
|
||||
#
|
||||
# This file is part of caps strace test.
|
||||
#
|
||||
diff --git a/tests-m32/match.awk b/tests-m32/match.awk
|
||||
index 1cde87c..df63f78 100644
|
||||
--- a/tests-m32/match.awk
|
||||
+++ b/tests-m32/match.awk
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/bin/gawk
|
||||
+#!/usr/bin/gawk
|
||||
#
|
||||
# Copyright (c) 2014-2021 Dmitry V. Levin <ldv@strace.io>
|
||||
# All rights reserved.
|
||||
diff --git a/tests-m32/rt_sigaction.awk b/tests-m32/rt_sigaction.awk
|
||||
index dce78f5..573d9ea 100644
|
||||
--- a/tests-m32/rt_sigaction.awk
|
||||
+++ b/tests-m32/rt_sigaction.awk
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/bin/gawk
|
||||
+#!/usr/bin/gawk
|
||||
#
|
||||
# Copyright (c) 2014-2015 Dmitry V. Levin <ldv@strace.io>
|
||||
# Copyright (c) 2016 Elvira Khabirova <lineprinter0@gmail.com>
|
||||
diff --git a/tests-mx32/caps.awk b/tests-mx32/caps.awk
|
||||
index 69500ec..e5dfd87 100644
|
||||
--- a/tests-mx32/caps.awk
|
||||
+++ b/tests-mx32/caps.awk
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/bin/gawk
|
||||
+#!/usr/bin/gawk
|
||||
#
|
||||
# This file is part of caps strace test.
|
||||
#
|
||||
diff --git a/tests-mx32/match.awk b/tests-mx32/match.awk
|
||||
index 1cde87c..df63f78 100644
|
||||
--- a/tests-mx32/match.awk
|
||||
+++ b/tests-mx32/match.awk
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/bin/gawk
|
||||
+#!/usr/bin/gawk
|
||||
#
|
||||
# Copyright (c) 2014-2021 Dmitry V. Levin <ldv@strace.io>
|
||||
# All rights reserved.
|
||||
diff --git a/tests-mx32/rt_sigaction.awk b/tests-mx32/rt_sigaction.awk
|
||||
index dce78f5..573d9ea 100644
|
||||
--- a/tests-mx32/rt_sigaction.awk
|
||||
+++ b/tests-mx32/rt_sigaction.awk
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/bin/gawk
|
||||
+#!/usr/bin/gawk
|
||||
#
|
||||
# Copyright (c) 2014-2015 Dmitry V. Levin <ldv@strace.io>
|
||||
# Copyright (c) 2016 Elvira Khabirova <lineprinter0@gmail.com>
|
||||
diff --git a/tests/caps.awk b/tests/caps.awk
|
||||
index 69500ec..e5dfd87 100644
|
||||
--- a/tests/caps.awk
|
||||
+++ b/tests/caps.awk
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/bin/gawk
|
||||
+#!/usr/bin/gawk
|
||||
#
|
||||
# This file is part of caps strace test.
|
||||
#
|
||||
diff --git a/tests/match.awk b/tests/match.awk
|
||||
index 1cde87c..df63f78 100644
|
||||
--- a/tests/match.awk
|
||||
+++ b/tests/match.awk
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/bin/gawk
|
||||
+#!/usr/bin/gawk
|
||||
#
|
||||
# Copyright (c) 2014-2021 Dmitry V. Levin <ldv@strace.io>
|
||||
# All rights reserved.
|
||||
diff --git a/tests/rt_sigaction.awk b/tests/rt_sigaction.awk
|
||||
index dce78f5..573d9ea 100644
|
||||
--- a/tests/rt_sigaction.awk
|
||||
+++ b/tests/rt_sigaction.awk
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/bin/gawk
|
||||
+#!/usr/bin/gawk
|
||||
#
|
||||
# Copyright (c) 2014-2015 Dmitry V. Levin <ldv@strace.io>
|
||||
# Copyright (c) 2016 Elvira Khabirova <lineprinter0@gmail.com>
|
||||
diff --git a/tests-m32/caps-abbrev.awk b/tests-m32/caps-abbrev.awk
|
||||
index c00023b..a56cd56 100644
|
||||
--- a/tests-m32/caps-abbrev.awk
|
||||
+++ b/tests-m32/caps-abbrev.awk
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/bin/gawk
|
||||
+#!/usr/bin/gawk
|
||||
#
|
||||
# This file is part of caps strace test.
|
||||
#
|
||||
diff --git a/tests-mx32/caps-abbrev.awk b/tests-mx32/caps-abbrev.awk
|
||||
index c00023b..a56cd56 100644
|
||||
--- a/tests-mx32/caps-abbrev.awk
|
||||
+++ b/tests-mx32/caps-abbrev.awk
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/bin/gawk
|
||||
+#!/usr/bin/gawk
|
||||
#
|
||||
# This file is part of caps strace test.
|
||||
#
|
||||
diff --git a/tests/caps-abbrev.awk b/tests/caps-abbrev.awk
|
||||
index c00023b..a56cd56 100644
|
||||
--- a/tests/caps-abbrev.awk
|
||||
+++ b/tests/caps-abbrev.awk
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/bin/gawk
|
||||
+#!/usr/bin/gawk
|
||||
#
|
||||
# This file is part of caps strace test.
|
||||
#
|
||||
@@ -0,0 +1,61 @@
|
||||
SUMMARY = "System call tracing tool"
|
||||
HOMEPAGE = "http://strace.io"
|
||||
DESCRIPTION = "strace is a diagnostic, debugging and instructional userspace utility for Linux. It is used to monitor and tamper with interactions between processes and the Linux kernel, which include system calls, signal deliveries, and changes of process state."
|
||||
SECTION = "console/utils"
|
||||
LICENSE = "LGPL-2.1-or-later & GPL-2.0-or-later"
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=59a33f0a3e6122d67c0b3befccbdaa6b"
|
||||
|
||||
SRC_URI = "https://strace.io/files/${PV}/strace-${PV}.tar.xz \
|
||||
file://update-gawk-paths.patch \
|
||||
file://Makefile-ptest.patch \
|
||||
file://run-ptest \
|
||||
file://ptest-spacesave.patch \
|
||||
file://0001-strace-fix-reproducibilty-issues.patch \
|
||||
file://skip-load.patch \
|
||||
file://0001-configure-Use-autoconf-macro-to-detect-largefile-sup.patch \
|
||||
file://0002-tests-Replace-off64_t-with-off_t.patch \
|
||||
file://00ace1392f5bd289239b755458dcdeeed69af1da.patch \
|
||||
file://f31c2f4494779e5c5f170ad10539bfc2dfafe967.patch \
|
||||
file://3bbfb541b258baec9eba674b5d8dc30007a61542.patch \
|
||||
"
|
||||
SRC_URI[sha256sum] = "e17878e301506c1cc301611118ad14efee7f8bcef63b27ace5d290acce7bb731"
|
||||
|
||||
inherit autotools ptest
|
||||
|
||||
# Not yet ported to rv32
|
||||
COMPATIBLE_HOST:riscv32 = "null"
|
||||
|
||||
PACKAGECONFIG:class-target ??= "\
|
||||
${@bb.utils.contains('DISTRO_FEATURES', 'bluetooth', 'bluez', '', d)} \
|
||||
"
|
||||
|
||||
PACKAGECONFIG[bluez] = "ac_cv_header_bluetooth_bluetooth_h=yes,ac_cv_header_bluetooth_bluetooth_h=no,bluez5"
|
||||
PACKAGECONFIG[libunwind] = "--with-libunwind,--without-libunwind,libunwind"
|
||||
|
||||
EXTRA_OECONF += "--enable-mpers=no --disable-gcc-Werror"
|
||||
|
||||
CFLAGS:append:libc-musl = " -Dsigcontext_struct=sigcontext"
|
||||
|
||||
TESTDIR = "tests"
|
||||
PTEST_BUILD_HOST_PATTERN = "^(DEB_CHANGELOGTIME|RPM_CHANGELOGTIME|WARN_CFLAGS_FOR_BUILD|LDFLAGS_FOR_BUILD)"
|
||||
|
||||
do_compile_ptest() {
|
||||
oe_runmake -C ${TESTDIR} buildtest-TESTS
|
||||
}
|
||||
|
||||
do_install_ptest() {
|
||||
oe_runmake -C ${TESTDIR} install-ptest BUILDDIR=${B} DESTDIR=${D}${PTEST_PATH} TESTDIR=${TESTDIR}
|
||||
mkdir -p ${D}${PTEST_PATH}/build-aux
|
||||
mkdir -p ${D}${PTEST_PATH}/src
|
||||
install -m 755 ${S}/build-aux/test-driver ${D}${PTEST_PATH}/build-aux/
|
||||
install -m 644 ${B}/src/config.h ${D}${PTEST_PATH}/src/
|
||||
sed -i -e '/^src/s/strace.*[0-9]/ptest/' ${D}/${PTEST_PATH}/${TESTDIR}/Makefile
|
||||
}
|
||||
|
||||
RDEPENDS:${PN}-ptest += "make coreutils grep gawk sed"
|
||||
|
||||
RDEPENDS:${PN}-ptest:append:libc-glibc = "\
|
||||
locale-base-en-us.iso-8859-1 \
|
||||
"
|
||||
|
||||
BBCLASSEXTEND = "native"
|
||||
Reference in New Issue
Block a user