Params plugin: Return tcl error when test fails Signed-off-by: Tomasz Michalak <tmichalak@antmicro.com>
diff --git a/selection-plugin/tests/counter/counter.golden.txt b/selection-plugin/tests/counter/counter.golden.txt index e8183f0..7122e8b 100644 --- a/selection-plugin/tests/counter/counter.golden.txt +++ b/selection-plugin/tests/counter/counter.golden.txt
@@ -1,3 +1,3 @@ -1 -1 -1 +{middle/$add$counter.v:32$5} top/middle_inst_4 top/middle_inst_3 top/middle_inst_2 top/middle_inst_1 {top/$add$counter.v:14$2} top/ibuf_inst top/ibuf_proxy +{middle/$1\cnt[1:0]} {middle/$add$counter.v:32$5_Y} {middle/$0\cnt[1:0]} middle/clk_int middle/cnt middle/out middle/clk {top/$1\cnt[1:0]} {top/$add$counter.v:14$2_Y} {top/$0\cnt[1:0]} top/ibuf_out top/ibuf_proxy_out top/clk_int_2 top/clk_int_1 top/cnt top/out top/in top/clk2 top/clk +{middle/$1\cnt[1:0]} {middle/$add$counter.v:32$5_Y} {middle/$0\cnt[1:0]} middle/clk_int middle/cnt middle/out middle/clk {middle/$add$counter.v:32$5} {middle/$proc$counter.v:28$6} {middle/$proc$counter.v:31$4} {top/$1\cnt[1:0]} {top/$add$counter.v:14$2_Y} {top/$0\cnt[1:0]} top/ibuf_out top/ibuf_proxy_out top/clk_int_2 top/clk_int_1 top/cnt top/out top/in top/clk2 top/clk top/middle_inst_4 top/middle_inst_3 top/middle_inst_2 top/middle_inst_1 {top/$add$counter.v:14$2} top/ibuf_inst top/ibuf_proxy {top/$proc$counter.v:6$3} {top/$proc$counter.v:13$1}
diff --git a/selection-plugin/tests/counter/counter.tcl b/selection-plugin/tests/counter/counter.tcl index 1ec5c87..5475822 100644 --- a/selection-plugin/tests/counter/counter.tcl +++ b/selection-plugin/tests/counter/counter.tcl
@@ -4,9 +4,9 @@ # Import the commands from the plugins to the tcl interpreter yosys -import -proc selection_to_tcl_list_through_file { expression } { +proc selection_to_tcl_list_through_file { selection } { set file_name "[pid].txt" - select $expression -write $file_name + select $selection -write $file_name set fh [open $file_name r] set result [list] while {[gets $fh line] >= 0} { @@ -17,12 +17,14 @@ return $result } -proc test_selection { expression {debug 0} } { - if {$debug} { - puts "List from file: [selection_to_tcl_list_through_file $expression]" - puts "List in selection: [selection_to_tcl_list $expression]" +proc test_selection { rfh selection } { + if {[expr {[selection_to_tcl_list_through_file $selection] != [selection_to_tcl_list $selection]}]} { + puts "List from file: [selection_to_tcl_list_through_file $selection]" + puts "List in selection: [selection_to_tcl_list $selection]" + error "Test with selection: $selection failed" + } else { + puts $rfh [selection_to_tcl_list $selection] } - return [expr {[selection_to_tcl_list_through_file $expression] == [selection_to_tcl_list $expression]}] } read_verilog counter.v @@ -33,8 +35,9 @@ # Test the selection command and write results to file set rfh [open counter.txt w] -puts $rfh [test_selection "t:*"] -puts $rfh [test_selection "w:*"] -puts $rfh [test_selection "*"] +set selection_tests [list "t:*" "w:*" "*"] +foreach test $selection_tests { + test_selection $rfh $test +} close $rfh