X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=tests%2Fbugs%2Foverwrite-input-file.sh;h=8c1fecddbb666e9c9f713a2007e915e17782aa68;hb=c65c1958dfeca54c74a39c65ca676a536c08de46;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..8c1fecdd 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 @@ -55,33 +54,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 <