## -*- sh -*- ## ## memdump_test - Testing class MemDump ## ## $Id: memdump.test,v 1.2 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 memdump_test Test = 16 control characters: 0d0d 0d0d 0d0d 0d0d 0d0d 0d0d 0d0d 0d0d \r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r Dump of random-ordered alphabet: [qwertyuiopasdfghjklzxcvbnmasdfghv] 7177 6572 7479 7569 6f70 6173 6466 6768 qwertyuiopasdfgh 6a6b 6c7a 7863 7662 6e6d 6173 6466 6768 jklzxcvbnmasdfgh 76 v 60 control characters: 0d0d 0d0d 0d0d 0d0d 0d0d 0d0d 0d0d 0d0d \r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r 0d0d 0d0d 0d0d 0d0d 0d0d 0d0d 0d0d 0d0d \r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r 0d0d 0d0d 0d0d 0d0d 0d0d 0d0d 0d0d 0d0d \r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r 0d0d 0d0d 0d0d 0d0d 0d0d 0d0d \r\r\r\r\r\r\r\r\r\r\r\r 32 control characters: 0a0a 0a0a 0a0a 0a0a 0a0a 0a0a 0a0a 0a0a \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n 0a0a 0a0a 0a0a 0a0a 0a0a 0a0a 0a0a 0a0a \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n Legitimate string with 0 data length: Null Legitimate string with negative -123456789 data length: Null Test passed EOF # Unexpected output cat <<\EOF >errok EOF # You can specify command-line arguments here RUNTEST="${top_builddir}/tests/memdump_test" # 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-]*memdump_test[.ex]*:,memdump_test;," 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