127d77aa1d90aa4094b522c046fbe6bc9ce40bad
[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 export STAT_CONFIG_PATH=$top_srcdir/config
14
15
16 cleanup()
17 {
18      rm -rf $TEMPDIR
19 }
20
21
22 fail()
23 {
24     echo $activity
25     echo FAILED
26     cleanup;
27     exit 1;
28 }
29
30
31 no_result()
32 {
33     echo $activity
34     echo NO RESULT;
35     cleanup;
36     exit 2;
37 }
38
39 pass()
40 {
41     cleanup;
42     exit 0;
43 }
44
45 mkdir -p $TEMPDIR
46
47 cd $TEMPDIR
48
49 activity="create program"
50 cat > $TEMPDIR/filter.stat << EOF
51 data list notable /X 1-2.
52 begin data.
53 1
54 2
55 3
56 4
57 5
58 6
59 7
60 8
61 9
62 10
63 end data.
64 use all.
65 list.
66
67 EOF
68 if [ $? -ne 0 ] ; then no_result ; fi
69
70
71 activity="run program"
72 $SUPERVISOR $here/../src/pspp --testing-mode -o raw-ascii $TEMPDIR/filter.stat
73 if [ $? -ne 0 ] ; then no_result ; fi
74
75
76 activity="check results"
77 diff -B -b $TEMPDIR/pspp.list - << EOF
78  X
79 --
80  1
81  2
82  3
83  4
84  5
85  6
86  7
87  8
88  9
89 10
90 EOF
91 if [ $? -ne 0 ] ; then fail ; fi
92
93 pass;