921be02c71784a869a4bedd27c0581a29d4e15d0
[pspp-builds.git] / tests / bugs / recode-copy-bug.sh
1 #!/bin/sh
2
3 # This program tests ....
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 activity="copy template 1" 
50 cp $top_srcdir/tests/bugs/recode-copy-bug-1.stat $TEMPDIR
51 if [ $? -ne 0 ] ; then no_result ; fi
52
53 activity="copy template 2" 
54 cp $top_srcdir/tests/bugs/recode-copy-bug-2.stat $TEMPDIR
55 if [ $? -ne 0 ] ; then no_result ; fi
56
57 activity="chdir"
58 cd $TEMPDIR
59 if [ $? -ne 0 ] ; then no_result ; fi
60
61
62 activity="run program 1"
63 $SUPERVISOR $here/../src/pspp -o raw-ascii $TEMPDIR/recode-copy-bug-1.stat
64 if [ $? -ne 0 ] ; then no_result ; fi
65
66
67 activity="compare output 1"
68 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list $top_srcdir/tests/bugs/recode-copy-bug-1.out
69 diff -b -w $TEMPDIR/pspp.list $top_srcdir/tests/bugs/recode-copy-bug-1.out
70 if [ $? -ne 0 ] ; then fail ; fi
71
72
73 activity="run program 2"
74 $SUPERVISOR $here/../src/pspp -o raw-ascii $TEMPDIR/recode-copy-bug-2.stat
75 if [ $? -ne 0 ] ; then no_result ; fi
76
77
78 activity="compare output 2"
79 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list $top_srcdir/tests/bugs/recode-copy-bug-2.out
80 diff -b -w $TEMPDIR/pspp.list $top_srcdir/tests/bugs/recode-copy-bug-2.out
81 if [ $? -ne 0 ] ; then fail ; fi
82
83 pass;