s3-selftest convert tests.sh to python
[bbaumbach/samba-autobuild/.git] / source3 / script / tests / test_net_misc.sh
1 #!/bin/sh
2
3 # various tests for the "net" command
4
5 if [ $# -lt 3 ]; then
6 cat <<EOF
7 Usage: test_net_misc.sh SCRIPTDIR SERVERCONFFILE CONFIGURATION
8 EOF
9 exit 1;
10 fi
11
12 SCRIPTDIR="$1"
13 SERVERCONFFILE="$2"
14 CONFIGURATION="$3"
15
16 NET="$VALGRIND ${NET:-$BINDIR/net} $CONFIGURATION"
17
18 NETTIME="${NET} time"
19 NETLOOKUP="${NET} lookup"
20
21 test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && {
22 incdir=`dirname $0`/../../../testprogs/blackbox
23 . $incdir/subunit.sh
24 }
25
26 failed=0
27
28 test_time()
29 {
30         PARAM="$1"
31
32         ${NETTIME} -S ${SERVER} ${PARAM}
33 }
34
35 test_lookup()
36 {
37         PARAM="$1"
38
39         ${NETLOOKUP} ${PARAM}
40 }
41
42 testit "get the time" \
43         test_time || \
44         failed=`expr $failed + 1`
45
46 testit "get the system time" \
47         test_time system || \
48         failed=`expr $failed + 1`
49
50 testit "get the time zone" \
51         test_time zone || \
52         failed=`expr $failed + 1`
53
54 testit "lookup the PDC" \
55         test_lookup pdc || \
56         failed=`expr $failed + 1`
57
58 testit "lookup the master browser" \
59         test_lookup master || \
60         failed=`expr $failed + 1`
61
62 testok $0 $failed
63