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