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