0e03ee4d75cdb68d4def80b94d48669cfd0beb6b
[samba.git] / source4 / utils / tests / test_samba_tool.sh
1 #!/bin/sh
2 # Blackbox tests for samba-tool
3
4 SERVER=$1
5 SERVER_IP=$2
6 USERNAME=$3
7 PASSWORD=$4
8 DOMAIN=$5
9 shift 5
10
11 failed=0
12
13 samba4bindir="$BINDIR"
14 smbclient="$samba4bindir/smbclient"
15 samba_tool="$samba4bindir/samba-tool"
16
17 testit() {
18         name="$1"
19         shift
20         cmdline="$*"
21         echo "test: $name"
22         $cmdline
23         status=$?
24         if [ x$status = x0 ]; then
25                 echo "success: $name"
26         else
27                 echo "failure: $name"
28                 failed=`expr $failed + 1`
29         fi
30         return $status
31 }
32
33 testit "Test login with --machine-pass without kerberos" $VALGRIND $smbclient -c 'ls' $CONFIGURATION //$SERVER/tmp --machine-pass -k no
34
35 testit "Test login with --machine-pass and kerberos" $VALGRIND $smbclient -c 'ls' $CONFIGURATION //$SERVER/tmp --machine-pass -k yes
36
37 testit "time" $VALGRIND $samba_tool time $SERVER $CONFIGURATION  -W "$DOMAIN" -U"$USERNAME%$PASSWORD" $@
38
39 testit "domain level.show" $VALGRIND $samba_tool domain level show
40
41 testit "domain info" $VALGRIND $samba_tool domain info $SERVER_IP
42
43 exit $failed