s4:nbt_server: simulate nmbd and provide unexpected handling
[Samba.git] / source4 / selftest / win / wintest_raw.sh
blobd9c97f85778fc88e04867c3ad1a6c40bdf284dcd
1 #!/bin/sh
3 . selftest/test_functions.sh
5 . selftest/win/wintest_functions.sh
7 # This variable is defined in the per-hosts .fns file.
8 . $WINTESTCONF
10 if [ $# -lt 4 ]; then
11 cat <<EOF
12 Usage: wintest_raw.sh SERVER USERNAME PASSWORD DOMAIN
13 EOF
14 exit 1
17 server="$1"
18 username="$2"
19 password="$3"
20 domain="$4"
21 shift 4
23 export SMBTORTURE_REMOTE_HOST=$server
25 raw_tests="RAW-QFILEINFO RAW-SFILEINFO-BASE RAW-MKDIR RAW-SEEK RAW-OPEN RAW-WRITE RAW-UNLINK RAW-READ RAW-CLOSE RAW-IOCTL RAW-RENAME RAW-EAS RAW-STREAMS"
26 # This test fails: RAW-QFSINFO
28 all_errs=0
29 err=0
31 on_error()
33 errstr=$1
34 all_errs=$(expr $all_errs + 1)
36 restore_snapshot "$errstr" "$VM_CFG_PATH"
39 for t in $raw_tests; do
40 test_name="$t / WINDOWS SERVER"
41 echo -e "\n$test_name SETUP PHASE"
43 setup_share_test
45 if [ $err_rtn -ne 0 ]; then
46 # If test setup fails, load VM snapshot and skip test.
47 on_error "\n$test_name setup failed, skipping test."
48 else
49 echo -e "\n$test_name setup completed successfully."
51 $SMBTORTURE_BIN_PATH -U $username%$password -W $domain \
52 //$server/$SMBTORTURE_REMOTE_SHARE_NAME \
53 $t || err=1
54 if [ $err -ne 0 ]; then
55 on_error "\n$test_name failed."
56 else
57 echo -e "\n$test_name CLEANUP PHASE"
58 remove_share_test
59 if [ $err_rtn -ne 0 ]; then
60 # If cleanup fails, restore VM snapshot.
61 on_error "\n$test_name removal failed."
62 else
63 echo -e "\n$test_name removal completed successfully."
67 done
69 exit $all_errs