xref: /freebsd/crypto/openssh/regress/stderr-data.sh (revision b0d29bc47dba79f6f38e67eabadfb4b32ffd9390)
1#	$OpenBSD: stderr-data.sh,v 1.5 2017/04/30 23:34:55 djm Exp $
2#	Placed in the Public Domain.
3
4tid="stderr data transfer"
5
6for n in '' -n; do
7	verbose "test $tid: ($n)"
8	${SSH} $n -F $OBJ/ssh_proxy otherhost exec \
9	    sh -c \'"exec > /dev/null; sleep 3; cat ${DATA} 1>&2 $s"\' \
10		2> ${COPY}
11	r=$?
12	if [ $r -ne 0 ]; then
13		fail "ssh failed with exit code $r"
14	fi
15	cmp ${DATA} ${COPY}	|| fail "stderr corrupt"
16	rm -f ${COPY}
17
18	${SSH} $n -F $OBJ/ssh_proxy otherhost exec \
19	    sh -c \'"echo a; exec > /dev/null; sleep 3; cat ${DATA} 1>&2 $s"\' \
20		> /dev/null 2> ${COPY}
21	r=$?
22	if [ $r -ne 0 ]; then
23		fail "ssh failed with exit code $r"
24	fi
25	cmp ${DATA} ${COPY}	|| fail "stderr corrupt"
26	rm -f ${COPY}
27done
28