Fix parallel option for Makefile tests

This commit is contained in:
mrg 2022-02-04 15:03:53 -08:00
parent 1a6cb91608
commit a56d1f62ee
1 changed files with 15 additions and 11 deletions

View File

@ -5,7 +5,7 @@ include $(TOP_DIR)/openram.mk
ARGS ?= ARGS ?=
TECH ?= scn4m_subm TECH ?= scn4m_subm
TECHS := scn4m_subm freepdk45 TECHS = scn4m_subm freepdk45
# sky130 # sky130
TEST_DIR = $(TOP_DIR)/compiler/tests TEST_DIR = $(TOP_DIR)/compiler/tests
@ -13,10 +13,10 @@ TEST_SRCS = $(sort $(notdir $(wildcard $(TEST_DIR)/*_test.py)))
TEST_BASES = $(basename $(TEST_SRCS)) TEST_BASES = $(basename $(TEST_SRCS))
TEST_STAMPS= $(addsuffix .ok,$(TEST_BASES)) TEST_STAMPS= $(addsuffix .ok,$(TEST_BASES))
OPENRAM_DIR := /openram/compiler/tests OPENRAM_DIR = /openram/compiler/tests
RESULTS_DIR := $(OPENRAM_DIR)/results RESULTS_DIR = $(OPENRAM_DIR)/results
TEST_BROKEN := \ TEST_BROKEN = \
50_riscv_1k_1rw1r_func_test.py \ 50_riscv_1k_1rw1r_func_test.py \
50_riscv_1k_1rw_func_test.py \ 50_riscv_1k_1rw_func_test.py \
50_riscv_1rw1r_func_test.py \ 50_riscv_1rw1r_func_test.py \
@ -36,18 +36,19 @@ TEST_BROKEN := \
WORKING_TEST_STAMPS=$(filter-out $(addsuffix .ok, (TEST_BROKEN)), $(TEST_STAMPS)) WORKING_TEST_STAMPS=$(filter-out $(addsuffix .ok, (TEST_BROKEN)), $(TEST_STAMPS))
$(TEST_BASES):
@$(MAKE) --no-print-directory $@.ok
gettech = $(word 1,$(subst /, ,$*)) gettech = $(word 1,$(subst /, ,$*))
getfile = $(word 2,$(subst /, ,$*)) getfile = $(word 2,$(subst /, ,$*))
WORKING_TECH_TEST_STAMPS=$(foreach T, $(TECHS),$(addprefix $T/,$(WORKING_TEST_STAMPS))) WORKING_TECH_TEST_STAMPS=$(foreach T, $(TECHS),$(addprefix $T/,$(WORKING_TEST_STAMPS)))
all: $(WORKING_TECH_TEST_STAMPS) all: $(WORKING_TECH_TEST_STAMPS)
.PHONY: all
# To run individual tests # Targets for each individual test
%.ok: %.py # e.g. make 04_pinv_1x_test
@$(MAKE) --no-print-directory $(TECH)/$*.ok $(TEST_BASES):
# @echo "Running $(TECH) $@ ... "
@$(MAKE) --no-print-directory $(TECH)/$@.ok
.PHONY: $(TEST_BASES)
# To run a test in a given technology # To run a test in a given technology
%.ok: %.ok:
@ -64,6 +65,8 @@ all: $(WORKING_TECH_TEST_STAMPS)
@test -f $(TOP_DIR)/compiler/tests/results/$*.ok && echo "$* ... PASS!" || echo "$* ... FAIL!" @test -f $(TOP_DIR)/compiler/tests/results/$*.ok && echo "$* ... PASS!" || echo "$* ... FAIL!"
.DELETE_ON_ERROR: $(TEST_STAMPS) .DELETE_ON_ERROR: $(TEST_STAMPS)
# This would use the regress.py script to run in parallel instead of
# the Makefile.
#$(TECHS): #$(TECHS):
# @echo "Running $*" # @echo "Running $*"
# docker run \ # docker run \
@ -78,6 +81,7 @@ all: $(WORKING_TECH_TEST_STAMPS)
#regress: $(TECHS) #regress: $(TECHS)
#.PHONY: regress #.PHONY: regress
# Mount environment for debug
mount: mount:
docker run -it \ docker run -it \
-v $(TOP_DIR):/openram \ -v $(TOP_DIR):/openram \