Added tests/vloghtb/test_share.sh
authorClifford Wolf <clifford@clifford.at>
Sun, 20 Jul 2014 11:20:52 +0000 (13:20 +0200)
committerClifford Wolf <clifford@clifford.at>
Sun, 20 Jul 2014 13:33:05 +0000 (15:33 +0200)
tests/vloghtb/.gitignore
tests/vloghtb/common.sh [new file with mode: 0644]
tests/vloghtb/run-test.sh
tests/vloghtb/test_makefile [new file with mode: 0644]
tests/vloghtb/test_share.sh [new file with mode: 0644]

index da1ffa41d74089a2f960827a72002bffb80c3dc8..63db2fba3c658d3b8572effaecdc01e344507a3b 100644 (file)
@@ -5,3 +5,5 @@ scripts
 spec
 check_yosys
 vloghammer_tb.tar.bz2
+temp
+log_test_*
diff --git a/tests/vloghtb/common.sh b/tests/vloghtb/common.sh
new file mode 100644 (file)
index 0000000..dc8aec0
--- /dev/null
@@ -0,0 +1,7 @@
+log_pass() {
+       printf "%-15s %s %s %s\n" "$1" "$2" "`printf "%20s" "$2" | tr -d a-zA-Z0-9_ | tr ' ' .`" "pass."
+}
+
+log_fail() {
+       printf "%-15s %s %s %s\n" "$1" "$2" "`printf "%20s" "$2" | tr -d a-zA-Z0-9_ | tr ' ' .`" "FAIL."
+}
index 9bef4450266a75025f765616c18a50f8f931f694..6b3c265194b009e39319cb99b9b4e2edb03cd028 100755 (executable)
@@ -7,5 +7,6 @@ wget http://www.clifford.at/yosys/nogit/vloghammer_tb.tar.bz2
 tar --strip=1 -xjf vloghammer_tb.tar.bz2
 
 make clean
-make -j4 YOSYS_BIN=$PWD/../../yosys YOSYS_SCRIPT="proc;;" check_yosys
+make -j4 EXIT_ON_ERROR=1 YOSYS_BIN=$PWD/../../yosys YOSYS_SCRIPT="proc;;" check_yosys
+make -j4 -f test_makefile MODE=share
 
diff --git a/tests/vloghtb/test_makefile b/tests/vloghtb/test_makefile
new file mode 100644 (file)
index 0000000..174dbbc
--- /dev/null
@@ -0,0 +1,9 @@
+
+MODE := share
+TESTS := $(shell ls rtl/ | sed 's,\.v$$,,' )
+
+run: $(addprefix log_test_$(MODE)/,$(addsuffix .txt,$(TESTS)))
+
+log_test_$(MODE)/%.txt: rtl/%.v
+       @bash test_$(MODE).sh $<
+
diff --git a/tests/vloghtb/test_share.sh b/tests/vloghtb/test_share.sh
new file mode 100644 (file)
index 0000000..52b5a14
--- /dev/null
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+set -e
+mkdir -p log_test_share
+source common.sh
+
+f=$1
+n=$(basename ${f%.v})
+
+rm -f log_test_share/$n.txt
+rm -f log_test_share/$n.err
+
+if ! ../../yosys -q -l log_test_share/$n.out - 2> /dev/null <<- EOT
+       read_verilog $f
+       proc;;
+
+       copy $n gold
+       rename $n work
+
+       cd work
+       share -aggressive
+       cd ..
+
+       miter -equiv -ignore_gold_x -make_outputs -make_outcmp gold work miter
+       flatten miter
+       sat -verify -prove trigger 0 -show-inputs -show-outputs miter
+EOT
+then
+       log_fail test_share $n
+       mv log_test_share/$n.out log_test_share/$n.err
+       exit 1
+fi
+
+log_pass test_share $n
+mv log_test_share/$n.out log_test_share/$n.txt
+exit 0
+