Tests for zsh, ksh and ash.
[autodist.git] / apps / autodist / tests / autodist5.test
1 #!/bin/sh
2
3 AUTODIST=../autodist
4
5 rm -f ./autodist
6
7 echo "Testing with /bin/ash"
8
9 # Change shell to ash
10 if test '!' -f /bin/ash; then
11   echo "/bin/zsh does not exist, cannot run test"
12   exit 0
13 fi
14 cat $AUTODIST | sed 's/#!\/bin\/sh/#!\/bin\/ash/' > ./autodist
15
16 AUTODIST=../autodist    # from inside tests/test
17
18 rm -rf test
19 mkdir test
20
21 cd test || exit 1
22
23 chmod +x $AUTODIST || exit 1
24
25 cat << EOF > configure.ad
26 AD_INIT
27 #ifdef _DIST_TEST
28 AC_CANONICAL_BUILD
29 AM_INIT_AUTOMAKE
30 AC_PREREQ(2.52)
31 AC_CONFIG_HEADERS(config.h)
32 AD_INCLUDE_CONFIGURE
33 AC_CONFIG_FILES(
34 Makefile
35 )
36 AC_OUTPUT
37 echo configure.ad ok
38 #endif _DIST_TEST
39 EOF
40
41 cat << EOF > Makefile.ad
42 SUBDIRS=        \\
43 #ifndef _DIST_TEST
44         nodef   \\
45 #endif _DIST_TEST
46         .       \\
47
48 EOF
49
50 rm -rf distdir subdir
51 mkdir -p subdir || exit 1
52
53 cat << EOF > subdir/configure.ad
54 # subdir/configure.ad fragment
55 #ifndef _DIST_NODEF
56 #ifdef _DIST_TEST
57 echo "_DIST_NODEF ok"
58 #endif _DIST_TEST
59 #endif _DIST_NODEF
60 EOF
61
62 $AUTODIST -i || exit 1
63 if test '!' -d distdir; then
64   echo "error: distdir/ does no exist"
65   exit 1
66 fi 
67
68 cp -p ../../default distdir || exit 1
69 cp -p ../../autodist.conf distdir || exit 1
70
71 cat << EOF > distdir/test
72 name Test Distribution
73 package test-distro
74 bug-report test-dist@test.org
75 define _DIST_TEST
76 EOF
77
78 touch README NEWS AUTHORS ChangeLog
79
80 echo "inherit test" >> distdir/default
81
82 $AUTODIST || exit 1
83 $AUTODIST test 1.0 || exit 1
84
85 ./configure || exit 1
86 make || exit 1
87 echo make ok
88
89 $AUTODIST -m || exit 1
90
91 if test '!' -f test-distro-1.0.tar.gz; then
92   echo "error: makedist failed"
93   exit 1
94 fi
95
96 echo test ok
97
98 # Cleanup
99 rm -rf subdir distdir $AUTODIST
100