7874ea3f06a4cd65cbe5fb3681321bf274212b56
[pspp-builds.git] / tests / command / use.sh
1 #!/bin/sh
2
3 # This program tests USE, just to make sure that USE ALL is accepted silently.
4
5 TEMPDIR=/tmp/pspp-tst-$$
6 TESTFILE=$TEMPDIR/`basename $0`.sps
7
8 here=`pwd`;
9
10 # ensure that top_srcdir is absolute
11 cd $top_srcdir; top_srcdir=`pwd`
12
13 STAT_CONFIG_PATH=$top_srcdir/config
14 export STAT_CONFIG_PATH
15
16
17 cleanup()
18 {
19      cd /
20      rm -rf $TEMPDIR
21 }
22
23
24 fail()
25 {
26     echo $activity
27     echo FAILED
28     cleanup;
29     exit 1;
30 }
31
32
33 no_result()
34 {
35     echo $activity
36     echo NO RESULT;
37     cleanup;
38     exit 2;
39 }
40
41 pass()
42 {
43     cleanup;
44     exit 0;
45 }
46
47 mkdir -p $TEMPDIR
48
49 cd $TEMPDIR
50
51 activity="create program"
52 cat > $TEMPDIR/filter.stat << EOF
53 data list notable /X 1-2.
54 begin data.
55 1
56 2
57 3
58 4
59 5
60 6
61 7
62 8
63 9
64 10
65 end data.
66 use all.
67 list.
68
69 EOF
70 if [ $? -ne 0 ] ; then no_result ; fi
71
72
73 activity="run program"
74 $SUPERVISOR $here/../src/pspp --testing-mode -o raw-ascii $TEMPDIR/filter.stat
75 if [ $? -ne 0 ] ; then no_result ; fi
76
77
78 activity="check results"
79 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
80 diff  -b $TEMPDIR/pspp.list - << EOF
81  X
82 --
83  1
84  2
85  3
86  4
87  5
88  6
89  7
90  8
91  9
92 10
93 EOF
94 if [ $? -ne 0 ] ; then fail ; fi
95
96 pass;