r26448: Add basic tests for param python module.
[Samba.git] / source4 / selftest / samba4_tests.sh
blob424e1f0209c63ca5dbdd29750fd4619594b018e7
1 #!/bin/sh
2 if [ ! -n "$PERL" ]
3 then
4 PERL=perl
5 fi
7 incdir=`dirname $0`
9 plantest() {
10 name=$1
11 env=$2
12 shift 2
13 cmdline="$*"
14 echo "-- TEST --"
15 if [ "$env" = "none" ]; then
16 echo "samba4.$name"
17 else
18 echo "samba4.$name ($env)"
20 echo $env
21 echo $cmdline
24 $incdir/../bin/smbtorture -V
26 samba4srcdir=$incdir/..
27 samba4bindir=$samba4srcdir/bin
28 SCRIPTDIR=$samba4srcdir/../testprogs/ejs
29 smb4torture="$samba4bindir/smbtorture $TORTURE_OPTIONS"
31 plantest "js.base" dc "$SCRIPTDIR/base.js" $CONFIGURATION
32 plantest "js.samr" dc "$SCRIPTDIR/samr.js" $CONFIGURATION ncalrpc: -U\$USERNAME%\$PASSWORD
33 plantest "js.echo" dc "$SCRIPTDIR/echo.js" $CONFIGURATION ncalrpc: -U\$USERNAME%\$PASSWORD
34 #plantest "ejsnet.js" dc "$SCRIPTDIR/ejsnet.js" $CONFIGURATION -U\$USERNAME%\$PASSWORD \$DOMAIN ejstestuser
35 plantest "js.ldb" none "$SCRIPTDIR/ldb.js" `pwd` $CONFIGURATION -d 10
36 plantest "js.winreg" dc $samba4srcdir/scripting/bin/winreg $CONFIGURATION ncalrpc: 'HKLM' -U\$USERNAME%\$PASSWORD
38 # Simple tests for LDAP and CLDAP
40 for options in "" "--option=socket:testnonblock=true" "-U\$USERNAME%\$PASSWORD --option=socket:testnonblock=true" "-U\$USERNAME%\$PASSWORD"; do
41 plantest "ldb.ldap with options $options" dc $samba4srcdir/../testprogs/blackbox/test_ldb.sh ldap \$SERVER_IP $options
42 done
43 # see if we support ldaps
44 if grep ENABLE_GNUTLS.1 include/config.h > /dev/null; then
45 for options in "" "-U\$USERNAME%\$PASSWORD"; do
46 plantest "ldb.ldaps with options $options" dc $samba4srcdir/../testprogs/blackbox/test_ldb.sh ldaps \$SERVER_IP $options
47 done
49 for t in LDAP-CLDAP LDAP-BASIC LDAP-SCHEMA LDAP-UPTODATEVECTOR
51 plantest "$t" dc $smb4torture "-U\$USERNAME%\$PASSWORD" //\$SERVER_IP/_none_ $t
52 done
54 # only do the ldb tests when not in quick mode - they are quite slow, and ldb
55 # is now pretty well tested by the rest of the quick tests anyway
56 LDBDIR=$samba4srcdir/lib/ldb
57 export LDBDIR
58 plantest "ldb" none $LDBDIR/tests/test-tdb.sh
60 plantest "js.ldap" dc $SCRIPTDIR/ldap.js $CONFIGURATION -d 10 \$SERVER -U\$USERNAME%\$PASSWORD
62 # Tests for RPC
64 # add tests to this list as they start passing, so we test
65 # that they stay passing
66 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"
67 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"
68 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"
69 slow_ncacn_np_tests="RPC-SAMLOGON RPC-SAMR RPC-SAMR-USERS RPC-SAMR-PASSWORDS"
70 slow_ncalrpc_tests="RPC-SAMR RPC-SAMR-PASSWORDS"
71 slow_ncacn_ip_tcp_tests="RPC-SAMR RPC-SAMR-PASSWORDS RPC-CRACKNAMES"
73 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"
75 # Make sure all tests get run
76 for t in `$smb4torture --list | grep "^RPC-"`
78 echo $all_tests | grep $t > /dev/null
79 if [ $? -ne 0 ]
80 then
81 auto_rpc_tests="$auto_rpc_tests $t"
83 done
85 for bindoptions in seal,padcheck $VALIDATE bigendian; do
86 for transport in ncalrpc ncacn_np ncacn_ip_tcp; do
87 case $transport in
88 ncalrpc) tests=$ncalrpc_tests ;;
89 ncacn_np) tests=$ncacn_np_tests ;;
90 ncacn_ip_tcp) tests=$ncacn_ip_tcp_tests ;;
91 esac
92 for t in $tests; do
93 plantest "$t on $transport with $bindoptions" dc $VALGRIND $smb4torture $transport:"\$SERVER[$bindoptions]" -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN $t "$*"
94 done
95 plantest "RPC-SAMBA3-SHARESEC on $transport with $bindoptions" dc $VALGRIND $smb4torture $transport:"\$SERVER[$bindoptions]" -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN --option=torture:share=tmp $t "$*"
96 done
97 done
99 for bindoptions in "" $VALIDATE bigendian; do
100 for t in $auto_rpc_tests; do
101 plantest "$t with $bindoptions" dc $VALGRIND $smb4torture "\$SERVER[$bindoptions]" -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN $t "$*"
102 done
103 done
105 for bindoptions in connect $VALIDATE ; do
106 for transport in ncalrpc ncacn_np ncacn_ip_tcp; do
107 case $transport in
108 ncalrpc) tests=$slow_ncalrpc_tests ;;
109 ncacn_np) tests=$slow_ncacn_np_tests ;;
110 ncacn_ip_tcp) tests=$slow_ncacn_ip_tcp_tests ;;
111 esac
112 for t in $tests; do
113 plantest "$t on $transport with $bindoptions" dc $VALGRIND $smb4torture $transport:"\$SERVER[$bindoptions]" -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN $t "$*"
114 done
115 done
116 done
119 # Tests for the NET API
121 net=`$smb4torture --list | grep ^NET-`
123 for t in $net; do
124 plantest "$t" dc $VALGRIND $smb4torture "\$SERVER[$VALIDATE]" -U"\$USERNAME"%"\$PASSWORD" -W "\$DOMAIN" $t "$*"
125 done
127 # Tests for session keys
129 bindoptions=""
130 transport="ncacn_np"
131 for ntlmoptions in \
132 "-k no --option=usespnego=yes" \
133 "-k no --option=usespnego=yes --option=ntlmssp_client:128bit=no" \
134 "-k no --option=usespnego=yes --option=ntlmssp_client:56bit=yes" \
135 "-k no --option=usespnego=yes --option=ntlmssp_client:56bit=no" \
136 "-k no --option=usespnego=yes --option=ntlmssp_client:128bit=no --option=ntlmssp_client:56bit=yes" \
137 "-k no --option=usespnego=yes --option=ntlmssp_client:128bit=no --option=ntlmssp_client:56bit=no" \
138 "-k no --option=usespnego=yes --option=clientntlmv2auth=yes" \
139 "-k no --option=usespnego=yes --option=clientntlmv2auth=yes --option=ntlmssp_client:128bit=no" \
140 "-k no --option=usespnego=yes --option=clientntlmv2auth=yes --option=ntlmssp_client:128bit=no --option=ntlmssp_client:56bit=yes" \
141 "-k no --option=usespnego=no --option=clientntlmv2auth=yes" \
142 "-k no --option=gensec:spnego=no --option=clientntlmv2auth=yes" \
143 "-k no --option=usespnego=no"; do
144 name="RPC-SECRETS on $transport with $bindoptions with $ntlmoptions"
145 plantest "$name" dc $smb4torture $transport:"\$SERVER[$bindoptions]" $ntlmoptions -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN --option=gensec:target_hostname=\$NETBIOSNAME RPC-SECRETS "$*"
146 done
147 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 "$*"
148 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 "$*"
149 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*" "$*"
150 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*" "$*"
152 # Echo tests
153 transports="ncacn_np ncacn_ip_tcp ncalrpc"
155 for transport in $transports; do
156 for bindoptions in connect spnego spnego,sign spnego,seal $VALIDATE padcheck bigendian bigendian,seal; do
157 for ntlmoptions in \
158 "--option=socket:testnonblock=True --option=torture:quick=yes"; do
159 plantest "RPC-ECHO on $transport with $bindoptions and $ntlmoptions" dc $smb4torture $transport:"\$SERVER[$bindoptions]" $ntlmoptions -U"\$USERNAME"%"\$PASSWORD" -W "\$DOMAIN" RPC-ECHO "$*"
160 done
161 done
162 done
164 for transport in $transports; do
165 for bindoptions in sign seal; do
166 for ntlmoptions in \
167 "--option=ntlmssp_client:ntlm2=yes --option=torture:quick=yes" \
168 "--option=ntlmssp_client:ntlm2=no --option=torture:quick=yes" \
169 "--option=ntlmssp_client:ntlm2=yes --option=ntlmssp_client:128bit=no --option=torture:quick=yes" \
170 "--option=ntlmssp_client:ntlm2=no --option=ntlmssp_client:128bit=no --option=torture:quick=yes" \
171 "--option=ntlmssp_client:ntlm2=yes --option=ntlmssp_client:keyexchange=no --option=torture:quick=yes" \
172 "--option=ntlmssp_client:ntlm2=no --option=ntlmssp_client:keyexchange=no --option=torture:quick=yes" \
173 "--option=clientntlmv2auth=yes --option=ntlmssp_client:keyexchange=no --option=torture:quick=yes" \
174 "--option=clientntlmv2auth=yes --option=ntlmssp_client:128bit=no --option=ntlmssp_client:keyexchange=yes --option=torture:quick=yes" \
175 "--option=clientntlmv2auth=yes --option=ntlmssp_client:128bit=no --option=ntlmssp_client:keyexchange=no --option=torture:quick=yes" \
176 ; do
177 plantest "RPC-ECHO on $transport with $bindoptions and $ntlmoptions" dc $smb4torture $transport:"\$SERVER[$bindoptions]" $ntlmoptions -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN RPC-ECHO "$*"
178 done
179 done
180 done
182 plantest "RPC-ECHO on ncacn_np over smb2" dc $smb4torture ncacn_np:"\$SERVER[smb2]" -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN RPC-ECHO "$*"
184 # Tests against the NTVFS POSIX backend
185 smb2=`$smb4torture --list | grep "^SMB2-" | xargs`
186 raw=`$smb4torture --list | grep "^RAW-" | xargs`
187 base=`$smb4torture --list | grep "^BASE-" | xargs`
189 for t in $base $raw $smb2; do
190 plantest "$t" dc $VALGRIND $smb4torture $ADDARGS //\$SERVER/tmp -U"\$USERNAME"%"\$PASSWORD" $t
191 done
193 # Tests against the NTVFS CIFS backend
194 for t in $base $raw; do
195 plantest "ntvfs.cifs.$t" dc $VALGRIND $smb4torture //\$NETBIOSNAME/cifs -U"\$USERNAME"%"\$PASSWORD" $t
196 done
198 # Local tests
200 for t in `$smb4torture --list | grep "^LOCAL-" | xargs`; do
201 plantest "$t" none $VALGRIND $smb4torture ncalrpc: $t "$*"
202 done
204 if test -f $samba4bindir/tdbtorture
205 then
206 plantest "tdb stress" none $VALGRIND $samba4bindir/tdbtorture
209 # Pidl tests
211 if test x"${PIDL_TESTS_SKIP}" = x"yes"; then
212 echo "Skipping pidl tests - PIDL_TESTS_SKIP=yes"
213 elif $PERL -e 'eval require Test::More;' > /dev/null 2>&1; then
214 for f in $samba4srcdir/pidl/tests/*.pl; do
215 plantest "pidl/`basename $f`" none $PERL $f "|" $samba4srcdir/script/harness2subunit.pl
216 done
217 else
218 echo "Skipping pidl tests - Test::More not installed"
221 # Blackbox Tests:
222 # tests that interact directly with the command-line tools rather than using
223 # the API
225 bbdir=$incdir/../../testprogs/blackbox
227 plantest "blackbox.smbclient" dc $bbdir/test_smbclient.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$PREFIX"
228 plantest "blackbox.kinit" dc $bbdir/test_kinit.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$REALM" "\$DOMAIN" "$PREFIX"
229 plantest "blackbox.cifsdd" dc $bbdir/test_cifsdd.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN"
230 plantest "blackbox.nmblookup" dc $bbdir/test_nmblookup.sh "\$NETBIOSNAME" "\$NETBIOSALIAS" "\$SERVER" "\$SERVER_IP"
231 plantest "blackbox.nmblookup" member $bbdir/test_nmblookup.sh "\$NETBIOSNAME" "\$NETBIOSALIAS" "\$SERVER" "\$SERVER_IP"
233 # Tests using the "Simple" NTVFS backend
235 for t in "BASE-RW1"; do
236 plantest "ntvfs/simple $t" dc $VALGRIND $smb4torture $ADDARGS //\$SERVER/simple -U"\$USERNAME"%"\$PASSWORD" $t
237 done
239 DATADIR=$samba4srcdir/../testdata
241 plantest "parse samba3" none $samba4bindir/smbscript $DATADIR/samba3/verify $CONFIGURATION $DATADIR/samba3
242 plantest "js.samba3sam" none $SCRIPTDIR/samba3sam.js $CONFIGURATION `pwd` $DATADIR/samba3/
244 rm -rf $PREFIX/upgrade
245 mkdir -p $PREFIX/upgrade
246 #plantest "upgrade" none $samba4bindir/smbscript setup/upgrade $CONFIGURATION --verify --targetdir=$PREFIX ../testdata/samba3 ../testdata/samba3/smb.conf
248 # Domain Member Tests
250 plantest "RPC-ECHO against member server with local creds" member $VALGRIND $smb4torture ncacn_np:"\$NETBIOSNAME" -U"\$NETBIOSNAME/\$USERNAME"%"\$PASSWORD" RPC-ECHO "$*"
251 plantest "RPC-ECHO against member server with domain creds" member $VALGRIND $smb4torture ncacn_np:"\$NETBIOSNAME" -U"\$DOMAIN/\$DC_USERNAME"%"\$DC_PASSWORD" RPC-ECHO "$*"
252 plantest "RPC-SAMR against member server with local creds" member $VALGRIND $smb4torture ncacn_np:"\$NETBIOSNAME" -U"\$NETBIOSNAME/\$USERNAME"%"\$PASSWORD" "RPC-SAMR" "$*"
253 plantest "RPC-SAMR-USERS against member server with local creds" member $VALGRIND $smb4torture ncacn_np:"\$NETBIOSNAME" -U"\$NETBIOSNAME/\$USERNAME"%"\$PASSWORD" "RPC-SAMR-USERS" "$*"
254 plantest "RPC-SAMR-PASSWORDS against member server with local creds" member $VALGRIND $smb4torture ncacn_np:"\$NETBIOSNAME" -U"\$NETBIOSNAME/\$USERNAME"%"\$PASSWORD" "RPC-SAMR-PASSWORDS" "$*"
255 plantest "wbinfo -a against member server with domain creds" member $VALGRIND $samba4bindir/wbinfo -a "\$DOMAIN/\$DC_USERNAME"%"\$DC_PASSWORD"
257 NBT_TESTS=`$smb4torture --list | grep "^NBT-" | xargs`
259 for f in $NBT_TESTS; do
260 plantest $f dc $smb4torture //\$SERVER/_none_ $f -U\$USERNAME%\$PASSWORD
261 done
263 WB_OPTS="--option=\"torture:strict mode=yes\""
264 WB_OPTS="${WB_OPTS} --option=\"torture:timelimit=1\""
265 WB_OPTS="${WB_OPTS} --option=\"torture:winbindd separator=\\\\\""
266 WB_OPTS="${WB_OPTS} --option=\"torture:winbindd private pipe dir=\$WINBINDD_PRIV_PIPE_DIR\""
267 WB_OPTS="${WB_OPTS} --option=\"torture:winbindd netbios name=\$SERVER\""
268 WB_OPTS="${WB_OPTS} --option=\"torture:winbindd netbios domain=\$DOMAIN\""
270 WINBIND_STRUCT_TESTS=`$smb4torture --list | grep "^WINBIND-STRUCT" | xargs`
271 WINBIND_NDR_TESTS=`$smb4torture --list | grep "^WINBIND-NDR" | xargs`
272 for env in dc member; do
273 for t in $WINBIND_STRUCT_TESTS; do
274 plantest $t $env $smb4torture $WB_OPTS //_none_/_none_ $t
275 done
277 for t in $WINBIND_NDR_TESTS; do
278 plantest $t $env $smb4torture $WB_OPTS //_none_/_none_ $t
279 done
280 done
282 # Tests for SWIG
283 # export PYTHONPATH=lib/tdb/swig:lib/ldb/swig:scripting/swig:$PYTHONPATH
284 # export LD_LIBRARY_PATH=bin:$LD_LIBRARY_PATH
286 # plantest "tdb wrappers" scripting/swig/torture/torture_tdb.py
287 # plantest "ldb wrappers" scripting/swig/torture/torture_ldb.py
289 if test -f $samba4bindir/nsstest
290 then
291 plantest "NSS-TEST using winbind" member $VALGRIND $samba4bindir/nsstest $samba4bindir/shared/libnss_winbind.so
294 # if python is available, run the python tests:
295 if which python 2>/dev/null >/dev/null
296 then
297 plantest "ldb.python" none PYTHONPATH=bin/python:scripting/python:lib/ldb/tests/python/ scripting/bin/subunitrun api
298 plantest "credentials.python" none PYTHONPATH=bin/python:scripting/python:auth/credentials/tests scripting/bin/subunitrun bindings
299 plantest "registry.python" none PYTHONPATH=bin/python:scripting/python:lib/registry/tests/ scripting/bin/subunitrun bindings
300 plantest "tdb.python" none PYTHONPATH=bin/python:scripting/python:lib/tdb/python/tests scripting/bin/subunitrun simple
301 plantest "auth.python" none PYTHONPATH=bin/python:scripting/python:auth/tests/ scripting/bin/subunitrun bindings
302 plantest "security.python" none PYTHONPATH=bin/python:scripting/python:libcli/security/tests/ scripting/bin/subunitrun bindings
303 plantest "param.python" none PYTHONPATH=bin/python:scripting/python:param/tests scripting/bin/subunitrun bindings