pspp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: new failing test


From: Ben Pfaff
Subject: Re: new failing test
Date: Tue, 21 Nov 2006 22:17:02 -0800
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

John Darrington <address@hidden> writes:

> This test is supposed to check that signal 11 is caught, and 
> the error message is seen.
>
> If you've compiled with DEBUGGING defined, then it'll probably 
> fail.  Otherwise, I'm not sure why it might be failing for you.

Investigation shows that the problem is that there's not enough
time between sending the signals and checking for the output.
Inserting "sleep 1" after the kill commands fixes it.

There are several things that bother me about this test:

        * What is the third execution of PSPP there for?  We
          don't send it a signal or check its output.

        * The "ps" utility is not very portable.  The --ppid
          option is not in SUSv3.  The "h" option is not either.
          "kill %1 %2 %3" might be portable, but I don't really
          know.

        * Depending on timing is just a hack in any case.

Here's my proposal for a fix:

--- signals.sh.~1.1.~   2006-11-14 04:29:26.000000000 -0800
+++ signals.sh  2006-11-21 22:14:44.000000000 -0800
@@ -27,9 +27,6 @@ cleanup()
        return ; 
      fi
      rm -rf $TEMPDIR
-
-     # Kill any remaining children of this shell
-     kill `ps h --ppid $$ | awk '{print $1}'` 2> /dev/null
 }
 
 
@@ -60,41 +57,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 kill -INT $PPID' | $PSPP --testing-mode -o raw-ascii > /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 kill -SEGV $PPID' | $PSPP --testing-mode -o raw-ascii > /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

It requires a fix to the HOST command's implementation:

--- command.def.~1.9.~  2006-10-29 12:24:11.000000000 -0800
+++ command.def 2006-11-21 22:09:55.000000000 -0800
@@ -26,7 +26,7 @@ DEF_CMD (S_ANY, 0, "EXIT", cmd_finish)
 DEF_CMD (S_ANY, 0, "FILE HANDLE", cmd_file_handle)
 DEF_CMD (S_ANY, F_KEEP_FINAL_TOKEN, "FILE LABEL", cmd_file_label)
 DEF_CMD (S_ANY, 0, "FINISH", cmd_finish)
-DEF_CMD (S_ANY, 0, "HOST", cmd_host)
+DEF_CMD (S_ANY, F_KEEP_FINAL_TOKEN, "HOST", cmd_host)
 DEF_CMD (S_ANY, 0, "INCLUDE", cmd_include)
 DEF_CMD (S_ANY, 0, "N OF CASES", cmd_n_of_cases)
 DEF_CMD (S_ANY, F_ABBREV, "N", cmd_n_of_cases)

-- 
"The road to hell is paved with convenient shortcuts."
--Peter da Silva




reply via email to

[Prev in Thread] Current Thread [Next in Thread]