X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=tests%2Fbugs%2Foverwrite-input-file.sh;h=f1beabcca59d37aebeda13163816dba823a4fb1c;hb=5933892c21c6166b5714be979116d3aa70219c57;hp=56d569cb17dffc2478a5dafcba8ee51f419eb83c;hpb=e1fb96f07a06f3133f54702ed8706493989789fe;p=pspp diff --git a/tests/bugs/overwrite-input-file.sh b/tests/bugs/overwrite-input-file.sh index 56d569cb17..f1beabcca5 100755 --- a/tests/bugs/overwrite-input-file.sh +++ b/tests/bugs/overwrite-input-file.sh @@ -1,9 +1,8 @@ #!/bin/sh -# This program tests for a bug that caused SAVE to the file currently -# being read with GET to truncate the save file to zero length, and -# similarly for IMPORT/EXPORT. - +# This program tests that simultaneous input and output to a single +# file properly coexist, with the output atomically replacing the +# input if successful. TEMPDIR=/tmp/pspp-tst-$$ TESTFILE=$TEMPDIR/`basename $0`.sps @@ -12,7 +11,7 @@ TESTFILE=$TEMPDIR/`basename $0`.sps if [ -z "$top_builddir" ] ; then top_builddir=. ; fi if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi top_builddir=`cd $top_builddir; pwd` -PSPP=$top_builddir/src/ui/terminal/pspp +PSPP=$top_builddir/src/ui/terminal/pspp$EXEEXT # ensure that top_srcdir is absolute top_srcdir=`cd $top_srcdir; pwd` @@ -23,6 +22,10 @@ export STAT_CONFIG_PATH cleanup() { + if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then + echo "NOT cleaning $TEMPDIR" + return ; + fi cd / rm -rf $TEMPDIR } @@ -55,33 +58,35 @@ mkdir -p $TEMPDIR cd $TEMPDIR -activity="create program 1" -cat > $TESTFILE < foo.data < $TESTFILE < $TESTFILE </dev/null 2>&1 +# PSPP should have terminated with a signal. POSIX requires that the exit +# status of a process terminated by a signal be greater than 128. +if [ $? -le 128 ] ; then no_result ; fi + +activity="check for remaining temporary files" +if test -e *.tmp*; then fail; fi + +activity="compare output 1" +cmp foo.sav foo.sav.backup +if [ $? -ne 0 ] ; then fail ; fi + +activity="compare output 2" +cmp foo.por foo.por.backup +if [ $? -ne 0 ] ; then fail ; fi + +activity="compare output 3" +cmp foo.data foo.data.backup +if [ $? -ne 0 ] ; then fail ; fi activity="create program 3" cat > $TESTFILE < $TESTFILE <