From: David Levine Date: Fri, 23 May 2014 22:07:39 +0000 (-0500) Subject: Fixed test-mkstemp to work with valgrind. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/f8d3c4d16b4a2cf0034dc1159c0c68dc78fd0921?ds=inline;hp=-c Fixed test-mkstemp to work with valgrind. --- f8d3c4d16b4a2cf0034dc1159c0c68dc78fd0921 diff --git a/test/mkstemp/test-mkstemp b/test/mkstemp/test-mkstemp index 992a5864..e5a91b57 100755 --- a/test/mkstemp/test-mkstemp +++ b/test/mkstemp/test-mkstemp @@ -72,23 +72,26 @@ fi # check -directory tmpfile=`$mkstemp -directory "$MHTMPDIR"` [ -f "$tmpfile" ] && rm "$tmpfile" || failed=`expr ${failed:-0} + 1` +# Rely on exit status of grep to detect failure and terminate due to set -e: check_tmpfile=`echo $tmpfile | grep "^$MHTMPDIR/......$" >/dev/null` -run_test `echo $check_tmpfile` '' +run_test 'eval echo $check_tmpfile' '' # check -prefix tmpfile=`$mkstemp -prefix mkstemptest` [ -f "$tmpfile" ] && rm "$tmpfile" || failed=`expr ${failed:-0} + 1` +# Rely on exit status of grep to detect failure and terminate due to set -e: check_tmpfile=`echo $tmpfile | grep '^mkstemptest......$' >/dev/null` -run_test `echo $check_tmpfile` '' +run_test 'eval echo $check_tmpfile' '' if [ $has_mkstemps -eq 1 ]; then # check -suffix tmpfile=`$mkstemp -suffix .txt` [ -f "$tmpfile" ] && rm "$tmpfile" || failed=`expr ${failed:-0} + 1` + # Rely on exit status of grep to detect failure and terminate due to set -e: check_tmpfile=`echo $tmpfile | grep '^......\.txt$' >/dev/null` - run_test `echo $check_tmpfile` '' + run_test 'eval echo $check_tmpfile' '' fi