Newer
Older
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
set lus2lic "./lus2lic"
proc should_work { test_name command_line args } {
global verbose
set cl [file tail $command_line]
set cl $command_line
set failed 0
# When verbose, tell the user what we are running
if { $verbose > 1 } {
send_user "starting $command_line\n"
}
# Running the program.
eval spawn $command_line {*}$args
expect {
# Check for any warning messages in the output first
Warning {
set failed 1
exp_continue
}
Error {
set failed 1
exp_continue
}
"error" {
set failed 1
exp_continue
}
"oops: an internal" {
set failed 1
exp_continue
}
# to avoid that match_max (the expect buffer size) is reached
# which truncate the outputs
"\n" {
exp_continue
}
eof {
if $failed {
fail "$test_name: $cl $args"
} else {
pass "$cl $args"
}
}
# Timeout requires inspection to determine the cause of failure.
timeout {
unresolved "Time out: $cl $args"
}
}
return $spawn_id
}
proc should_fail { test_name fail_kind command_line args } {
global verbose
set failed 0
set cl [file tail $command_line]
# When verbose, tell the user what we are running
if { $verbose > 1 } {
send_user "starting $cl\n"
}
# Running the program.
eval spawn $command_line {*}$args
expect {
"oops: an internal" {
expect eof
fail "$test_name ($fail_kind): $cl $args"
}
Error {
set failed 1
exp_continue
}
"\n" {
exp_continue
}
eof {
if $failed {
xfail "$test_name ($fail_kind): $cl $args"
} else {
xpass "$test_name ($fail_kind): $cl $args"
}
}
timeout {
unresolved "Time out $test_name ($fail_kind): $cl $args"
}
}
return $spawn_id
}
proc emptyfile {filename} {
set rc [catch {file size $filename} size]
return [expr {$rc == 0 && $size > 0}]
}