X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=tests%2Fbugs%2Foverwrite-input-file.sh;h=d9f3e59cb5ce81d0ad33c56ba807be4e3117b5b5;hb=71cc988f2ad781457fd5d43f284990825fcd9a8d;hp=56d569cb17dffc2478a5dafcba8ee51f419eb83c;hpb=e1fb96f07a06f3133f54702ed8706493989789fe;p=pspp-builds.git diff --git a/tests/bugs/overwrite-input-file.sh b/tests/bugs/overwrite-input-file.sh index 56d569cb..d9f3e59c 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 @@ -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 <