]> diplodocus.org Git - nmh/blob - test/setup-test
Reworked test suite to copy the configuration used in the main
[nmh] / test / setup-test
1 #!/bin/sh
2 #
3 # Copy our sources and configuration, but change the installation
4 # prefix so that we can test with a completely independent
5 # installation.
6
7 # Get full pathnames that we'll need. Assumes that this script is
8 # located in the nmh test subdirectory.
9 cd `dirname $0`
10 testdir=`pwd`
11 srcdir=`dirname $testdir`
12 builddir=$testdir/testbuild
13 installdir=$testdir/testinstall
14
15 #### Set up builddir.
16 [ -d $builddir ] || mkdir -p $builddir
17 cd $builddir
18
19 #### Expedient way to copy the sources and configuration.
20 if rsync -h >/dev/null 2>&1; then
21 rsync -a $srcdir/ --exclude .git --exclude test --exclude .deps \
22 --exclude '*.gz' --exclude '*.*o' .
23 else
24 (cd $srcdir && tar cf - \
25 `find . -name .git -prune -o -name test -prune -o -name .deps -prune -o \
26 \( ! -type d ! -name '*.gz' ! -name '*.*o' -print \)`) | \
27 tar xpf -
28 fi
29
30 #### Set up new configuration.
31 #### Put it in a file so we don't have to mess with shell quoting. It
32 #### would get tricky with configure options that can contain embedded
33 #### spaces, such as --enable-masquerade and --with-smtpservers.
34 reconfig=reconfig-for-test
35 echo 'set '/bin/sh' './configure' \' > $reconfig
36 #### Configure allows multiple --prefix but ignores all but the last.
37 #### So add the one we want to use. This is easier than trying to change
38 #### an existing --prefix, esp. if it has quoted characters.
39 echo $(./config.status --config) \'--prefix="$installdir"\' >> $reconfig
40 echo 'exec "$@"' >> $reconfig
41
42 echo configuring the test installation in "$installdir" . . .
43 /bin/sh $reconfig > /dev/null
44
45 echo building the test installation . . .
46 make install > /dev/null