stderr-data.sh revision 180718
1283625Sdim#	$OpenBSD: stderr-data.sh,v 1.2 2002/03/27 22:39:52 markus Exp $
2283625Sdim#	Placed in the Public Domain.
3283625Sdim
4283625Sdimtid="stderr data transfer"
5283625Sdim
6283625SdimDATA=/bin/ls${EXEEXT}
7283625SdimCOPY=${OBJ}/copy
8283625Sdimrm -f ${COPY}
9283625Sdim
10283625Sdimfor n in '' -n; do
11283625Sdimfor p in 1 2; do
12283625Sdim	verbose "test $tid: proto $p ($n)"
13283625Sdim	${SSH} $n -$p -F $OBJ/ssh_proxy otherhost \
14283625Sdim		exec sh -c \'"exec > /dev/null; sleep 3; cat ${DATA} 1>&2 $s"\' \
15283625Sdim		2> ${COPY}
16283625Sdim	r=$?
17283625Sdim	if [ $r -ne 0 ]; then
18286684Sdim		fail "ssh failed with exit code $r"
19283625Sdim	fi
20283625Sdim	cmp ${DATA} ${COPY}	|| fail "stderr corrupt"
21283625Sdim	rm -f ${COPY}
22283625Sdim
23283625Sdim	${SSH} $n -$p -F $OBJ/ssh_proxy otherhost \
24283625Sdim		exec sh -c \'"echo a; exec > /dev/null; sleep 3; cat ${DATA} 1>&2 $s"\' \
25283625Sdim		> /dev/null 2> ${COPY}
26283625Sdim	r=$?
27283625Sdim	if [ $r -ne 0 ]; then
28283625Sdim		fail "ssh failed with exit code $r"
29283625Sdim	fi
30283625Sdim	cmp ${DATA} ${COPY}	|| fail "stderr corrupt"
31283625Sdim	rm -f ${COPY}
32283625Sdimdone
33283625Sdimdone
34283625Sdim