Newer
Older
set lus2lic "./lus2lic"
Erwan Jahier
committed
set ec2c "./ec2c"
set test_lus2lic_no_node "../utils/test_lus2lic_no_node"
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
}
"ec program must contain a single node" {
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
}
Erwan Jahier
committed
"undeclared ident" {
set failed 1
exp_continue
}
Erwan Jahier
committed
"segmentation fault" {
set failed 1
exp_continue
}
Erwan Jahier
committed
"lurettetop ok" {
Erwan Jahier
committed
pass "$cl $args"
}
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
# 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"