Plugged memory leaks in GUI, and converted most of the strings to UTF8, so that
[pspp-builds.git] / tests / bugs / print-crash.sh
1 #!/bin/sh
2
3 # This program tests for a bug which crashed when deallocating after a bad 
4 # PRINT command.
5
6 TEMPDIR=/tmp/pspp-tst-$$
7 TESTFILE=$TEMPDIR/`basename $0`.sps
8
9 # ensure that top_srcdir and top_builddir  are absolute
10 if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
11 if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
12 top_srcdir=`cd $top_srcdir; pwd`
13 top_builddir=`cd $top_builddir; pwd`
14
15 PSPP=$top_builddir/src/ui/terminal/pspp
16
17 export STAT_CONFIG_PATH=$top_srcdir/config
18
19
20 cleanup()
21 {
22      if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then 
23         echo "NOT cleaning $TEMPDIR"
24         return ; 
25      fi
26      rm -rf $TEMPDIR
27 }
28
29
30 fail()
31 {
32     echo $activity
33     echo FAILED
34     cleanup;
35     exit 1;
36 }
37
38
39 no_result()
40 {
41     echo $activity
42     echo NO RESULT;
43     cleanup;
44     exit 2;
45 }
46
47 pass()
48 {
49     cleanup;
50     exit 0;
51 }
52
53 mkdir -p $TEMPDIR
54
55 cd $TEMPDIR
56
57 cat > $TESTFILE << EOF
58 DATA LIST LIST /a * b *.
59 BEGIN DATA.
60 1 2
61 3 4
62 END DATA.
63
64 PRINT F8.2
65 LIST.
66 EOF
67 if [ $? -ne 0 ] ; then no_result ; fi
68
69
70 activity="run program"
71 $SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE > /dev/null
72 if [ $? -ne 1 ] ; then fail ; fi
73
74
75 pass;