XDC: Add verification step to tests

Signed-off-by: Tomasz Michalak <tmichalak@antmicro.com>
diff --git a/xdc-plugin/tests/Makefile b/xdc-plugin/tests/Makefile
index 080f134..89b2fb8 100644
--- a/xdc-plugin/tests/Makefile
+++ b/xdc-plugin/tests/Makefile
@@ -1,11 +1,16 @@
 TESTS = counter \
-	port_indexes #Bus port indexes passed without curly braces 
+	port_indexes #Bus port indexes passed without curly braces
+
+counter_verify = $(call compare_json, counter)
+port_indexes_verify = $(call compare_json, port_indexes) && test $$(grep "'unknown' proc command handler" port_indexes.txt | wc -l) -eq 2
 
 all: $(TESTS)
 
+compare_json = python compare_output_json.py --json $(1).json --golden $(1)_golden.json
+
 define test_tpl =
 $(1): $(1).json
-	@python compare_output_json.py --json $$< --golden $(1)_golden.json; \
+	$$($(1)_verify);
 	RETVAL=$$$$? ; \
 	if [ $$$$RETVAL -eq 0 ]; then \
 		echo "$(1) PASS"; \
diff --git a/xdc-plugin/tests/port_indexes.tcl b/xdc-plugin/tests/port_indexes.tcl
index 17d3b9e..ac05de3 100644
--- a/xdc-plugin/tests/port_indexes.tcl
+++ b/xdc-plugin/tests/port_indexes.tcl
@@ -10,16 +10,24 @@
 if {[info procs unknown] != ""} {
 	rename unknown ""
 }
-proc unknown args {puts "'unknown' proc command handler"}
-if {[catch {invalid command}]} {
+proc unknown args {return "'unknown' proc command handler"}
+set fp [open "port_indexes.txt" "w"]
+if {[catch {invalid command} result]} {
+	close $fp
 	error "Command should be handled by the 'unknown' proc"
+} else {
+	puts $fp $result
 }
 #Read the design constraints
 read_xdc -part_json $::env(PART_JSON) $::env(INPUT_XDC_FILE)
 
-if {[catch {invalid command}]} {
+if {[catch {invalid command} result]} {
+	close $fp
 	error "Command should be handled by the 'unknown' proc"
+} else {
+	puts $fp $result
 }
+close $fp
 
 # Write the design in JSON format.
 write_json $::env(OUT_JSON)