Use 'dn' less, as this is not a valid attribute in AD, and I want to
[samba.git] / source4 / selftest / samba4_tests.sh
1 #!/bin/sh
2 # This script generates a list of testsuites that should be run as part of 
3 # the Samba 4 test suite.
4
5 # The output of this script is parsed by selftest.pl, which then decides 
6 # which of the tests to actually run. It will, for example, skip all tests 
7 # listed in samba4-skip or only run a subset during "make quicktest".
8
9 # The idea is that this script outputs all of the tests of Samba 4, not 
10 # just those that are known to pass, and list those that should be skipped 
11 # or are known to file in samba4-skip/samba4-knownfail. This makes it 
12 # very easy to see what functionality is still missing in Samba 4 and makes 
13 # it possible to run the testsuite against other servers, such as Samba 3 or 
14 # Windows that have a different set of features.
15
16 # The syntax for a testsuite is "-- TEST --" on a single line, followed 
17 # by the name of the test, the environment it needs and the command to run, all 
18 # three separated by newlines. All other lines in the output are considered 
19 # comments.
20
21 if [ ! -n "$PERL" ]
22 then
23         PERL=perl
24 fi
25
26 incdir=`dirname $0`
27
28 plantest() {
29         name=$1
30         env=$2
31         shift 2
32         cmdline="$*"
33         echo "-- TEST --"
34         if [ "$env" = "none" ]; then
35                 echo "samba4.$name"
36         else
37                 echo "samba4.$name ($env)"
38         fi
39         echo $env
40         echo $cmdline
41 }
42
43 $incdir/../bin/smbtorture -V
44
45 samba4srcdir=$incdir/..
46 samba4bindir=$samba4srcdir/bin
47 SCRIPTDIR=$samba4srcdir/../testprogs/ejs
48 smb4torture="$samba4bindir/smbtorture $TORTURE_OPTIONS"
49
50 plantest "js.base" dc "$SCRIPTDIR/base.js" $CONFIGURATION
51 plantest "js.samr" dc "$SCRIPTDIR/samr.js" $CONFIGURATION ncalrpc: -U\$USERNAME%\$PASSWORD
52 plantest "js.echo" dc "$SCRIPTDIR/echo.js" $CONFIGURATION ncalrpc: -U\$USERNAME%\$PASSWORD
53 #plantest "ejsnet.js" dc "$SCRIPTDIR/ejsnet.js" $CONFIGURATION -U\$USERNAME%\$PASSWORD \$DOMAIN ejstestuser
54 plantest "js.ldb" none "$SCRIPTDIR/ldb.js" `pwd` $CONFIGURATION -d 10
55 plantest "js.winreg" dc $samba4srcdir/scripting/bin/winreg $CONFIGURATION ncalrpc: 'HKLM' -U\$USERNAME%\$PASSWORD
56
57 # Simple tests for LDAP and CLDAP
58
59 for options in "" "--option=socket:testnonblock=true" "-U\$USERNAME%\$PASSWORD --option=socket:testnonblock=true" "-U\$USERNAME%\$PASSWORD"; do
60     plantest "ldb.ldap with options $options" dc $samba4srcdir/../testprogs/blackbox/test_ldb.sh ldap \$SERVER_IP $options
61 done
62 # see if we support ldaps
63 if grep ENABLE_GNUTLS.1 include/config.h > /dev/null; then
64     for options in "" "-U\$USERNAME%\$PASSWORD"; do
65         plantest "ldb.ldaps with options $options" dc $samba4srcdir/../testprogs/blackbox/test_ldb.sh ldaps \$SERVER_IP $options
66     done
67 fi
68 for t in LDAP-CLDAP LDAP-BASIC LDAP-SCHEMA LDAP-UPTODATEVECTOR
69 do
70         plantest "$t" dc $smb4torture "-U\$USERNAME%\$PASSWORD" //\$SERVER_IP/_none_ $t
71 done
72
73 # only do the ldb tests when not in quick mode - they are quite slow, and ldb
74 # is now pretty well tested by the rest of the quick tests anyway
75 LDBDIR=$samba4srcdir/lib/ldb
76 export LDBDIR
77 plantest "ldb" none $LDBDIR/tests/test-tdb.sh
78
79 plantest "js.ldap" dc $SCRIPTDIR/ldap.js $CONFIGURATION -d 10 \$SERVER -U\$USERNAME%\$PASSWORD
80
81 # Tests for RPC
82
83 # add tests to this list as they start passing, so we test
84 # that they stay passing
85 ncacn_np_tests="RPC-SCHANNEL RPC-JOIN RPC-LSA RPC-DSSETUP RPC-ALTERCONTEXT RPC-MULTIBIND RPC-NETLOGON RPC-HANDLES RPC-SAMSYNC RPC-SAMBA3SESSIONKEY RPC-SAMBA3-GETUSERNAME RPC-SAMBA3-LSA RPC-BINDSAMBA3 RPC-NETLOGSAMBA3 RPC-ASYNCBIND RPC-LSALOOKUP RPC-LSA-GETUSER RPC-SCHANNEL2 RPC-AUTHCONTEXT"
86 ncalrpc_tests="RPC-SCHANNEL RPC-JOIN RPC-LSA RPC-DSSETUP RPC-ALTERCONTEXT RPC-MULTIBIND RPC-NETLOGON RPC-DRSUAPI RPC-ASYNCBIND RPC-LSALOOKUP RPC-LSA-GETUSER RPC-SCHANNEL2 RPC-AUTHCONTEXT"
87 ncacn_ip_tcp_tests="RPC-SCHANNEL RPC-JOIN RPC-LSA RPC-DSSETUP RPC-ALTERCONTEXT RPC-MULTIBIND RPC-NETLOGON RPC-HANDLES RPC-DSSYNC RPC-ASYNCBIND RPC-LSALOOKUP RPC-LSA-GETUSER RPC-SCHANNEL2 RPC-AUTHCONTEXT"
88 slow_ncacn_np_tests="RPC-SAMLOGON RPC-SAMR RPC-SAMR-USERS RPC-SAMR-PASSWORDS"
89 slow_ncalrpc_tests="RPC-SAMR RPC-SAMR-PASSWORDS"
90 slow_ncacn_ip_tcp_tests="RPC-SAMR RPC-SAMR-PASSWORDS RPC-CRACKNAMES"
91
92 all_tests="$ncalrpc_tests $ncacn_np_tests $ncacn_ip_tcp_tests $slow_ncalrpc_tests $slow_ncacn_np_tests $slow_ncacn_ip_tcp_tests RPC-SECRETS RPC-SAMBA3-SHARESEC"
93
94 # Make sure all tests get run
95 for t in `$smb4torture --list | grep "^RPC-"`
96 do
97         echo $all_tests | grep $t  > /dev/null
98         if [ $? -ne 0 ]
99         then
100                 auto_rpc_tests="$auto_rpc_tests $t"
101         fi
102 done
103
104 for bindoptions in seal,padcheck $VALIDATE bigendian; do
105  for transport in ncalrpc ncacn_np ncacn_ip_tcp; do
106      case $transport in
107          ncalrpc) tests=$ncalrpc_tests ;;
108          ncacn_np) tests=$ncacn_np_tests ;;
109          ncacn_ip_tcp) tests=$ncacn_ip_tcp_tests ;;
110      esac
111    for t in $tests; do
112     plantest "$t on $transport with $bindoptions" dc $VALGRIND $smb4torture $transport:"\$SERVER[$bindoptions]" -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN $t "$*"
113    done
114    plantest "RPC-SAMBA3-SHARESEC on $transport with $bindoptions" dc $VALGRIND $smb4torture $transport:"\$SERVER[$bindoptions]" -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN --option=torture:share=tmp $t "$*"
115  done
116 done
117
118 for bindoptions in "" $VALIDATE bigendian; do
119  for t in $auto_rpc_tests; do
120   plantest "$t with $bindoptions" dc $VALGRIND $smb4torture "\$SERVER[$bindoptions]" -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN $t "$*"
121  done
122 done
123
124 for bindoptions in connect $VALIDATE ; do
125  for transport in ncalrpc ncacn_np ncacn_ip_tcp; do
126      case $transport in
127          ncalrpc) tests=$slow_ncalrpc_tests ;;
128          ncacn_np) tests=$slow_ncacn_np_tests ;;
129          ncacn_ip_tcp) tests=$slow_ncacn_ip_tcp_tests ;;
130      esac
131    for t in $tests; do
132     plantest "$t on $transport with $bindoptions" dc $VALGRIND $smb4torture $transport:"\$SERVER[$bindoptions]" -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN $t "$*"
133    done
134  done
135 done
136
137
138 # Tests for the NET API
139
140 net=`$smb4torture --list | grep ^NET-`
141
142 for t in $net; do
143     plantest "$t" dc $VALGRIND $smb4torture "\$SERVER[$VALIDATE]" -U"\$USERNAME"%"\$PASSWORD" -W "\$DOMAIN" $t "$*"
144 done
145
146 # Tests for session keys
147
148 bindoptions=""
149 transport="ncacn_np"
150 for ntlmoptions in \
151         "-k no --option=usespnego=yes" \
152         "-k no --option=usespnego=yes --option=ntlmssp_client:128bit=no" \
153         "-k no --option=usespnego=yes --option=ntlmssp_client:56bit=yes" \
154         "-k no --option=usespnego=yes --option=ntlmssp_client:56bit=no" \
155         "-k no --option=usespnego=yes --option=ntlmssp_client:128bit=no --option=ntlmssp_client:56bit=yes" \
156         "-k no --option=usespnego=yes --option=ntlmssp_client:128bit=no --option=ntlmssp_client:56bit=no" \
157         "-k no --option=usespnego=yes --option=clientntlmv2auth=yes" \
158         "-k no --option=usespnego=yes --option=clientntlmv2auth=yes --option=ntlmssp_client:128bit=no" \
159         "-k no --option=usespnego=yes --option=clientntlmv2auth=yes --option=ntlmssp_client:128bit=no --option=ntlmssp_client:56bit=yes" \
160         "-k no --option=usespnego=no --option=clientntlmv2auth=yes" \
161         "-k no --option=gensec:spnego=no --option=clientntlmv2auth=yes" \
162         "-k no --option=usespnego=no"; do
163         name="RPC-SECRETS on $transport with $bindoptions with $ntlmoptions"
164    plantest "$name" dc $smb4torture $transport:"\$SERVER[$bindoptions]"  $ntlmoptions -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN --option=gensec:target_hostname=\$NETBIOSNAME RPC-SECRETS "$*"
165 done
166 plantest "RPC-SECRETS on $transport with $bindoptions with Kerberos" dc $smb4torture $transport:"\$SERVER[$bindoptions]" -k yes -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN "--option=gensec:target_hostname=\$NETBIOSNAME" RPC-SECRETS "$*"
167 plantest "RPC-SECRETS on $transport with $bindoptions with Kerberos - use target principal" dc $smb4torture $transport:"\$SERVER[$bindoptions]" -k yes -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN "--option=clientusespnegoprincipal=yes" "--option=gensec:target_hostname=\$NETBIOSNAME" RPC-SECRETS "$*"
168  plantest "RPC-SECRETS on $transport with Kerberos - use Samba3 style login" dc $smb4torture $transport:"\$SERVER" -k yes -U"\$USERNAME"%"\$PASSWORD" -W "\$DOMAIN" "--option=gensec:fake_gssapi_krb5=yes" "--option=gensec:gssapi_krb5=no" "--option=gensec:target_hostname=\$NETBIOSNAME" "RPC-SECRETS-none*" "$*"
169  plantest "RPC-SECRETS on $transport with Kerberos - use Samba3 style login, use target principal" dc $smb4torture $transport:"\$SERVER" -k yes -U"\$USERNAME"%"\$PASSWORD" -W "\$DOMAIN" "--option=clientusespnegoprincipal=yes" "--option=gensec:fake_gssapi_krb5=yes" "--option=gensec:gssapi_krb5=no" "--option=gensec:target_hostname=\$NETBIOSNAME" "RPC-SECRETS-none*" "$*"
170
171 # Echo tests
172 transports="ncacn_np ncacn_ip_tcp ncalrpc"
173
174 for transport in $transports; do
175  for bindoptions in connect spnego spnego,sign spnego,seal $VALIDATE padcheck bigendian bigendian,seal; do
176   for ntlmoptions in \
177         "--option=socket:testnonblock=True --option=torture:quick=yes"; do
178    plantest "RPC-ECHO on $transport with $bindoptions and $ntlmoptions" dc $smb4torture $transport:"\$SERVER[$bindoptions]" $ntlmoptions -U"\$USERNAME"%"\$PASSWORD" -W "\$DOMAIN" RPC-ECHO "$*"
179   done
180  done
181 done
182
183 for transport in $transports; do
184  for bindoptions in sign seal; do
185   for ntlmoptions in \
186         "--option=ntlmssp_client:ntlm2=yes --option=torture:quick=yes" \
187         "--option=ntlmssp_client:ntlm2=no  --option=torture:quick=yes" \
188         "--option=ntlmssp_client:ntlm2=yes --option=ntlmssp_client:128bit=no --option=torture:quick=yes" \
189         "--option=ntlmssp_client:ntlm2=no  --option=ntlmssp_client:128bit=no --option=torture:quick=yes" \
190         "--option=ntlmssp_client:ntlm2=yes --option=ntlmssp_client:keyexchange=no --option=torture:quick=yes" \
191         "--option=ntlmssp_client:ntlm2=no  --option=ntlmssp_client:keyexchange=no  --option=torture:quick=yes" \
192         "--option=clientntlmv2auth=yes  --option=ntlmssp_client:keyexchange=no  --option=torture:quick=yes" \
193         "--option=clientntlmv2auth=yes  --option=ntlmssp_client:128bit=no --option=ntlmssp_client:keyexchange=yes  --option=torture:quick=yes" \
194         "--option=clientntlmv2auth=yes  --option=ntlmssp_client:128bit=no --option=ntlmssp_client:keyexchange=no  --option=torture:quick=yes" \
195     ; do
196    plantest "RPC-ECHO on $transport with $bindoptions and $ntlmoptions" dc $smb4torture $transport:"\$SERVER[$bindoptions]" $ntlmoptions -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN RPC-ECHO "$*"
197   done
198  done
199 done
200
201 plantest "RPC-ECHO on ncacn_np over smb2" dc $smb4torture ncacn_np:"\$SERVER[smb2]" -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN RPC-ECHO "$*"
202
203 # Tests against the NTVFS POSIX backend
204 smb2=`$smb4torture --list | grep "^SMB2-" | xargs`
205 raw=`$smb4torture --list | grep "^RAW-" | xargs`
206 base=`$smb4torture --list | grep "^BASE-" | xargs`
207
208 for t in $base $raw $smb2; do
209     plantest "$t" dc $VALGRIND $smb4torture $ADDARGS //\$SERVER/tmp -U"\$USERNAME"%"\$PASSWORD" $t
210 done
211
212 rap=`$smb4torture --list | grep "^RAP-" | xargs`
213 for t in $rap; do
214     plantest "$t" dc $VALGRIND $smb4torture $ADDARGS //\$SERVER/IPC\\\$ -U"\$USERNAME"%"\$PASSWORD" $t
215 done
216
217 # Tests against the NTVFS CIFS backend
218 for t in $base $raw; do
219     plantest "ntvfs.cifs.$t" dc $VALGRIND $smb4torture //\$NETBIOSNAME/cifs -U"\$USERNAME"%"\$PASSWORD" $t
220 done
221
222 # Local tests
223
224 for t in `$smb4torture --list | grep "^LOCAL-" | xargs`; do
225         plantest "$t" none $VALGRIND $smb4torture ncalrpc: $t "$*"
226 done
227
228 if test -f $samba4bindir/tdbtorture
229 then
230         plantest "tdb stress" none $VALGRIND $samba4bindir/tdbtorture
231 fi
232
233 # Pidl tests
234
235 if test x"${PIDL_TESTS_SKIP}" = x"yes"; then
236    echo "Skipping pidl tests - PIDL_TESTS_SKIP=yes"
237 elif $PERL -e 'eval require Test::More;' > /dev/null 2>&1; then
238   for f in $samba4srcdir/pidl/tests/*.pl; do
239      plantest "pidl.`basename $f .pl`" none $PERL $f "|" $samba4srcdir/script/harness2subunit.pl
240   done
241 else 
242    echo "Skipping pidl tests - Test::More not installed"
243 fi
244
245 # Blackbox Tests:
246 # tests that interact directly with the command-line tools rather than using 
247 # the API
248
249 bbdir=$incdir/../../testprogs/blackbox
250
251 plantest "blackbox.smbclient" dc $bbdir/test_smbclient.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$PREFIX" 
252 plantest "blackbox.kinit" dc $bbdir/test_kinit.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$REALM" "\$DOMAIN" "$PREFIX" 
253 plantest "blackbox.cifsdd" dc $bbdir/test_cifsdd.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" 
254 plantest "blackbox.nmblookup" dc $bbdir/test_nmblookup.sh "\$NETBIOSNAME" "\$NETBIOSALIAS" "\$SERVER" "\$SERVER_IP" 
255 plantest "blackbox.nmblookup" member $bbdir/test_nmblookup.sh "\$NETBIOSNAME" "\$NETBIOSALIAS" "\$SERVER" "\$SERVER_IP"
256
257 # Tests using the "Simple" NTVFS backend
258
259 for t in "BASE-RW1"; do
260     plantest "ntvfs/simple $t" dc $VALGRIND $smb4torture $ADDARGS //\$SERVER/simple -U"\$USERNAME"%"\$PASSWORD" $t
261 done
262
263 DATADIR=$samba4srcdir/../testdata
264
265 plantest "parse samba3" none $samba4bindir/smbscript $DATADIR/samba3/verify $CONFIGURATION $DATADIR/samba3
266 plantest "js.samba3sam" none $SCRIPTDIR/samba3sam.js $CONFIGURATION `pwd` $DATADIR/samba3/
267
268 # Domain Member Tests
269
270 plantest "RPC-ECHO against member server with local creds" member $VALGRIND $smb4torture ncacn_np:"\$NETBIOSNAME" -U"\$NETBIOSNAME/\$USERNAME"%"\$PASSWORD" RPC-ECHO "$*"
271 plantest "RPC-ECHO against member server with domain creds" member $VALGRIND $smb4torture ncacn_np:"\$NETBIOSNAME" -U"\$DOMAIN/\$DC_USERNAME"%"\$DC_PASSWORD" RPC-ECHO "$*"
272 plantest "RPC-SAMR against member server with local creds" member $VALGRIND $smb4torture ncacn_np:"\$NETBIOSNAME" -U"\$NETBIOSNAME/\$USERNAME"%"\$PASSWORD" "RPC-SAMR" "$*"
273 plantest "RPC-SAMR-USERS against member server with local creds" member $VALGRIND $smb4torture ncacn_np:"\$NETBIOSNAME" -U"\$NETBIOSNAME/\$USERNAME"%"\$PASSWORD" "RPC-SAMR-USERS" "$*"
274 plantest "RPC-SAMR-PASSWORDS against member server with local creds" member $VALGRIND $smb4torture ncacn_np:"\$NETBIOSNAME" -U"\$NETBIOSNAME/\$USERNAME"%"\$PASSWORD" "RPC-SAMR-PASSWORDS" "$*"
275 plantest "wbinfo -a against member server with domain creds" member $VALGRIND $samba4bindir/wbinfo -a "\$DOMAIN/\$DC_USERNAME"%"\$DC_PASSWORD"
276
277 NBT_TESTS=`$smb4torture --list | grep "^NBT-" | xargs`
278
279 for f in $NBT_TESTS; do
280         plantest $f dc $smb4torture //\$SERVER/_none_ $f -U\$USERNAME%\$PASSWORD 
281 done
282
283 WB_OPTS="--option=\"torture:strict mode=yes\""
284 WB_OPTS="${WB_OPTS} --option=\"torture:timelimit=1\""
285 WB_OPTS="${WB_OPTS} --option=\"torture:winbindd separator=\\\\\""
286 WB_OPTS="${WB_OPTS} --option=\"torture:winbindd private pipe dir=\$WINBINDD_PRIV_PIPE_DIR\""
287 WB_OPTS="${WB_OPTS} --option=\"torture:winbindd netbios name=\$SERVER\""
288 WB_OPTS="${WB_OPTS} --option=\"torture:winbindd netbios domain=\$DOMAIN\""
289
290 WINBIND_STRUCT_TESTS=`$smb4torture --list | grep "^WINBIND-STRUCT" | xargs`
291 WINBIND_NDR_TESTS=`$smb4torture --list | grep "^WINBIND-NDR" | xargs`
292 for env in dc member; do
293         for t in $WINBIND_STRUCT_TESTS; do
294                 plantest $t $env $smb4torture $WB_OPTS //_none_/_none_ $t
295         done
296
297         for t in $WINBIND_NDR_TESTS; do
298                 plantest $t $env $smb4torture $WB_OPTS //_none_/_none_ $t
299         done
300 done
301
302 if test -f $samba4bindir/nsstest 
303 then
304         plantest "NSS-TEST using winbind" member $VALGRIND $samba4bindir/nsstest $samba4bindir/shared/libnss_winbind.so
305 fi
306
307 # if python is available, run the python tests:
308 if test -f $samba4bindir/smbpython
309 then
310         PYTHON=bin/smbpython
311         SUBUNITRUN="$PYTHON ./scripting/bin/subunitrun"
312         plantest "ldb.python" none PYTHONPATH="$PYTHONPATH:lib/ldb/tests/python/" $SUBUNITRUN api
313         plantest "credentials.python" none PYTHONPATH="$PYTHONPATH:auth/credentials/tests" $SUBUNITRUN bindings
314         plantest "registry.python" none PYTHONPATH="$PYTHONPATH:lib/registry/tests/" $SUBUNITRUN bindings
315         plantest "tdb.python" none PYTHONPATH="$PYTHONPATH:lib/tdb/python/tests" $SUBUNITRUN simple
316         plantest "auth.python" none PYTHONPATH="$PYTHONPATH:auth/tests/" $SUBUNITRUN bindings
317         plantest "security.python" none PYTHONPATH="$PYTHONPATH:libcli/security/tests" $SUBUNITRUN bindings
318         plantest "param.python" none PYTHONPATH="$PYTHONPATH:param/tests" $SUBUNITRUN bindings
319         plantest "upgrade.python" none $SUBUNITRUN samba.tests.upgrade
320         plantest "samba.python" none $SUBUNITRUN samba.tests
321         plantest "provision.python" none $SUBUNITRUN samba.tests.provision
322         plantest "samba3.python" none $SUBUNITRUN samba.tests.samba3
323         plantest "events.python" none PYTHONPATH="$PYTHONPATH:lib/events" $SUBUNITRUN tests
324         plantest "samba3sam.python" none PYTHONPATH="$PYTHONPATH:dsdb/samdb/ldb_modules/tests" $SUBUNITRUN samba3sam
325         plantest "ldap.python" dc $PYTHON $samba4srcdir/lib/ldb/tests/python/ldap.py \$SERVER -U\$USERNAME%\$PASSWORD
326         plantest "blackbox.samba3dump" none $PYTHON scripting/bin/samba3dump $samba4srcdir/../testdata/samba3
327         rm -rf $PREFIX/upgrade
328         plantest "blackbox.upgrade" none $PYTHON setup/upgrade.py $CONFIGURATION --targetdir=$PREFIX/upgrade ../testdata/samba3 ../testdata/samba3/smb.conf
329         rm -rf $PREFIX/provision
330         plantest "blackbox.provision.py" none $PYTHON ./setup/provision.py $CONFIGURATION --domain=FOO --realm=foo --targetdir=$PREFIX/provision
331 fi