summaryrefslogtreecommitdiff
path: root/tests/attach-p-cmd.test
blob: f68eae088c9bc81e37784a28956fe19cf6803188 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh
#
# Check that simultaneous use of -p option and tracing of a command works.
#
# Copyright (c) 2016 Dmitry V. Levin <ldv@strace.io>
# Copyright (c) 2016-2021 The strace developers.
# All rights reserved.
#
# SPDX-License-Identifier: GPL-2.0-or-later

. "${srcdir=.}/init.sh"

run_prog_skip_if_failed \
	kill -0 $$

../set_ptracer_any ../attach-p-cmd-p >> "$EXP" &
tracee_pid=$!

while ! [ -s "$EXP" ]; do
	kill -0 $tracee_pid 2> /dev/null ||
		fail_ 'set_ptracer_any ../attach-p-cmd-p failed'
done

run_strace -a30 -echdir -p $tracee_pid ../attach-p-cmd-cmd > "$EXP"
match_diff "$LOG" "$EXP"