Improvements in tests/vloghtb
authorClifford Wolf <clifford@clifford.at>
Mon, 28 Jul 2014 07:15:40 +0000 (09:15 +0200)
committerClifford Wolf <clifford@clifford.at>
Mon, 28 Jul 2014 07:15:40 +0000 (09:15 +0200)
tests/vloghtb/common.sh
tests/vloghtb/test_mapopt.sh

index 3f7fc258dcd5fc1828c8ad8ccebb86af384c93ff..3965b04ca5876790801f18726c2af0e6948a0c86 100644 (file)
@@ -11,27 +11,28 @@ log_fail()
 test_autotest()
 {
        # Usage:
-       # test_autotest <test_name> <mod_name> <vlog_file> <autotest_cmd_line_options>
+       # test_autotest <test_name> <synth_script> <mod_name> <vlog_file>
 
        test_name="$1"
-       mod_name="$2"
-       vlog_file="$3"
-       shift 3
+       synth_cmd="$2"
+       mod_name="$3"
+       vlog_file="$4"
 
        mkdir -p log_test_$test_name
        rm -rf log_test_$test_name/$mod_name.*
 
-       cp $vlog_file log_test_$test_name/$mod_name.v
+       ../../yosys -q -l log_test_$test_name/$mod_name.out -o log_test_$test_name/$mod_name.v -p "$synth_cmd" "$vlog_file"
+       cat spec/${mod_name}_spec.v scripts/check.v >> log_test_$test_name/$mod_name.v
+       iverilog -o log_test_$test_name/$mod_name.bin -D"REFDAT_FN=\"refdat/${mod_name}_refdat.txt\"" log_test_$test_name/$mod_name.v
 
-       cd log_test_$test_name
-       if bash ../../tools/autotest.sh "$@" $mod_name.v > /dev/null 2>&1; then
-               mv $mod_name.out $mod_name.txt
+       if log_test_$test_name/$mod_name.bin 2>&1 | tee -a log_test_$test_name/$mod_name.out | grep -q '++OK++'; then
+               mv log_test_$test_name/$mod_name.out log_test_$test_name/$mod_name.txt
                log_pass test_$test_name $mod_name
        else
+               mv log_test_$test_name/$mod_name.out log_test_$test_name/$mod_name.err
                log_fail test_$test_name $mod_name
+               exit 1
        fi
-
-       cd ..
 }
 
 test_equiv()
index ba39adb31a30cb75b4d43d058960cbbf4052b2bb..61528c2b4fd145b9e8efa94b2d5ba953fd188bbb 100644 (file)
@@ -6,7 +6,12 @@ source common.sh
 f=$1
 n=$(basename ${f%.v})
 
+mkdir -p log_test_mapopt
+rm -f log_test_mapopt/$n.*
+
 test_equiv mapopt_1 "opt -fine; techmap; opt" "-set-def-inputs" $n $f
-test_autotest mapopt_2 $n $f -p "opt; techmap -extern; opt"
+test_autotest mapopt_2 "proc; opt; techmap; opt" $n $f
+
+tail -n20 log_test_mapopt_1/$n.txt log_test_mapopt_2/$n.txt > log_test_mapopt/$n.txt
 
 exit 0