File: masktest.exp

package info (click to toggle)
samba 2%3A3.2.5-4lenny15
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 124,704 kB
  • ctags: 69,181
  • sloc: ansic: 564,153; xml: 219,271; sh: 11,039; perl: 4,458; makefile: 4,301; python: 1,975; cpp: 1,224; exp: 1,147; yacc: 881; awk: 557; csh: 58; sed: 45
file content (57 lines) | stat: -rw-r--r-- 1,093 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#
# Test various things using the masktest program
#

# Initialisation

load_lib env-single.exp

set timeout 10

# Test each wildcard individually, then all together at once

set testlist {{"abc" "<"} {"abc" ">"} {"abc" "\""} {"abc" "?"} {"abc" "*"} \
	{"abc" "."} {"abc" "<>\"?*."}}

foreach { test } $testlist {

    set got_output 0
    set fail 0

    # Spawn masktest

    spawn bin/masktest //$server/$share -U $user -n 1000 -a \
	    -f [lindex $test 0] -m [concat [lindex $test 0] [lindex $test 1]]
    
    # Check output

    while 1 {
	expect {
	    -re "(...) (...) \[0-9\]+ mask=" { 
		if { $expect_out(1,string) != $expect_out(2,string) } {
		    fail "masktest [lindex $test 1]"
		    puts $expect_out(0,string);
		    set fail 1
		    break;
		} else {
		    set got_output 1
		}
	    }
	    eof    { break }
	}
    }

    # Produce result

    set testname "[lindex $test 0] [lindex $test 1]"
    
    if {$got_output} {
	if {$fail} { 
	    fail "masktest $testname"
	} else {
	    pass "masktest $testname"
	}
    } else {
	perror "no output seen for test $testname"
    }
}