Skip to content

Commit 74ba914

Browse files
committed
tests/device: add make target to generate test reports
1 parent 28253c5 commit 74ba914

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

tests/device/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
.build
22
.hardware
3+
test_report.xml
4+
test_report.html

tests/device/Makefile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ else
3131
endif
3232

3333

34-
all: count tests
34+
all: count tests test_report
3535

3636
count:
3737
@echo Running $(words $(TEST_LIST)) tests
@@ -75,6 +75,15 @@ ifneq ("$(NO_RUN)","1")
7575
`test -f $(addsuffix .py, $(basename $@)) && echo "-m $(addsuffix .py, $(basename $@))" || echo ""`
7676
endif
7777

78+
$(TEST_REPORT_XML): $(HARDWARE_DIR) virtualenv
79+
@$(BS_DIR)/virtualenv/bin/xunitmerge $(shell find $(BUILD_DIR) -name 'test_result.xml' | xargs echo) $(TEST_REPORT_XML)
80+
81+
$(TEST_REPORT_HTML): $(TEST_REPORT_XML) | virtualenv
82+
@$(BS_DIR)/virtualenv/bin/junit2html $< $@
83+
84+
test_report: $(TEST_REPORT_HTML)
85+
@echo "Test report generated in $(TEST_REPORT_HTML)"
86+
7887
$(BUILD_DIR):
7988
mkdir -p $(BUILD_DIR)
8089

@@ -88,6 +97,7 @@ virtualenv:
8897
clean:
8998
rm -rf $(BUILD_DIR)
9099
rm -rf $(HARDWARE_DIR)
100+
rm -f $(TEST_REPORT_HTML) $(TEST_REPORT_XML)
91101

92102
$(TEST_CONFIG):
93103
@echo "****** "
@@ -96,4 +106,4 @@ $(TEST_CONFIG):
96106
@echo "****** "
97107
false
98108

99-
.PHONY: tests all count venv $(BUILD_DIR) $(TEST_LIST)
109+
.PHONY: tests all count virtualenv test_report $(BUILD_DIR) $(TEST_LIST)

0 commit comments

Comments
 (0)