Skip to content

Commit

Permalink
tests/device: add make target to generate test reports
Browse files Browse the repository at this point in the history
  • Loading branch information
igrr committed Jan 9, 2018
1 parent 28253c5 commit 74ba914
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 2 additions & 0 deletions tests/device/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
.build
.hardware
test_report.xml
test_report.html
14 changes: 12 additions & 2 deletions tests/device/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ else
endif


all: count tests
all: count tests test_report

count:
@echo Running $(words $(TEST_LIST)) tests
Expand Down Expand Up @@ -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)

Expand All @@ -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 "****** "
Expand All @@ -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)

0 comments on commit 74ba914

Please sign in to comment.