Skip to content

Commit 2e4030b

Browse files
nanavatiquark17
authored andcommitted
Reorganize bluetcl test procs so you can test BSV and BH syntax output
(together or separately)
1 parent 91dacd5 commit 2e4030b

File tree

1 file changed

+75
-24
lines changed

1 file changed

+75
-24
lines changed

testsuite/config/bluetcl.tcl

Lines changed: 75 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ proc bluetcl_exec { cmdline outname } {
4343
set output [make_bluetcl_output_name $outname]
4444
set cmd "$bluetcl $cmdline >& $output"
4545
verbose "Executing: $cmd" 4
46-
set status [exec_with_log "run_bluetcl" $cmd 2]
46+
set status [exec_with_log "bluetcl_exec" $cmd 2]
4747
cd $here
4848
return [expr $status == 0]
4949
}
@@ -81,8 +81,17 @@ proc make_bluetcl_bh_output_name { source } {
8181
return $filename
8282
}
8383

84+
85+
# For historical reasons, we do not tag BSV syntax output with -bsv
86+
# the way we tag BH syntax output with -bh
87+
proc make_bluetcl_bsv_output_name { source } {
88+
89+
return [make_bluetcl_output_name $source]
90+
91+
}
92+
8493
# worker bee
85-
proc run_bluetcl { source } {
94+
proc run_bluetcl_bsv { source } {
8695
global bluetcl
8796
global srcdir
8897
global subdir
@@ -91,10 +100,10 @@ proc run_bluetcl { source } {
91100

92101
set here [absolute $srcdir]
93102
cd [file join $here $subdir]
94-
set output [make_bluetcl_output_name $source]
103+
set output [make_bluetcl_bsv_output_name $source]
95104
set cmd "$bluetcl $source >& $output"
96105
verbose "Executing: $cmd" 4
97-
set status [exec_with_log "run_bluetcl" $cmd 2]
106+
set status [exec_with_log "run_bluetcl_bsv" $cmd 2]
98107
cd $here
99108
return [expr $status == 0]
100109
}
@@ -118,59 +127,101 @@ proc run_bluetcl_bh { source } {
118127
return [expr $status == 0]
119128
}
120129

121-
# Do a bluetcl run, and report status
122-
proc bluetcl_pass { source } {
130+
# Do a bluetcl run (BSV syntax) and report status
131+
proc bluetcl_bsv_pass { source } {
123132
global xfail_flag
124133

125134
set current_xfail $xfail_flag
126135

127-
incr_stat "bluetcl_pass"
136+
incr_stat "bluetcl_bsv_pass"
128137

129-
if [run_bluetcl $source] then {
130-
pass "`$source' executes"
138+
if [run_bluetcl_bsv $source] then {
139+
pass "`$source' executes with BSV syntax"
131140
} else {
132-
fail "`$source' should execute"
141+
fail "`$source' should execute with BSV syntax"
133142
}
143+
}
144+
145+
# Do a bluetcl run (BH syntax) and report status
146+
proc bluetcl_bh_pass { source } {
147+
global xfail_flag
148+
149+
set current_xfail $xfail_flag
150+
151+
incr_stat "bluetcl_bh_pass"
134152

135153
if [run_bluetcl_bh $source] then {
136-
pass "`$source' executes with Bluespec Haskell syntax"
154+
pass "`$source' executes with BH syntax"
137155
} else {
138-
fail "`$source' should execute with Bluespec Haskell syntax"
156+
fail "`$source' should execute with BH syntax"
139157
}
158+
}
140159

160+
# Do bluetcl runs and report status (both syntaxes)
161+
proc bluetcl_pass { source } {
162+
bluetcl_bsv_pass $source
163+
bluetcl_bh_pass $source
141164
}
142165

143-
# DO run and compare output
144-
proc bluetcl_run_compare_pass { source {expected ""} {expected_bh ""} {sedfilter ""} } {
166+
# Do bluetcl run and compare output (BSV syntax)
167+
proc bluetcl_run_bsv_compare_pass { source {expected ""} {sedfilter ""} } {
168+
169+
bluetcl_bsv_pass $source
170+
171+
set output [make_bluetcl_bsv_output_name $source]
145172

146-
bluetcl_pass $source
173+
bluetcl_compare $output $expected $sedfilter
174+
175+
}
176+
177+
# Do bluetcl run and compare output (BH syntax)
178+
proc bluetcl_run_bh_compare_pass { source {expected ""} {sedfilter ""} } {
179+
180+
bluetcl_bh_pass $source
147181

148-
set output [make_bluetcl_output_name $source]
182+
set output [make_bluetcl_bh_output_name $source]
149183

150184
bluetcl_compare $output $expected $sedfilter
151185

152-
set output_bh [make_bluetcl_bh_output_name $source]
186+
}
187+
188+
# Do bluetcl runs and compare output (both syntaxes)
189+
proc bluetcl_run_compare_pass { source {expected_bsv ""} {expected_bh ""} {sedfilter ""} } {
190+
191+
bluetcl_run_bsv_compare_pass $source $expected_bsv $sedfilter
192+
193+
bluetcl_run_bh_compare_pass $source $expected_bh $sedfilter
153194

154-
bluetcl_compare $output_bh $expected_bh $sedfilter
155195
}
156196

157-
# DO run and compare output (does not match because of known bug)
158-
proc bluetcl_run_compare_pass_bug { source {expected ""} {expected_bh "" } {sedfilter ""} {bug ""} } {
197+
# Do bluetcl run and compare output (BSV syntax, does not match because of known bug)
198+
proc bluetcl_run_bsv_compare_pass_bug { source {expected ""} {sedfilter ""} {bug ""} } {
159199

160200
global env
161201
global target_triplet
162202

163-
bluetcl_pass $source
203+
bluetcl_bsv_pass $source
164204

165-
set output [make_bluetcl_output_name $source]
205+
set output [make_bluetcl_bsv_output_name $source]
166206

167207
setup_xfail $target_triplet $bug
168208
bluetcl_compare $output $expected $sedfilter
169209

170-
set output_bh [make_bluetcl_bh_output_name $source]
210+
}
211+
212+
# Do bluetcl run and compare output (BH syntax, does not match because of known bug)
213+
proc bluetcl_run_bh_compare_pass_bug { source {expected ""} {sedfilter ""} {bug ""} } {
214+
215+
global env
216+
global target_triplet
217+
218+
bluetcl_bh_pass $source
219+
220+
set output [make_bluetcl_bh_output_name $source]
171221

172222
setup_xfail $target_triplet $bug
173-
bluetcl_compare $output_bh $expected_bh $sedfilter
223+
bluetcl_compare $output $expected $sedfilter
224+
174225
}
175226

176227
# RUN bluetcl with options specifying outfile (can be a module rather than tclfile

0 commit comments

Comments
 (0)