fa436a4af8f9ef552af584a1ba6da62a03ba9d96
[ab/samba.git/.git] / source4 / script / tests / win / wintest_base.sh
1 #!/bin/sh
2
3 . script/tests/test_functions.sh
4
5 . script/tests/win/wintest_functions.sh
6
7 # This variable is defined in the per-hosts .fns file.
8 . $WINTESTCONF
9
10 if [ $# -lt 4 ]; then
11 cat <<EOF
12 Usage: test_net.sh SERVER USERNAME PASSWORD DOMAIN
13 EOF
14 exit 1;
15 fi
16
17 server="$1"
18 username="$2"
19 password="$3"
20 domain="$4"
21 shift 4
22
23 base_tests="BASE-UNLINK BASE-ATTR BASE-DELETE BASE-TCON BASE-OPEN BASE-CHKPATH"
24
25 all_errs=0
26
27 for t in $base_tests; do
28         test_name="$t / WINDOWS SERVER"
29         echo -e "\n$test_name SETUP PHASE"
30
31         setup_share_test
32
33         if [ $err_rtn -ne 0 ]; then
34                 # If test setup fails, load VM snapshot and skip test.
35                 restore_snapshot "\n$test_name setup failed, skipping test."
36         else
37                 echo -e "\n$test_name setup completed successfully."
38                 old_errs=$all_errs
39
40                 testit "$test_name" $SMBTORTURE_BIN_PATH \
41                         -U $username%$password \
42                         -W $domain //$server/$SMBTORTURE_REMOTE_SHARE_NAME \
43                         $t || all_errs=`expr $all_errs + 1`
44                 if [ $old_errs -lt $all_errs ]; then
45                         restore_snapshot "\n$test_name failed."
46                 else
47                         echo -e "\n$test_name CLEANUP PHASE"
48                         remove_share_test
49                         if [ $err_rtn -ne 0 ]; then
50                                 # If cleanup fails, restore VM snapshot.
51                                 restore_snapshot "\n$test_name removal failed."
52                         else
53                                 echo -e "\n$test_name removal completed successfully."
54                         fi
55                 fi
56         fi
57 done
58
59 testok $0 $all_errs