messaging3: Remove use of full_path_tos()
[Samba.git] / source4 / selftest / win / wintest_remove.exp
blob36dc4a7d24e4a7c1eae7cfd4fca9d297643ddbbc
1 # An expect script to remove a directory and share which was
2 # previously setup for an smbtorture test.
3 # Copyright Brad Henry <brad@samba.org> 2006
4 # Released under the GNU GPL version 3 or later.
6 proc remove_test { remote_prompt sharepath sharename hosts_file_path \
7 backup_hosts_filename } {
9 set err_str [delete_share $remote_prompt $sharename]
10 if { $err_str != "OK" } {
11 puts stderr "Error in function delete_share: $err_str."
12 puts stderr "Function remove_test will continue."
15 set err_str [delete_directory $remote_prompt $sharepath]
16 if { $err_str != "OK" } {
17 puts stderr "Error in function delete_directory: $err_str."
18 puts stderr "Function remove_test will continue."
21 # Overwrite the current hosts file with the backup we made during setup.
22 set err_str [delete_hosts_entry $remote_prompt $hosts_file_path \
23 $backup_hosts_filename]
24 if { $err_str != "OK" } {
25 puts stderr "Error in function delete_hosts_entry: $err_str."
26 puts stderr "Function remove_test will continue."
28 return $err_str
31 # read parameters
32 set remote_host $env(SMBTORTURE_REMOTE_HOST)
33 set remote_prompt $env(SMBTORTURE_REMOTE_PROMPT)
35 set username $env(SMBTORTURE_USERNAME)
36 set password $env(SMBTORTURE_PASSWORD)
38 set timeout $env(SMBTORTURE_EXPECT_TIMEOUT)
40 set sharepath $env(SMBTORTURE_REMOTE_SHARE_PATH)
41 set sharename $env(SMBTORTURE_REMOTE_SHARE_NAME)
43 set backup_hosts_filename $env(REMOTE_BACKUP_HOSTS_FILENAME)
44 set hosts_file_path $env(REMOTE_HOSTS_FILE_PATH)
46 set err_val [spawn $env(SHELL)]
47 if {$err_val == 0} {
48 puts stderr "Expect failed while spawning a shell process."
49 exit $err_val
52 set err_str [telnet_login $remote_prompt $remote_host $username $password]
53 if {$err_str != "OK"} {
54 puts stderr "\nFunction telnet_login failed during cleanup."
55 puts stderr "Error was: $err_str."
56 exit 1
59 set err_str [remove_test $remote_prompt $sharepath $sharename \
60 $hosts_file_path $backup_hosts_filename]
61 if {$err_str != "OK"} {
62 puts stderr "\nFunction remove_test failed."
63 puts stderr "Error was: $err_str."
64 # Log off from the telnet server.
65 send "exit\r\n"
66 exit 1
69 # Log off from the telnet server.
70 send "exit\r\n"
71 exit 0