Skip to content

Commit a506256

Browse files
committed
chore: add action trigger fail target and fake func test
1 parent cf3e613 commit a506256

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

.github/workflows/unit-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ jobs:
2121
make dramsim3Build
2222
make riscvTestBuild
2323
make cpuTestBuild
24-
make CHIP_TARGET=tc_l2 unit-test
24+
make CHIP_TARGET=tc_l2 RUN_PLATFORM=action unit-test

rtl/Makefile

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
SHELL=/bin/bash
22

33
# be carefully, this path will be used in clean(rm -rf)!!!
4+
# github action or native
5+
RUN_PLATFORM ?= native
46
# need to set the $(CHIP_TARGET) with tc_lx(2, 3, 4...)
57
CHIP_TARGET ?= tc_l3
68
ROOT_PATH := $(shell pwd)/dependency
@@ -243,7 +245,21 @@ $(cpuTestLogFile):
243245
$(cpuTestCaseName): cputest-%: $(CPUTEST_HOME)/build/%-riscv64-mycpu.bin
244246
$(call getRecursiveTestRes, $(CPUTEST_HOME), 33)
245247

246-
unit-test: simBuild riscvRecursiveTest cpuRecursiveTest
248+
postTest:
249+
# ifeq dont's need to indent
250+
# ref to: https://stackoverflow.com/questions/55133855/how-to-compare-two-string-variables-in-makefile
251+
@echo -e "\033[0;33mstart post test check...\033[0m";
252+
ifeq ($(RUN_PLATFORM), action)
253+
@if [ "$$(echo $$(echo $$(cat $(CPUTEST_HOME)/build/log/allcasenum-log.txt) - $$(cat $(CPUTEST_HOME)/build/log/passcasenum-log.txt) | bc))" = "1" ]; then\
254+
echo -e "\033[0;32maction check pass!\033[0m";\
255+
else \
256+
echo -e "\033[0;31maction check fail!\033[0m";\
257+
exit 1; \
258+
fi
259+
endif
260+
@echo -e "\033[0;32mpost check done!\033[0m";
261+
262+
unit-test: simBuild riscvRecursiveTest cpuRecursiveTest postTest
247263

248264
###### soc name rule test target ######
249265
socTopModify:
@@ -309,6 +325,6 @@ cleanAll: cleanBuild cleanMillOut cleanDepRepo
309325
nemuBuild dramsim3Build difftestBuild changeTargetToSimTop changeTargetToSoCTop simBuild \
310326
simpleTestBuild riscvTestBuild cpuTestBuild amTestBuild coremarkTestBuild \
311327
dhrystoneTestBuild microbenchTestBuild fecmuxTestBuild demoTest \
312-
simpleRecursiveTest riscvRecursiveTest cpuRecursiveTest unit-test \
328+
simpleRecursiveTest riscvRecursiveTest cpuRecursiveTest postTest unit-test \
313329
socTopModify socNameCheck socLintCheck socPrevBuild socBuild socSubmit socTest\
314330
cleanBuild cleanMillOut cleanDepRepo cleanAll

0 commit comments

Comments
 (0)