blob: b41f072cc9148e7a90952f03bd7ec7656bba64cf (
plain)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
# every test should always be run and always return some status.
# so, if we lose sync with a multi-test program, aborted will be used
# to flag the remainder of the tests as untested.
#set aborted 0
# only match with color codes since "failed" / "OK" might otherwise
# be part of the output...
#set color 1
set config_h [open "../config.h" "r"]
set config_h_text [read $config_h]
close $config_h
set i [string first "#define HAVE_IPV6" $config_h_text]
if { $i >= 0 } {
set have_ipv6 1
} else {
set have_ipv6 0
}
send_user "IPv6 enabled: $have_ipv6\n"
set xfail 0
proc onesimple { test_name match } {
global verbose
global aborted
global testprefix
if { $aborted > 0 } {
untested "$testprefix$test_name"
return
}
if { $verbose > 0 } {
send_user "$testprefix$test_name$note\n"
}
expect {
"$match" { pass "$testprefix$test_name"; }
eof { fail "$testprefix$test_name"; set aborted 1; }
timeout { unresolved "$testprefix$test_name"; set aborted 1; }
}
}
proc onetest { test_name note start } {
global aborted
global testprefix
global verbose
global color
global xfail
if { $aborted > 0 } {
untested "$testprefix$test_name"
return
}
if { $verbose > 0 } {
send_user "$testprefix$test_name$note\n"
}
expect {
"$start" { }
eof { unresolved "$testprefix$test_name"; set aborted 1; }
timeout { unresolved "$testprefix$test_name"; set aborted 1; }
}
if { $aborted > 0 } {
send_user "sync failed: $testprefix$test_name$note -- $testprefix aborted!\n"
return
}
if { $color } {
set pat "(32mOK|31mfailed)"
} else {
set pat "(OK|failed)"
}
expect {
# need this because otherwise expect will skip over a "failed" and
# grab the next "OK" (or the other way around)
-re "$pat" {
if { "$expect_out(0,string)" == "32mOK" || "$expect_out(0,string)" == "OK" } {
pass "$testprefix$test_name"
} else {
if { $xfail } {
xfail "$testprefix$test_name"
} else {
fail "$testprefix$test_name"
}
}
return
}
eof { unresolved "$testprefix$test_name"; set aborted 1; }
timeout { unresolved "$testprefix$test_name"; set aborted 1; }
}
if { $aborted > 0 } {
send_user "failed: $testprefix$test_name$note -- $testprefix aborted!\n"
return
}
}
proc headerline { line } {
global aborted
if { $aborted > 0 } { return; }
expect {
$line { return; }
eof { send_user "numbering mismatch!\n"; set aborted 1; }
timeout { send_user "numbering mismatch!\n"; set aborted 1; }
}
}
proc simpletest { start } {
onetest "$start" "" "$start"
}
proc simpletest_nov6 { start } {
global have_ipv6
global xfail
set xfail [expr 1-$have_ipv6]
onetest "$start" "" "$start"
set xfail 0
}
|