1# 2# Test various things using the masktest program 3# 4 5# Initialisation 6 7load_lib env-single.exp 8 9set timeout 10 10 11# Test each wildcard individually, then all together at once 12 13set testlist {{"abc" "<"} {"abc" ">"} {"abc" "\""} {"abc" "?"} {"abc" "*"} \ 14 {"abc" "."} {"abc" "<>\"?*."}} 15 16foreach { test } $testlist { 17 18 set got_output 0 19 set fail 0 20 21 # Spawn masktest 22 23 spawn bin/masktest //$server/$share -U $user -n 1000 -a \ 24 -f [lindex $test 0] -m [concat [lindex $test 0] [lindex $test 1]] 25 26 # Check output 27 28 while 1 { 29 expect { 30 -re "(...) (...) \[0-9\]+ mask=" { 31 if { $expect_out(1,string) != $expect_out(2,string) } { 32 fail "masktest [lindex $test 1]" 33 puts $expect_out(0,string); 34 set fail 1 35 break; 36 } else { 37 set got_output 1 38 } 39 } 40 eof { break } 41 } 42 } 43 44 # Produce result 45 46 set testname "[lindex $test 0] [lindex $test 1]" 47 48 if {$got_output} { 49 if {$fail} { 50 fail "masktest $testname" 51 } else { 52 pass "masktest $testname" 53 } 54 } else { 55 perror "no output seen for test $testname" 56 } 57} 58