## -*- sh -*- ## ## echoxdr.test - Testing XDR encoding/decoding with Socket class ## ## $Id: echoxdr.test,v 1.3 2005/01/07 02:28:57 vlg Exp $ # Common definitions if test -z "$srcdir" ; then srcdir=`echo "$0" | sed 's,[^/]*$,,'` test "$srcdir" = "$0" && srdir=. test -z "$srcdir" && srcdir=. test "${VERBOSE+set}" != set && VERBOSE=1 fi . $srcdir/defs # this is the output we should expect to see cat <<\EOF >ok = Running echoxdr Test = >>> Testing ability to read input from daytime ... ok >>> Testing char c = "G" ... ok >>> Testing string = "ASSA is a pretty cool library" ... ok >>> Testing short sh = 120 ... ok >>> Testing int i=-210 ... ok >>> Testing u_int ui=32 ... ok >>> Testing long l=-2147483647 ... ok >>> Testing u_long ul=2147483646 ... ok >>> Testing float f=123.433 ... ok >>> Testing double d=-1.23457e+08 ... ok Test passed EOF # Unexpected output cat <<\EOF >errok EOF # You can specify command-line arguments here RUNTEST="${top_builddir}/tests/echoxdr_testc --build-dir=${top_builddir}/tests" # Run test $RUNTEST 2> err | tee -i out >&2 # Test against expected output if ${CMP} -s out ok; then : else echo "ok:" >&2 cat ok >&2 exit 1 fi # Mungle error output to remove leading directories, 'lt-' or # trailing '.exe' sed -e "s,^[^:]*[lt-]*echoxdr_testc[.ex]*:,echoxdr_testc;," err >sederr && mv sederr err # Show stderr if doesn't match expected output if VERBOSE=1 if "$CMP" -s err errok; then : else echo "err:" >&2 cat err >&2 echo "errok:" >&2 cat errok >&2 exit 1 fi