Fix CFLAGS/LDFLAGS syntax
[platform/upstream/lrzsz.git] / fastcheck.sh
1 #! /bin/sh
2
3 srcdir="$1"
4 if test $srcdir = . ; then
5         srcdir=`pwd`
6 fi
7 if test $srcdir = .. ; then
8         srcdir=`pwd`/..
9 fi
10 objdir="$2"
11 if test $objdir = . ; then
12         objdir=`pwd`
13 fi
14 testdir=$objdir/fastcheck.lrzsz
15
16 SZ="$objdir/src/lsz"
17 RZ="$objdir/src/lrz"
18
19 echo checking with srcdir = $1 and objdir = $2
20
21 z_test_files=""
22 for i in $srcdir/src/l?z.c ; do
23         z_test_files="$z_test_files $i" 
24 done
25 for i in $objdir/src/l?z ; do
26         z_test_files="$z_test_files $i" 
27 done
28
29 # change to tmp dir
30 if test "x$TMPDIR" = x ; then
31         if test "x$TMP" = x ; then
32                 cd /tmp
33         else
34                 cd $TMP || cd /tmp
35         fi
36 else
37         cd $TMPDIR || cd /tmp
38 fi
39
40 rm -rf $testdir
41 mkdir $testdir
42 exec 5>$testdir/error.log
43 (mkfifo $testdir/pipe || mknod $testdir/pipe p) 2>&5
44
45 mkdir $testdir/zmodem
46 failed=0
47 ($SZ -q $z_test_files ) <$testdir/pipe | \
48         (cd $testdir/zmodem ; exec $RZ $QUIET >>../pipe )
49 for i in $z_test_files ; do 
50         bn=`basename $i`
51         cmp $i $testdir/zmodem/$bn
52         if test $? -eq 0 ; then
53                 rm -f $testdir/zmodem/$bn
54         else
55                 failed=1
56         fi
57 done
58 rm -rf $testdir
59
60 if test "x$failed" = x0  ; then
61         :
62 else
63         echo "the test failed." >&2
64         echo "use 'make check' or 'make vcheck' for a more detailed test" >&2
65         touch $objdir/fastcheck.failed
66         exit 1
67 fi
68
69
70 touch $objdir/fastcheck.ok
71 exit 0
72