2b90573fce03aec3e7db74d0f1bac564cf2be669
[samba.git] / source4 / setup / tests / blackbox_s3upgrade.sh
1 #!/bin/sh
2
3 if [ $# -lt 1 ]; then
4 cat <<EOF
5 Usage: blackbox_s3upgrade.sh PREFIX
6 EOF
7 exit 1;
8 fi
9
10 PREFIX=`pwd`"/$1"
11 shift 1
12
13 samba4bindir="$BINDIR"
14 samba_tool="$samba4bindir/samba-tool$EXEEXT"
15 testparm="$samba4bindir/testparm$EXEEXT"
16
17 . `dirname $0`/../../../testprogs/blackbox/subunit.sh
18
19 rm -rf $PREFIX/samba3-upgrade
20 mkdir -p $PREFIX/samba3-upgrade
21 cp -a $SRCDIR/testdata/samba3 $PREFIX/samba3-upgrade
22
23 # Test 1 (s3 member)
24 cat - > $PREFIX/samba3-upgrade/samba3/smb1.conf <<EOF
25 [global]
26    workgroup = SAMBA
27    security = user
28    netbiosname = S3UPGRADE
29    passdb backend = tdbsam:$PREFIX/samba3-upgrade/samba3/passdb.tdb
30    private dir = $PREFIX/samba3-upgrade/samba3
31    lock directory = $PREFIX/samba3-upgrade/samba3
32    state directory = $PREFIX/samba3-upgrade/samba3
33    cache directory = $PREFIX/samba3-upgrade/samba3
34    pid directory = $PREFIX/samba3-upgrade/samba3
35    usershare path = $PREFIX/samba3-upgrade/samba3
36    ncalrpc dir = $PREFIX/samba3-upgrade/samba3
37
38    debug level = 0
39 EOF
40
41 testit "samba3-upgrade-member" $samba_tool domain samba3upgrade $PREFIX/samba3-upgrade/samba3/smb1.conf --targetdir=$PREFIX/samba3-upgrade/s4_1 --libdir=$PREFIX/samba3-upgrade/samba3
42
43 # Test 2 (s3 dc)
44 cat - > $PREFIX/samba3-upgrade/samba3/smb2.conf <<EOF
45 [global]
46    workgroup = SAMBA
47    netbiosname = S3UPGRADE
48    security = user
49    realm = s3.samba.example.com
50    passdb backend = tdbsam:$PREFIX/samba3-upgrade/samba3/passdb.tdb
51    private dir = $PREFIX/samba3-upgrade/samba3
52    lock directory = $PREFIX/samba3-upgrade/samba3
53    state directory = $PREFIX/samba3-upgrade/samba3
54    cache directory = $PREFIX/samba3-upgrade/samba3
55    pid directory = $PREFIX/samba3-upgrade/samba3
56    usershare path = $PREFIX/samba3-upgrade/samba3
57    ncalrpc dir = $PREFIX/samba3-upgrade/samba3
58    debug level = 0
59    domain logons = yes
60 EOF
61
62 testit "samba3-upgrade-dc" $samba_tool domain samba3upgrade $PREFIX/samba3-upgrade/samba3/smb2.conf --targetdir=$PREFIX/samba3-upgrade/s4_2 --libdir=$PREFIX/samba3-upgrade/samba3
63
64 #Run final test without a wins.dat
65 rm -f $PREFIX/samba3-upgrade/samba3/wins.dat
66
67 # Test 3 (s3 dc using testparm hook)
68 cat - > $PREFIX/samba3-upgrade/samba3/smb3.conf <<EOF
69 [global]
70    workgroup = SAMBA
71    netbiosname = S3UPGRADE
72    security = user
73    realm = s3.samba.example.com
74    passdb backend = tdbsam:$PREFIX/samba3-upgrade/samba3/passdb.tdb
75    private dir = $PREFIX/samba3-upgrade/samba3
76    lock directory = $PREFIX/samba3-upgrade/samba3
77    state directory = $PREFIX/samba3-upgrade/samba3
78    cache directory = $PREFIX/samba3-upgrade/samba3
79    pid directory = $PREFIX/samba3-upgrade/samba3
80    usershare path = $PREFIX/samba3-upgrade/samba3
81    ncalrpc dir = $PREFIX/samba3-upgrade/samba3
82    debug level = 0
83    domain logons = yes
84 EOF
85
86 testit "samba3-upgrade-testparm" $samba_tool domain samba3upgrade $PREFIX/samba3-upgrade/samba3/smb2.conf --targetdir=$PREFIX/samba3-upgrade/s4_3 --testparm=$testparm
87
88 rm -rf $PREFIX/samba3-upgrade
89
90 exit $failed