From 74ba914cedfd3d3eb90a7530602431e4ae985374 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Sun, 7 Jan 2018 20:30:08 +0800 Subject: [PATCH] tests/device: add make target to generate test reports --- tests/device/.gitignore | 2 ++ tests/device/Makefile | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/tests/device/.gitignore b/tests/device/.gitignore index c1ffd0931..b2b1b8d45 100644 --- a/tests/device/.gitignore +++ b/tests/device/.gitignore @@ -1,2 +1,4 @@ .build .hardware +test_report.xml +test_report.html diff --git a/tests/device/Makefile b/tests/device/Makefile index cf7810fcd..6b209d1bc 100644 --- a/tests/device/Makefile +++ b/tests/device/Makefile @@ -31,7 +31,7 @@ else endif -all: count tests +all: count tests test_report count: @echo Running $(words $(TEST_LIST)) tests @@ -75,6 +75,15 @@ ifneq ("$(NO_RUN)","1") `test -f $(addsuffix .py, $(basename $@)) && echo "-m $(addsuffix .py, $(basename $@))" || echo ""` endif +$(TEST_REPORT_XML): $(HARDWARE_DIR) virtualenv + @$(BS_DIR)/virtualenv/bin/xunitmerge $(shell find $(BUILD_DIR) -name 'test_result.xml' | xargs echo) $(TEST_REPORT_XML) + +$(TEST_REPORT_HTML): $(TEST_REPORT_XML) | virtualenv + @$(BS_DIR)/virtualenv/bin/junit2html $< $@ + +test_report: $(TEST_REPORT_HTML) + @echo "Test report generated in $(TEST_REPORT_HTML)" + $(BUILD_DIR): mkdir -p $(BUILD_DIR) @@ -88,6 +97,7 @@ virtualenv: clean: rm -rf $(BUILD_DIR) rm -rf $(HARDWARE_DIR) + rm -f $(TEST_REPORT_HTML) $(TEST_REPORT_XML) $(TEST_CONFIG): @echo "****** " @@ -96,4 +106,4 @@ $(TEST_CONFIG): @echo "****** " false -.PHONY: tests all count venv $(BUILD_DIR) $(TEST_LIST) +.PHONY: tests all count virtualenv test_report $(BUILD_DIR) $(TEST_LIST)