Added "make -j{N}" support to "make test"
authorClifford Wolf <clifford@clifford.at>
Wed, 30 Jul 2014 17:21:52 +0000 (19:21 +0200)
committerClifford Wolf <clifford@clifford.at>
Wed, 30 Jul 2014 17:23:26 +0000 (19:23 +0200)
Makefile
tests/asicworld/run-test.sh
tests/hana/run-test.sh
tests/simple/run-test.sh
tests/tools/autotest.mk [new file with mode: 0644]
tests/tools/autotest.sh
tests/vloghtb/run-test.sh

index 73d448337b720818a487713b9709a72173b66b5f..4436be3def4f692abf8f50415a17666220b39492 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -218,15 +218,15 @@ yosys-abc: abc/abc-$(ABCREV)
        $(P) cp abc/abc-$(ABCREV) yosys-abc
 
 test: $(TARGETS) $(EXTRA_TARGETS)
-       cd tests/simple && bash run-test.sh
-       cd tests/hana && bash run-test.sh
-       cd tests/asicworld && bash run-test.sh
-       cd tests/realmath && bash run-test.sh
-       cd tests/share && bash run-test.sh
-       cd tests/techmap && bash run-test.sh
-       cd tests/memories && bash run-test.sh
-       cd tests/various && bash run-test.sh
-       cd tests/sat && bash run-test.sh
+       +cd tests/simple && bash run-test.sh
+       +cd tests/hana && bash run-test.sh
+       +cd tests/asicworld && bash run-test.sh
+       +cd tests/realmath && bash run-test.sh
+       +cd tests/share && bash run-test.sh
+       +cd tests/techmap && bash run-test.sh
+       +cd tests/memories && bash run-test.sh
+       +cd tests/various && bash run-test.sh
+       +cd tests/sat && bash run-test.sh
        @echo ""
        @echo "  Passed \"make test\"."
        @echo ""
@@ -240,7 +240,7 @@ vgtest: $(TARGETS) $(EXTRA_TARGETS)
        @echo ""
 
 vloghtb: $(TARGETS) $(EXTRA_TARGETS)
-       cd tests/vloghtb && bash run-test.sh
+       +cd tests/vloghtb && bash run-test.sh
        @echo ""
        @echo "  Passed \"make vloghtb\"."
        @echo ""
index a204360d73f00deb9fc52d614ef749c761527e41..2477181a65d9d239c4c61244d8b9bc7a0c879fd6 100755 (executable)
@@ -1,2 +1,2 @@
 #!/bin/bash
-exec bash ../tools/autotest.sh -G *.v
+exec ${MAKE:-make} -f ../tools/autotest.mk *.v
index 89be6d0524fb16419dddcfc857fff65752d4aaf8..410f9b4d77558e6fea63a2c9f6911d51a33348c0 100755 (executable)
@@ -1,2 +1,2 @@
 #!/bin/bash
-exec bash ../tools/autotest.sh -G -l hana_vlib.v test_*.v
+exec ${MAKE:-make} -f ../tools/autotest.mk EXTRA_FLAGS="-l hana_vlib.v" test_*.v
index ec1802cbd9e84d806223e31315b21988dc7235ea..6531d51ae44558680c1b38a275724435dd8aea57 100755 (executable)
@@ -6,4 +6,4 @@ if ! which iverilog > /dev/null ; then
   exit 1
 fi
 
-exec bash ../tools/autotest.sh -G *.v
+exec ${MAKE:-make} -f ../tools/autotest.mk *.v
diff --git a/tests/tools/autotest.mk b/tests/tools/autotest.mk
new file mode 100644 (file)
index 0000000..f65002c
--- /dev/null
@@ -0,0 +1,8 @@
+
+EXTRA_FLAGS=
+
+$(MAKECMDGOALS):
+       @$(basename $(MAKEFILE_LIST)).sh -G -j $(EXTRA_FLAGS) $@
+
+.PHONY: $(MAKECMDGOALS)
+
index 1130bbb706d691fff5d118d624dd059af3cf1075..781dc16713b77be3922446ea67caca91d9a6d880 100755 (executable)
@@ -6,6 +6,7 @@ use_xsim=false
 use_modelsim=false
 verbose=false
 keeprunning=false
+makejmode=false
 frontend="verilog"
 backend_opts="-noattr -noexpr"
 scriptfiles=""
@@ -17,7 +18,7 @@ if [ ! -f $toolsdir/cmp_tbdata -o $toolsdir/cmp_tbdata.c -nt $toolsdir/cmp_tbdat
        ( set -ex;  gcc -Wall -o $toolsdir/cmp_tbdata $toolsdir/cmp_tbdata.c; ) || exit 1
 fi
 
-while getopts xmGl:wkvrf:s:p: opt; do
+while getopts xmGl:wkjvrf:s:p: opt; do
        case "$opt" in
                x)
                        use_xsim=true ;;
@@ -31,6 +32,8 @@ while getopts xmGl:wkvrf:s:p: opt; do
                        genvcd=true ;;
                k)
                        keeprunning=true ;;
+               j)
+                       makejmode=true ;;
                v)
                        verbose=true ;;
                r)
@@ -43,7 +46,7 @@ while getopts xmGl:wkvrf:s:p: opt; do
                p)
                        scriptopt="$OPTARG" ;;
                *)
-                       echo "Usage: $0 [-x|-m] [-w] [-k] [-v] [-r] [-l libs] [-f frontend] [-s script] [-p cmdstring] verilog-files\n" >&2
+                       echo "Usage: $0 [-x|-m] [-w] [-k] [-j] [-v] [-r] [-l libs] [-f frontend] [-s script] [-p cmdstring] verilog-files\n" >&2
                        exit 1
        esac
 done
@@ -83,7 +86,13 @@ do
                exit 1
        fi
        [[ "$bn" == *_tb ]] && continue
-       echo -n "Test: $bn "
+
+       if $makejmode; then
+               status_prefix="Test: $bn "
+       else
+               status_prefix=""
+               echo -n "Test: $bn "
+       fi
 
        rm -f ${bn}.{err,log,sikp}
        mkdir -p ${bn}.out
@@ -144,12 +153,12 @@ do
 
        if [ -f ${bn}.log ]; then
                mv ${bn}.err ${bn}.log
-               echo "-> ok"
+               echo "${status_prefix}-> ok"
        elif [ -f ${bn}.skip ]; then
                mv ${bn}.err ${bn}.skip
-               echo "-> skip"
+               echo "${status_prefix}-> skip"
        else
-               echo "-> ERROR!"
+               echo "${status_prefix}-> ERROR!"
                if $warn_iverilog_git; then
                        echo "Note: Make sure that 'iverilog' is an up-to-date git checkout of icarus verilog."
                fi
index b1b205a226e0e3b2c47176890e0223cfecdb9746..ad99226e7c484013004419a94a0f4607e003b584 100755 (executable)
@@ -9,7 +9,7 @@ tar --strip=1 -xjf vloghammer_tb.tar.bz2
 make clean
 rm -rf log_test_*
 
-make -j4 EXIT_ON_ERROR=1 YOSYS_BIN=$PWD/../../yosys YOSYS_SCRIPT="proc;;" check_yosys
-make -j4 -f test_makefile MODE=share
-make -j4 -f test_makefile MODE=mapopt
+${MAKE:-make} EXIT_ON_ERROR=1 YOSYS_BIN=$PWD/../../yosys YOSYS_SCRIPT="proc;;" check_yosys
+${MAKE:-make} -f test_makefile MODE=share
+${MAKE:-make} -f test_makefile MODE=mapopt