summaryrefslogtreecommitdiff
path: root/tests/attach-f-p.test
blob: b7a4a0d17e6644da3d5eb38b2cd38a8f5464e4c0 (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
26
#!/bin/sh
#
# Check that -f -p attaches to threads properly.
#
# Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
# Copyright (c) 2016-2018 The strace developers.
# All rights reserved.
#
# SPDX-License-Identifier: GPL-2.0-or-later

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

run_prog_skip_if_failed \
	kill -0 $$
run_prog ../attach-f-p-cmd > /dev/null

../set_ptracer_any sh -c "exec ../attach-f-p >> $EXP" > /dev/null &
tracee_pid=$!

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

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