stderr-data.sh 705 B

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