OpenRAM/compiler/tests/Makefile

94 lines
2.9 KiB
Makefile
Raw Normal View History

TOP_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))../..)
include $(TOP_DIR)/openram.mk
2022-02-04 23:38:35 +01:00
.DEFAULT_GOAL := all
2022-02-04 23:38:35 +01:00
ARGS ?=
TECH ?= scn4m_subm
TECHS = scn4m_subm freepdk45
2022-02-07 20:27:10 +01:00
ALL_TECHS = scn4m_subm freepdk45 sky130
2022-02-04 23:38:35 +01:00
TEST_DIR = $(TOP_DIR)/compiler/tests
TEST_SRCS = $(sort $(notdir $(wildcard $(TEST_DIR)/*_test.py)))
TEST_BASES = $(basename $(TEST_SRCS))
TEST_STAMPS= $(addsuffix .ok,$(TEST_BASES))
2022-02-04 23:38:35 +01:00
OPENRAM_DIR = /openram/compiler/tests
RESULTS_DIR = $(OPENRAM_DIR)/results
TEST_BROKEN = \
50_riscv_1k_1rw1r_func_test.py \
50_riscv_1k_1rw_func_test.py \
50_riscv_1rw1r_func_test.py \
50_riscv_1rw1r_phys_test.py \
50_riscv_1rw_func_test.py \
50_riscv_1rw_phys_test.py \
50_riscv_2k_1rw1r_func_test.py \
50_riscv_2k_1rw_func_test.py \
50_riscv_4k_1rw1r_func_test.py \
50_riscv_4k_1rw_func_test.py \
50_riscv_512b_1rw1r_func_test.py \
50_riscv_512b_1rw_func_test.py \
50_riscv_8k_1rw1r_func_test.py \
50_riscv_8k_1rw_func_test.py
WORKING_TEST_STAMPS=$(filter-out $(addsuffix .ok, (TEST_BROKEN)), $(TEST_STAMPS))
2022-02-04 23:38:35 +01:00
gettech = $(word 1,$(subst /, ,$*))
getfile = $(word 2,$(subst /, ,$*))
WORKING_TECH_TEST_STAMPS=$(foreach T, $(TECHS),$(addprefix $T/,$(WORKING_TEST_STAMPS)))
2022-02-07 20:27:10 +01:00
# Run all technologies
2022-02-04 23:38:35 +01:00
all: $(WORKING_TECH_TEST_STAMPS)
2022-02-08 01:30:18 +01:00
@ls $(TOP_DIR)/compiler/tests/results/*/*.bad 1> /dev/null 2>&1 && echo "REGRESSION FAIL" && exit 1 || echo "REGRESSION PASS"
@echo "FAILING TESTS:"
@ls $(TOP_DIR)/compiler/tests/results/*/*.bad
2022-02-04 23:38:35 +01:00
.PHONY: all
2022-02-07 20:27:10 +01:00
# Run a given technology
# e.g. make freepdk45
$(ALL_TECHS):
@$(MAKE) --no-print-directory $(addprefix $@/,$(WORKING_TEST_STAMPS))
.PHONY: $(TECHS)
2022-02-04 23:38:35 +01:00
# Targets for each individual test
# e.g. make 04_pinv_1x_test
$(TEST_BASES):
@$(MAKE) --no-print-directory $(TECH)/$@.ok
.PHONY: $(TEST_BASES)
2022-02-04 23:38:35 +01:00
# To run a test in a given technology
%.ok:
# @echo "Running $(gettech) $(getfile) ... "
@mkdir -p results/$*/tmp
@docker run \
-v $(TOP_DIR):/openram \
-v $(FREEPDK45):/pdk/freepdk45\
-v $(PDK_ROOT):/pdk \
2022-02-04 23:38:35 +01:00
-v /etc/passwd:/etc/passwd:ro -v /etc/group:/etc/group:ro \
--user $(UID):$(GID) \
2022-02-04 23:38:35 +01:00
-e OPENRAM_TMP=$(OPENRAM_DIR)/results/$*/tmp \
vlsida/openram-ubuntu:latest \
2022-02-04 23:38:35 +01:00
sh -c ". /home/cad-user/.bashrc && python3 -u $(OPENRAM_DIR)/$(getfile).py \
-t $(gettech) -k $(ARGS) -p $(OPENRAM_DIR)/results/$* > $(OPENRAM_DIR)/results/$*.out 2>&1 && touch $(OPENRAM_DIR)/results/$*.ok || touch $(OPENRAM_DIR)/results/$*.bad"
2022-02-06 18:48:30 +01:00
@test -f $(TOP_DIR)/compiler/tests/results/$*.ok && echo "$* ... PASS!" && rm -rf $(TOP_DIR)/compiler/tests/results/$* || echo "$* ... FAIL!"
.DELETE_ON_ERROR: $(TEST_STAMPS)
2022-02-04 23:38:35 +01:00
# Mount environment for debug
2022-02-07 20:27:10 +01:00
#
mount:
docker run -it \
-v $(TOP_DIR):/openram \
-v $(FREEPDK45):/pdk/freepdk45 \
-v $(PDK_ROOT):/pdk \
2022-02-04 23:38:35 +01:00
-v /etc/passwd:/etc/passwd:ro -v /etc/group:/etc/group:ro \
--user $(UID):$(GID) \
vlsida/openram-ubuntu:latest
.PHONY: mount
clean:
2022-02-04 23:38:35 +01:00
@rm -rf $(TOP_DIR)/compiler/tests/results
.PHONE: clean