[PATCH v1 2/2] tests/docs: Syscall suspension/resumption id
Sahil Siddiq
sahilcdq0 at gmail.com
Wed Dec 10 19:44:09 UTC 2025
Modify tests to verify id used for matching
suspend-resume syscall pairs.
Update docs to reflect this change.
* doc/strace.1.in: Document this change.
* tests/kill_child.test: Modify regex.
* tests/maybe_switch_current_tcp.c: Enhance output.
* tests/status-detached-threads.c: Likewise.
* tests/threads-execve.c: Likewise.
Signed-off-by: Sahil Siddiq <sahilcdq0 at gmail.com>
---
doc/strace.1.in | 6 +++---
tests/kill_child.test | 2 +-
tests/maybe_switch_current_tcp.c | 4 ++--
tests/status-detached-threads.c | 2 +-
tests/threads-execve.c | 16 ++++++++--------
5 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/doc/strace.1.in b/doc/strace.1.in
index 08806ab60..347ea161f 100644
--- a/doc/strace.1.in
+++ b/doc/strace.1.in
@@ -139,7 +139,7 @@ open("/foo/bar", O_RDONLY) = \-1 ENOENT (No such file or directory)
Signals are printed as signal symbol and decoded siginfo structure.
An excerpt from stracing and interrupting the command "sleep 666" is:
.CW
-sigsuspend([] <unfinished ...>
+sigsuspend([] <unfinished #1 ...>
--- SIGINT {si_signo=SIGINT, si_code=SI_USER, si_pid=...} ---
+++ killed by SIGINT +++
.CE
@@ -152,9 +152,9 @@ being
When the call returns it will be marked as
.IR resumed .
.CW
-[pid 28772] select(4, [3], NULL, NULL, NULL <unfinished ...>
+[pid 28772] select(4, [3], NULL, NULL, NULL <unfinished #2 ...>
[pid 28779] clock_gettime(CLOCK_REALTIME, {tv_sec=1130322148, tv_nsec=3977000}) = 0
-[pid 28772] <... select resumed> ) = 1 (in [3])
+[pid 28772] <... select resumed #2> ) = 1 (in [3])
.CE
Interruption of a (restartable) system call by a signal delivery is processed
differently as kernel terminates the system call and also arranges its
diff --git a/tests/kill_child.test b/tests/kill_child.test
index 37e884961..a0e22e1e7 100755
--- a/tests/kill_child.test
+++ b/tests/kill_child.test
@@ -22,7 +22,7 @@ while :; do
# Printing of "<... SYSCALL resumed>" in strace.c:print_event_exit
# used to segfault when the syscall number had not been obtained
# on syscall entering.
- grep -q '^[1-9][0-9]* <\.\.\. ??? resumed>) \+= ?$' "$LOG" && exit 0
+ grep -q '^[1-9][0-9]* <\.\.\. ??? resumed #[1-9][0-9]*>) \+= ?$' "$LOG" && exit 0
s1="$(date +%s)"
if [ "$((s1-s0))" -gt "$((TIMEOUT_DURATION/2))" ]; then
diff --git a/tests/maybe_switch_current_tcp.c b/tests/maybe_switch_current_tcp.c
index e4857532c..6a1f6b26f 100644
--- a/tests/maybe_switch_current_tcp.c
+++ b/tests/maybe_switch_current_tcp.c
@@ -29,7 +29,7 @@ thread(void *arg)
int tid = syscall(__NR_gettid);
printf("%-5d execveat(AT_FDCWD, \"%s\", [\"%s\", \"%s\", \"%s\"]"
- ", NULL, 0 <pid changed to %d ...>\n"
+ ", NULL, 0 <pid changed to %d ... (#1)>\n"
#if !QUIET_MSG
"%-5d +++ superseded by execve in pid %d +++\n"
#endif
@@ -76,7 +76,7 @@ main(int ac, char **av)
++trigger;
}
- printf("%-5d <... execveat resumed>) = 0\n"
+ printf("%-5d <... execveat resumed #1>) = 0\n"
"%-5d +++ exited with 0 +++\n",
leader, leader);
return 0;
diff --git a/tests/status-detached-threads.c b/tests/status-detached-threads.c
index 6c4330054..2d3cf607a 100644
--- a/tests/status-detached-threads.c
+++ b/tests/status-detached-threads.c
@@ -27,7 +27,7 @@ thread(void *arg)
pid_t pid = getpid();
pid_t tid = syscall(__NR_gettid);
- printf("%-5d execve(\"%s\", [\"%s\", \"0\"], NULL <pid changed to %u ...>\n"
+ printf("%-5d execve(\"%s\", [\"%s\", \"0\"], NULL <pid changed to %u ... (#1)>\n"
"%-5d +++ superseded by execve in pid %u +++\n"
"%-5d +++ exited with 0 +++\n",
tid, argv[0], argv[0], pid, pid, tid, pid);
diff --git a/tests/threads-execve.c b/tests/threads-execve.c
index 0458f253c..80079710d 100644
--- a/tests/threads-execve.c
+++ b/tests/threads-execve.c
@@ -129,22 +129,22 @@ thread(void *arg)
switch (action % NUMBER_OF_ACTIONS) {
case ACTION_exit:
printf("%-5d execve(\"%s\", [\"%s\", \"%s\", \"%s\"]"
- ", %p /* %u vars */ <pid changed to %u ...>\n",
+ ", %p /* %u vars */ <pid changed to %u ... (#1)>\n",
tid, argv[0], argv[0], argv[1], argv[2],
environ, arglen(environ), leader);
break;
case ACTION_rt_sigsuspend:
printf("%-5d execve(\"%s\", [\"%s\", \"%s\", \"%s\"]"
- ", %p /* %u vars */ <unfinished ...>\n"
- "%-5d <... rt_sigsuspend resumed>) = ?\n",
+ ", %p /* %u vars */ <unfinished #3 ...>\n"
+ "%-5d <... rt_sigsuspend resumed #2>) = ?\n",
tid, argv[0], argv[0], argv[1], argv[2],
environ, arglen(environ),
leader);
break;
case ACTION_nanosleep:
printf("%-5d execve(\"%s\", [\"%s\", \"%s\", \"%s\"]"
- ", %p /* %u vars */ <unfinished ...>\n"
- "%-5d <... nanosleep resumed> <unfinished ...>)"
+ ", %p /* %u vars */ <unfinished #5 ...>\n"
+ "%-5d <... nanosleep resumed #4> <unfinished ...>)"
" = ?\n",
tid, argv[0], argv[0], argv[1], argv[2],
environ, arglen(environ),
@@ -155,7 +155,7 @@ thread(void *arg)
# if PRINT_SUPERSEDED
printf("%-5d +++ superseded by execve in pid %u +++\n", leader, tid);
# endif
- printf("%-5d <... execve resumed>) = 0\n", leader);
+ printf("%-5d <... execve resumed #%u>) = 0\n", leader, 2 * action + 1);
(void) syscall(__NR_nanosleep, (unsigned long) &ots, 0UL);
execve(argv[0], argv, environ);
@@ -220,14 +220,14 @@ main(int ac, char **av)
(void) syscall(__NR_exit, 42);
break;
case ACTION_rt_sigsuspend:
- printf("%s rt_sigsuspend([], %u <unfinished ...>\n",
+ printf("%s rt_sigsuspend([], %u <unfinished #2 ...>\n",
leader_str, sigsetsize);
close(fds[1]);
(void) k_sigsuspend(&mask);
break;
case ACTION_nanosleep:
printf("%s nanosleep({tv_sec=%u, tv_nsec=0}"
- ", <unfinished ...>\n",
+ ", <unfinished #4 ...>\n",
leader_str, (unsigned int) ots.tv_sec);
close(fds[1]);
(void) syscall(__NR_nanosleep,
--
2.52.0
More information about the Strace-devel
mailing list