Fix bug #18739.
[pspp] / tests / bugs / double-frequency.sh
1 #!/bin/sh
2
3 # This program tests for a bug where pspp would crash if two frequencies
4 # Commands existed in a input file
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
19 STAT_CONFIG_PATH=$top_srcdir/config
20 export STAT_CONFIG_PATH
21
22
23 cleanup()
24 {
25      cd /
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
56 activity="create data"
57 cat << EOF > $TEMPDIR/ff.stat 
58
59 data list free /v1 v2.
60 begin data.
61 0 1
62 2 3 
63 4 5
64 3 4
65 end data.
66
67 frequencies v1 v2.
68 frequencies v1 v2.
69 EOF
70 if [ $? -ne 0 ] ; then no_result ; fi
71
72
73 cd $TEMPDIR
74
75 activity="run data"
76 $SUPERVISOR $PSPP  $TEMPDIR/ff.stat
77 if [ $? -ne 0 ] ; then fail ; fi
78
79
80 pass;