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