Remove visibility from unused widgets and menus
[pspp-builds.git] / tests / bugs / crosstabs-crash.sh
1 #!/bin/sh
2
3 # This program tests for a bug which caused CROSSTABS to crash in
4 # integer mode.
5
6 TEMPDIR=/tmp/pspp-tst-$$
7 TESTFILE=$TEMPDIR/`basename $0`.sps
8
9 # ensure that top_builddir  are absolute
10 if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
11 if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
12 top_builddir=`cd $top_builddir; pwd`
13 PSPP=$top_builddir/src/ui/terminal/pspp
14
15 # ensure that top_srcdir is absolute
16 top_srcdir=`cd $top_srcdir; pwd`
17
18 STAT_CONFIG_PATH=$top_srcdir/config
19 export STAT_CONFIG_PATH
20
21 LANG=C
22 export LANG
23
24 cleanup()
25 {
26      cd /
27      rm -rf $TEMPDIR
28 }
29
30
31 fail()
32 {
33     echo $activity
34     echo FAILED
35     cleanup;
36     exit 1;
37 }
38
39
40 no_result()
41 {
42     echo $activity
43     echo NO RESULT;
44     cleanup;
45     exit 2;
46 }
47
48 pass()
49 {
50     cleanup;
51     exit 0;
52 }
53
54 mkdir -p $TEMPDIR
55
56 cd $TEMPDIR
57
58 activity="create program"
59 cat > $TESTFILE <<EOF
60 DATA LIST LIST /A * B * X * Y * .
61 BEGIN DATA.
62 2 3 4 5
63 END DATA.
64
65 CROSSTABS VARIABLES X (1,7) Y (1,7) /TABLES X BY Y.
66 EOF
67 if [ $? -ne 0 ] ; then no_result ; fi
68
69 $SUPERVISOR $PSPP --testing-mode $TESTFILE
70 if [ $? -ne 0 ] ; then no_result ; fi
71
72
73 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
74 diff -b  -w $TEMPDIR/pspp.list - << EOF
75 1.1 DATA LIST.  Reading free-form data from INLINE.
76 +--------+------+
77 |Variable|Format|
78 #========#======#
79 |A       |F8.0  |
80 |B       |F8.0  |
81 |X       |F8.0  |
82 |Y       |F8.0  |
83 +--------+------+
84 2.1 CROSSTABS.  Summary.
85 #===============#=====================================================#
86 #               #                        Cases                        #
87 #               #-----------------+-----------------+-----------------#
88 #               #      Valid      |     Missing     |      Total      #
89 #               #--------+--------+--------+--------+--------+--------#
90 #               #       N| Percent|       N| Percent|       N| Percent#
91 #---------------#--------+--------+--------+--------+--------+--------#
92 #X * Y          #       1|  100.0%|       0|    0.0%|       1|  100.0%#
93 #===============#========#========#========#========#========#========#
94 2.2 CROSSTABS.  X by Y [count].
95 #===============#==============================================================#========#
96 #               #                               Y                              |        #
97 #               #--------+--------+--------+--------+--------+--------+--------+        #
98 #              X#    1.00|    2.00|    3.00|    4.00|    5.00|    6.00|    7.00|  Total #
99 #---------------#--------+--------+--------+--------+--------+--------+--------+--------#
100 #           1.00#      .0|      .0|      .0|      .0|      .0|      .0|      .0|      .0#
101 #           2.00#      .0|      .0|      .0|      .0|      .0|      .0|      .0|      .0#
102 #           3.00#      .0|      .0|      .0|      .0|      .0|      .0|      .0|      .0#
103 #           4.00#      .0|      .0|      .0|      .0|     1.0|      .0|      .0|     1.0#
104 #           5.00#      .0|      .0|      .0|      .0|      .0|      .0|      .0|      .0#
105 #           6.00#      .0|      .0|      .0|      .0|      .0|      .0|      .0|      .0#
106 #           7.00#      .0|      .0|      .0|      .0|      .0|      .0|      .0|      .0#
107 #Total          #     .0%|     .0%|     .0%|     .0%|    1.0%|     .0%|     .0%|    1.0%#
108 #===============#========#========#========#========#========#========#========#========#
109 EOF
110 if [ $? -ne 0 ] ; then fail ; fi
111
112 pass;