1 # An expect script to create a temporary file
, map a share
, copy the file to the share
,
2 # and compare the contents of the two files.
3 # Copyright Brad Henry
<brad@samba.org
> 2006
4 # Released under the GNU GPL version
3 or later.
6 proc run_test
{ remote_prompt tmp_filename share_drive host_drive buildhost_ip buildhost_share username domain password
} {
8 # Create the temp file
on the windows host and
connect to the samba share.
9 set host_tmpfile
"$host_drive\\$tmp_filename"
10 set err_str
[create_tmp_file $remote_prompt $host_tmpfile
]
11 if { $err_str
!= "OK" } {
15 set buildhost_sharepoint
"\\\\$buildhost_ip\\$buildhost_share"
16 set err_str
[map_share $remote_prompt $share_drive $buildhost_sharepoint $username $domain $password
]
17 if { $err_str
!= "OK" } {
21 # Copy the temp file to the share and compare its contents with the original.
22 set share_tmpfile
"$share_drive\\$tmp_filename"
24 set err_str
[xcopy_file $remote_prompt $host_tmpfile $share_tmpfile $xcopy_options
]
25 if { $err_str
!= "OK" } {
29 set err_str
[compare_files $remote_prompt $host_tmpfile $share_tmpfile
]
30 if { $err_str
!= "OK" } {
34 # Remove files and unmap share.
35 set err_str
[delete_file $remote_prompt $share_tmpfile
]
36 if { $err_str
!= "OK" } {
39 set err_str
[delete_file $remote_prompt $host_tmpfile
]
40 if { $err_str
!= "OK" } {
44 set err_str
[unmap_share $remote_prompt $share_drive
]
45 if {$err_str
!= "OK" } {
53 set remote_prompt $env
(SMBTORTURE_REMOTE_PROMPT
)
54 set remote_host $env
(SMBTORTURE_REMOTE_HOST
)
55 set username $env
(SMBTORTURE_USERNAME
)
56 set password $env
(SMBTORTURE_PASSWORD
)
57 set timeout $env
(SMBTORTURE_EXPECT_TIMEOUT
)
59 set tmp_filename $env
(SMBTORTURE_TMP_FILENAME
)
61 set share_drive $env
(SMBTORTURE_REMOTE_DRIVE_LETTER
)
62 set host_drive
"%HOMEDRIVE%"
64 set buildhost_ip $env
(SMBTORTURE_LOCAL_IP
)
65 set buildhost_share $env
(SMBTORTURE_LOCAL_SHARE_NAME
)
66 set buildhost_username $env
(SMBTORTURE_LOCAL_USERNAME
)
67 set buildhost_domain $env
(SMBTORTURE_LOCAL_DOMAIN
)
68 set buildhost_password $env
(SMBTORTURE_LOCAL_PASSWORD
)
70 set err_val
[spawn $env
(SHELL)]
72 puts stderr
"Expect failed while spawning a shell process."
76 set err_str
[telnet_login $remote_prompt $remote_host $username $password
]
77 if {$err_str
!= "OK"} {
78 puts stderr
"\nFunction telnet_login failed during Samba server testing."
79 puts stderr
"Error was: $err_str."
83 set err_str
[run_test $remote_prompt $tmp_filename $share_drive $host_drive $buildhost_ip $buildhost_share $buildhost_username $buildhost_domain $buildhost_password
]
84 if {$err_str
!= "OK"} {
85 puts stderr
"\nFunction run_test failed during Samba server testing."
86 puts stderr
"Error was: $err_str."
88 #
Log off from the telnet server.
93 #
Log off from the telnet server.