@@ -196,22 +196,40 @@ proc run_test_lang { test lang } {
196196 flush stdout
197197 set test_errors [run_test_app $test $cmd_file $log_file $lang ]
198198 if { [lindex $test_errors 0] == " ERROR" } {
199- puts " *ERROR* [ lrange $test_errors 1 end] "
200- append_failure $test
201- incr errors(error)
202-
203- # For some reason seg faults aren't echoed in the log - add them.
204- if { [file exists $log_file ] } {
205- set log_ch [open $log_file " a" ]
206- puts $log_ch " $test_errors "
207- close $log_ch
208- }
209-
210- # Report partial log diff anyway.
211- if { [file exists $ok_file ] } {
199+ # Special handling: allow tests with expected errors to pass
200+ # if their log matches the .ok file.
201+ set pass_crit [test_pass_criteria $test ]
202+ if { $pass_crit == " compare_logfile_allow_error" && [file exists $ok_file ] } {
203+ # Filter dos '/r's from log file to match normal compare behavior.
204+ set tmp_file [file join $result_dir $test .tmp]
205+ exec tr -d " \r " < $log_file > $tmp_file
206+ file rename -force $tmp_file $log_file
212207 # tclint-disable-next-line command-args
213- catch [concat exec diff $diff_options $ok_file $log_file \
214- >> $diff_file ]
208+ if { [catch [concat exec diff $diff_options $ok_file $log_file >> $diff_file ]] } {
209+ puts " *FAIL*"
210+ append_failure $test
211+ incr errors(fail)
212+ } else {
213+ puts " pass (expected error)"
214+ }
215+ } else {
216+ puts " *ERROR* [ lrange $test_errors 1 end] "
217+ append_failure $test
218+ incr errors(error)
219+
220+ # For some reason seg faults aren't echoed in the log - add them.
221+ if { [file exists $log_file ] } {
222+ set log_ch [open $log_file " a" ]
223+ puts $log_ch " $test_errors "
224+ close $log_ch
225+ }
226+
227+ # Report partial log diff anyway.
228+ if { [file exists $ok_file ] } {
229+ # tclint-disable-next-line command-args
230+ catch [concat exec diff $diff_options $ok_file $log_file \
231+ >> $diff_file ]
232+ }
215233 }
216234 } else {
217235 set error_msg " "
@@ -311,7 +329,7 @@ proc run_test_app { test cmd_file log_file lang } {
311329}
312330
313331proc run_test_plain { test cmd_file log_file lang } {
314- global app_path app_options result_dir errorCode
332+ global app_path app_options result_dir errorCode test_specific_options
315333
316334 if { ![file exists $app_path ] } {
317335 return " ERROR $app_path not found."
@@ -320,9 +338,14 @@ proc run_test_plain { test cmd_file log_file lang } {
320338 } else {
321339 set save_dir [pwd ]
322340 cd [file dirname $cmd_file ]
341+ # Get test-specific options if they exist
342+ set test_opts $app_options
343+ if { [info exists test_specific_options($test )] } {
344+ set test_opts [concat $test_specific_options($test) $app_options ]
345+ }
323346 # tclint-disable command-args
324347 if {
325- [catch [concat exec $app_path $app_options \
348+ [catch [concat exec $app_path $test_opts \
326349 [lang_flag $lang ] \
327350 -metrics [test_metrics_result_file $test $lang ] \
328351 [file tail $cmd_file ] >& $log_file ]]
@@ -351,16 +374,22 @@ proc run_test_plain { test cmd_file log_file lang } {
351374}
352375
353376proc run_test_valgrind { test cmd_file log_file lang } {
354- global app_path app_options valgrind_options result_dir errorCode
377+ global app_path app_options valgrind_options result_dir errorCode test_specific_options
355378
356379 set vg_cmd_file [test_valgrind_cmd_file $test $lang ]
357380 set vg_stream [open $vg_cmd_file " w" ]
358381 puts $vg_stream " cd [ file dirname $cmd_file ] "
359382 puts $vg_stream " source [ file tail $cmd_file ] "
360383 close $vg_stream
361384
385+ # Get test-specific options if they exist
386+ set test_opts $app_options
387+ if { [info exists test_specific_options($test )] } {
388+ set test_opts [concat $test_specific_options($test) $app_options ]
389+ }
390+
362391 set cmd [concat exec valgrind $valgrind_options \
363- $app_path [lang_flag $lang ] $app_options \
392+ $app_path [lang_flag $lang ] $test_opts \
364393 $vg_cmd_file >& $log_file ]
365394 set error_msg " "
366395 if { [catch { $cmd }] } {
0 commit comments