Skip to content

Commit

Permalink
Move tests to their own directory, out/run/tests
Browse files Browse the repository at this point in the history
Make it easier to find the coverage / regr.log file
  • Loading branch information
hcallahan-lowrisc committed Nov 2, 2022
1 parent 78bdc9b commit 9086afe
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
15 changes: 8 additions & 7 deletions dv/uvm/core_ibex/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ OUT := out
OUT-DIR := $(dir $(OUT)/)
BUILD-DIR := $(OUT-DIR)build
RUN-DIR := $(OUT-DIR)run
TESTS-DIR := $(RUN-DIR)/tests
METADATA-DIR = $(OUT-DIR)metadata

# This is a list of directories that are automatically generated by some
Expand Down Expand Up @@ -143,7 +144,7 @@ testvar := $(call get-meta,"ibex_root")
tests-and-seeds := $(shell env PYTHONPATH=$(PYTHONPATH) python3 ./scripts/metadata.py \
--op "tests_and_seeds" \
--dir-metadata $(METADATA-DIR) $(new-metadata-file))
ts-dirs = $(foreach ts,$(tests-and-seeds),$(RUN-DIR)/$(ts)/)
ts-dirs = $(foreach ts,$(tests-and-seeds),$(TESTS-DIR)/$(ts)/)
test-asms = $(addsuffix test.S,$(ts-dirs))
test-bins = $(addsuffix test.bin,$(ts-dirs))
rtl-sim-logs = $(addsuffix $(rtl-sim-logfile),$(ts-dirs))
Expand Down Expand Up @@ -282,7 +283,7 @@ $(METADATA-DIR)/instr.gen.build.stamp: \
#

$(test-asms): \
$(RUN-DIR)/%/test.S: \
$(TESTS-DIR)/%/test.S: \
$(INSTR-GEN-BUILD-STAMP) $(TESTLIST) scripts/run_instr_gen.py
@echo Running randomized test generator to create assembly file $@
$(verb)env PYTHONPATH=$(PYTHONPATH) \
Expand All @@ -302,7 +303,7 @@ $(test-asms): \
# both.

$(test-bins): \
$(RUN-DIR)/%/test.bin: $(RUN-DIR)/%/test.S \
$(TESTS-DIR)/%/test.bin: $(TESTS-DIR)/%/test.S \
scripts/compile_generated_test.py
@echo Compiling generated test assembly to create binary at $@
$(verb)env PYTHONPATH=$(PYTHONPATH) \
Expand Down Expand Up @@ -336,8 +337,8 @@ $(METADATA-DIR)/tb.compile.stamp: \
# Run ibex RTL simulation with randomly-generated program and uvm stimulus

$(rtl-sim-logs): \
$(RUN-DIR)/%/$(rtl-sim-logfile): \
$(TB-COMPILE-STAMP) $(RUN-DIR)/%/test.bin scripts/run_rtl.py
$(TESTS-DIR)/%/$(rtl-sim-logfile): \
$(TB-COMPILE-STAMP) $(TESTS-DIR)/%/test.bin scripts/run_rtl.py
@echo Running RTL simulation at $(@D)
$(verb)env PYTHONPATH=$(PYTHONPATH) \
scripts/run_rtl.py \
Expand All @@ -348,8 +349,8 @@ $(rtl-sim-logs): \
# Gather RTL sim results, and parse logs for errors

$(comp-results): \
$(RUN-DIR)/%/trr.yaml: \
$(RUN-DIR)/%/$(rtl-sim-logfile) scripts/check_logs.py
$(TESTS-DIR)/%/trr.yaml: \
$(TESTS-DIR)/%/$(rtl-sim-logfile) scripts/check_logs.py
@echo Collecting simulation results and checking logs of testcase at $@
$(verb)env PYTHONPATH=$(PYTHONPATH) \
scripts/check_logs.py \
Expand Down
5 changes: 3 additions & 2 deletions dv/uvm/core_ibex/scripts/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ def _setup_directories(self):
self.dir_instruction_generator = self.dir_build/'instr_gen'
self.dir_tb = self.dir_build/'tb'
self.dir_run = self.dir_out/'run'
self.dir_tests = self.dir_run/'tests'
self.dir_cov = self.dir_run/'coverage'
self.dir_fcov = self.dir_cov/'fcov'
self.dir_shared_cov = self.dir_cov/'shared_cov'
Expand Down Expand Up @@ -367,10 +368,10 @@ def _main():
seed=seed,
rtl_simulator=md.simulator,
iss_cosim=md.iss,
dir_test=md.dir_run/tds_str,
dir_test=md.dir_tests / tds_str,
metadata_pickle_file=md.pickle_file,
pickle_file=trr_pickle_file,
yaml_file=(md.dir_run / tds_str / 'trr.yaml'))
yaml_file=(md.dir_tests / tds_str / 'trr.yaml'))

# Save the path into a list in the regression metadata object for later.
md.tests_pickle_files.append(trr.pickle_file)
Expand Down

0 comments on commit 9086afe

Please sign in to comment.