stderr-data.sh revision 255774
1147191Sjkoshy#	$OpenBSD: stderr-data.sh,v 1.3 2013/05/17 04:29:14 dtucker Exp $
2183033Sjkoshy#	Placed in the Public Domain.
3174395Sjkoshy
4147191Sjkoshytid="stderr data transfer"
5147191Sjkoshy
6174395Sjkoshyfor n in '' -n; do
7174395Sjkoshyfor p in 1 2; do
8174395Sjkoshy	verbose "test $tid: proto $p ($n)"
9147191Sjkoshy	${SSH} $n -$p -F $OBJ/ssh_proxy otherhost \
10147191Sjkoshy		exec sh -c \'"exec > /dev/null; sleep 3; cat ${DATA} 1>&2 $s"\' \
11147191Sjkoshy		2> ${COPY}
12147191Sjkoshy	r=$?
13147191Sjkoshy	if [ $r -ne 0 ]; then
14147191Sjkoshy		fail "ssh failed with exit code $r"
15147191Sjkoshy	fi
16147191Sjkoshy	cmp ${DATA} ${COPY}	|| fail "stderr corrupt"
17147191Sjkoshy	rm -f ${COPY}
18147191Sjkoshy
19147191Sjkoshy	${SSH} $n -$p -F $OBJ/ssh_proxy otherhost \
20147191Sjkoshy		exec sh -c \'"echo a; exec > /dev/null; sleep 3; cat ${DATA} 1>&2 $s"\' \
21147191Sjkoshy		> /dev/null 2> ${COPY}
22147191Sjkoshy	r=$?
23147191Sjkoshy	if [ $r -ne 0 ]; then
24147191Sjkoshy		fail "ssh failed with exit code $r"
25147191Sjkoshy	fi
26147191Sjkoshy	cmp ${DATA} ${COPY}	|| fail "stderr corrupt"
27147191Sjkoshy	rm -f ${COPY}
28147191Sjkoshydone
29147191Sjkoshydone
30147191Sjkoshy