HOST: Use more modern syntax.
[pspp] / tests / bugs / signals.sh
index a08aa9a574a73ee01b4f8d651d29a8ace49c2ea0..20ca0700947e96a3201520ba2eda95e58f9374cf 100755 (executable)
@@ -11,7 +11,7 @@ if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
 top_srcdir=`cd $top_srcdir; pwd`
 top_builddir=`cd $top_builddir; pwd`
 
-PSPP=$top_builddir/src/ui/terminal/pspp
+PSPP=$top_builddir/src/ui/terminal/pspp$EXEEXT
 
 STAT_CONFIG_PATH=$top_srcdir/config
 export STAT_CONFIG_PATH
@@ -26,10 +26,8 @@ cleanup()
        echo "NOT cleaning $TEMPDIR"
        return ; 
      fi
+     cd /
      rm -rf $TEMPDIR
-
-     # Kill any remaining children of this shell
-     kill `ps h --ppid $$ | awk '{print $1}'` 2> /dev/null
 }
 
 
@@ -60,41 +58,20 @@ mkdir -p $TEMPDIR
 
 cd $TEMPDIR
 
-
-activity="run program in interactive mode"
-cat | $PSPP --testing-mode -o raw-ascii 2> $TEMPDIR/stderr1  > /dev/null & 
-thepid1=$!
-if [ $? -ne 0 ] ; then no_result ; fi
-
-activity="run program in interactive mode 2"
-cat | $PSPP --testing-mode -o raw-ascii 2> $TEMPDIR/stderr2  > /dev/null & 
-thepid2=$!
-if [ $? -ne 0 ] ; then no_result ; fi
-
-# This one is a dummy.  Despite the sleep command,  it may not be enought 
-# to ensure that the preceeding pspp has actually initialised itself.
-activity="run program in interactive mode 3"
-cat | $PSPP --testing-mode -o raw-ascii 2> /dev/null  > /dev/null & sleep 1
-thepid3=$!
-if [ $? -ne 0 ] ; then no_result ; fi
-
-activity="sending SIGINT to pspp1"
-kill -INT $thepid1
-if [ $? -ne 0 ] ; then no_result ; fi
-
-activity="sending SIGSEGV to pspp2"
-kill -SEGV $thepid2
+activity="sending SIGINT to pspp"
+echo 'host command=["kill -INT $PPID"].' | $PSPP -o pspp.csv > /dev/null 2> $TEMPDIR/stderr1
 if [ $? -ne 0 ] ; then no_result ; fi
 
-
 # SIGINT should have caused a clean shutdown
-
 activity="checking for absence of error messages 1"
 [ ! -s $TEMPDIR/stderr1 ]  
 if [ $? -ne 0 ] ; then fail ; fi
 
-# SIGSEGV should have caused an error message
+activity="sending SIGSEGV to pspp"
+echo 'host command=["kill -SEGV $PPID"].' | $PSPP -o pspp.csv > /dev/null 2> $TEMPDIR/stderr2
+if [ $? -eq 0 ] ; then no_result ; fi
 
+# SIGSEGV should have caused an error message
 activity="checking for error messages from pspp 2"
 head -8 $TEMPDIR/stderr2 > $TEMPDIR/stderr-head
 if [ $? -ne 0 ] ; then no_result ; fi