From b5c4ccc5b3050e2ca758d83f02b1df2933141628 Mon Sep 17 00:00:00 2001 From: Benoit Pierre Date: Sun, 11 Aug 2024 20:58:25 +0200 Subject: [PATCH] make: fix emulator `coverage` rule - use same busted launch script as for tests - build & install necessary test data so it can be run from scratch --- make/emulator.mk | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/make/emulator.mk b/make/emulator.mk index 974cff172..d640c37d6 100644 --- a/make/emulator.mk +++ b/make/emulator.mk @@ -29,7 +29,7 @@ run-wbuilder: all # Testing & coverage. {{{ -PHONY += coverage test testbase testfront +PHONY += coverage coverage-full coverage-run coverage-summary test testbase testfront $(INSTALL_DIR)/koreader/.busted: .busted $(SYMLINK) .busted $@ @@ -46,12 +46,16 @@ testfront: all test-data $(INSTALL_DIR)/koreader/.busted test: testbase testfront -coverage: $(INSTALL_DIR)/koreader/.luacov +coverage: coverage-summary + +coverage-run: all test-data $(INSTALL_DIR)/koreader/.busted $(INSTALL_DIR)/koreader/.luacov -rm -rf $(INSTALL_DIR)/koreader/luacov.*.out - cd $(INSTALL_DIR)/koreader && \ - ./luajit $(shell which busted) --output=gtest \ - --sort-files \ - --coverage --exclude-tags=nocov + cd $(INSTALL_DIR)/koreader && $(BUSTED_LUAJIT) --coverage --exclude-tags=nocov + +coverage-full: coverage-run + cd $(INSTALL_DIR)/koreader && cat luacov.report.out + +coverage-summary: coverage-run # coverage report summary cd $(INSTALL_DIR)/koreader && tail -n \ +$$(($$(grep -nm1 -e "^Summary$$" luacov.report.out|cut -d: -f1)-1)) \