Add blackbox test for provisioning code to make sure it can be run more than once...
[samba.git] / source4 / setup / tests / blackbox_provision.sh
1 #!/bin/sh
2
3 if [ $# -lt 2 ]; then
4 cat <<EOF
5 Usage: blackbox_provision.sh PREFIX CONFIGURATION
6 EOF
7 exit 1;
8 fi
9
10 PREFIX="$1"
11 CONFIGURATION="$2"
12 shift 2
13
14 testit() {
15         name="$1"
16         shift
17         cmdline="$*"
18         echo "test: $name"
19         $cmdline
20         status=$?
21         if [ x$status = x0 ]; then
22                 echo "success: $name"
23         else
24                 echo "failure: $name"
25                 failed=`expr $failed + 1`
26         fi
27         return $status
28 }
29
30 testit "simple" $PYTHON ./setup/provision.py $CONFIGURATION --domain=FOO --realm=foo.example.com --targetdir=$PREFIX/simple
31
32 reprovision() {
33         $PYTHON ./setup/provision.py $CONFIGURATION --domain=FOO --realm=foo.example.com --targetdir="$PREFIX/reprovision"
34         $PYTHON ./setup/provision.py $CONFIGURATION --domain=FOO --realm=foo.example.com --targetdir="$PREFIX/reprovision"
35 }
36
37 testit "reprovision" reprovision
38
39 exit $failed