tests,cpu-tests,Makefile: report run results

This commit is contained in:
Zihao Yu 2021-08-13 18:04:41 +08:00
parent 8a1caa1db3
commit 56c864d5ef

View file

@ -1,5 +1,12 @@
.PHONY: all run clean latest $(ALL) .PHONY: all run clean latest $(ALL)
RESULT = .result
$(shell > $(RESULT))
COLOR_RED = \033[1;31m
COLOR_GREEN = \033[1;32m
COLOR_NONE = \033[0m
ALL = $(basename $(notdir $(shell find tests/. -name "*.c"))) ALL = $(basename $(notdir $(shell find tests/. -name "*.c")))
all: $(addprefix Makefile., $(ALL)) all: $(addprefix Makefile., $(ALL))
@ -9,10 +16,16 @@ $(ALL): %: Makefile.%
Makefile.%: tests/%.c latest Makefile.%: tests/%.c latest
@/bin/echo -e "NAME = $*\nSRCS = $<\nLIBS += klib\ninclude $${AM_HOME}/Makefile" > $@ @/bin/echo -e "NAME = $*\nSRCS = $<\nLIBS += klib\ninclude $${AM_HOME}/Makefile" > $@
-@make -s -f $@ ARCH=$(ARCH) $(MAKECMDGOALS) @if make -s -f $@ ARCH=$(ARCH) $(MAKECMDGOALS); then \
printf "[%14s] $(COLOR_GREEN)PASS!$(COLOR_NONE)\n" $* >> $(RESULT); \
else \
printf "[%14s] $(COLOR_RED)FAIL!$(COLOR_NONE)\n" $* >> $(RESULT); \
fi
-@rm -f Makefile.$* -@rm -f Makefile.$*
run: all run: all
@cat $(RESULT)
@rm $(RESULT)
clean: clean:
rm -rf Makefile.* build/ rm -rf Makefile.* build/