Add ability to run a single unit test in docker

This commit is contained in:
mrg 2021-11-03 08:32:29 -07:00
parent f68ee76bc7
commit af67b738af
3 changed files with 61 additions and 8 deletions

View File

@ -145,14 +145,69 @@ macros:
.PHONY: macros
TEST_DIR = $(TOP_DIR)/compiler/tests
TEST_SRCS=$(sort $(notdir $(wildcard $(TEST_DIR)/*_test.py)))
TEST_DIRS=$(basename $(TEST_SRCS))
TEST_STAMPS=$(addsuffix .ok,$(TEST_DIRS))
TEST_BROKEN := \
sky130_sram_1kbyte_1r1w_8x1024_8 \
sky130_sram_1kbyte_1rw_32x256_8 \
sky130_sram_2kbyte_1rw_32x512_8 \
sky130_sram_4kbyte_1rw_32x1024_8 \
WORKING_TEST_STAMPS=$(filter-out $(addsuffix .ok, (TEST_BROKEN)), $(TEST_STAMPS))
$(TEST_DIRS):
@$(MAKE) --no-print-directory $@.ok
tests:
@echo "Running the following tests"
@for S in $(WORKING_TEST_STAMPS); do echo " - $$S"; done
@sleep 5
$(MAKE) $(WORKING_TEST_STAMPS)
.PHONY: tests
%.ok: compiler/tests/%.py
@echo "Testing $*"
@mkdir -p $*
docker run -v $(TOP_DIR):/openram \
-v $(SKY130_PDK):$(SKY130_PDK) \
-e PDK_ROOT=$(PDK_ROOT) \
-e OPENRAM_HOME=/openram/compiler \
-e OPENRAM_TECH=/openram/technology \
-e OPENRAM_TMP=/openram/$* \
--user $(UID):$(GID) \
vlsida/openram-ubuntu:latest \
python3 -u /openram/compiler/tests/$*.py -v -k && touch $@
.DELETE_ON_ERROR: $(TEST_STAMPS)
regress:
docker run -v $(TOP_DIR):/openram \
-e OPENRAM_HOME=/openram/compiler \
-e OPENRAM_TECH=/openram/technology \
vlsida/openram-ubuntu:latest \
sh -c "cd /openram/compiler/tests && ./regress.py -v -k"
.PHONY: tests
--user $(UID):$(GID) \
vlsida/openram-ubuntu:latest \
sh -c "python3 -u /openram/compiler/tests/regress.py"
.PHONY: regress
mount:
docker run -it -v $(TOP_DIR):/openram \
-v $(SKY130_PDK):$(SKY130_PDK) \
-e PDK_ROOT=$(PDK_ROOT) \
-e OPENRAM_HOME=/openram/compiler \
-e OPENRAM_TECH=/openram/technology \
--user $(UID):$(GID) \
vlsida/openram-ubuntu:latest
.PHONY: mount
testclean:
rm -rf $(TEST_STAMPS)
rm -rf $(TEST_DIRS)
rm *.zip
.PHONE: testclean
clean:
rm -rf $(SKY130_PDK)

View File

@ -2,9 +2,6 @@ MACRO_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
TOP_DIR := $(realpath $(MACRO_DIR)/..)
include $(TOP_DIR)/openram.mk
UID = $(shell id -u)
GID = $(shell id -g)
.DEFAULT_GOAL := all
SKY130_PDK ?= $(PDK_ROOT)/share/pdk/sky130A
@ -42,7 +39,7 @@ BROKEN := \
sky130_sram_2kbyte_1rw_32x512_8 \
sky130_sram_4kbyte_1rw_32x1024_8 \
WORKING_STAMPS=$(filter-out $(addsuffix .ok, (BROKEN)), $(STAMPS))
WORKING_STAMPS=$(filter-out $(addsuffix .ok, $(BROKEN)), $(STAMPS))
all: | configs
@echo
@ -73,7 +70,7 @@ mount:
-e OPENRAM_TECH=/openram/technology \
--user $(UID):$(GID) \
vlsida/openram-ubuntu:latest
.PHONY: macros
.PHONY: mount
.DELETE_ON_ERROR: $(STAMPS)

View File

@ -6,3 +6,4 @@ tech load SCN4M_SUBM.20 -noprompt
scalegrid 1 4
set GND gnd
set VDD vdd
set SUB gnd