r24706: Move nmblookup tests to separate blackbox testsuite.
[samba.git] / testprogs / blackbox / test_nmblookup.sh
1 #!/bin/sh
2 # Blackbox tests for nmblookup
3
4 NETBIOSNAME=$1
5 NETBIOSALIAS=$2
6 SERVER=$3
7 SERVER_IP=$4
8 shift 4
9 TORTURE_OPTIONS=$*
10
11 failed=0
12
13 testit() {
14         name="$1"
15         shift
16         cmdline="$*"
17         echo "test: $name"
18         $cmdline
19         status=$?
20         if [ x$status = x0 ]; then
21                 echo "success: $name"
22         else
23                 echo "failure: $name"
24                 failed=`expr $failed + 1`
25         fi
26         return $status
27 }
28
29 testit "nmblookup -U \$SERVER_IP \$SERVER" bin/nmblookup $TORTURE_OPTIONS -U $SERVER_IP $SERVER
30 testit "nmblookup -U \$SERVER_IP \$NETBIOSNAME" bin/nmblookup $TORTURE_OPTIONS -U $SERVER_IP $NETBIOSNAME
31 testit "nmblookup -U \$SERVER_IP \$NETBIOSALIAS" bin/nmblookup $TORTURE_OPTIONS -U $SERVER_IP $NETBIOSALIAS
32 testit "nmblookup \$SERVER" bin/nmblookup $TORTURE_OPTIONS $SERVER
33 testit "nmblookup \$NETBIOSNAME" bin/nmblookup $TORTURE_OPTIONS $NETBIOSNAME
34 testit "nmblookup \$NETBIOSALIAS" bin/nmblookup $TORTURE_OPTIONS $NETBIOSALIAS
35
36 exit $failed