From b0623a2803acb1c59b1bde10343ca9826f67b759 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Fri, 15 Sep 2017 22:21:47 +0200 Subject: Fix removal of COVER_DATA_DIR if not empty --- plugins/cover.mk | 4 +++- test/plugin_cover.mk | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/cover.mk b/plugins/cover.mk index b57458a..a14b992 100644 --- a/plugins/cover.mk +++ b/plugins/cover.mk @@ -80,7 +80,9 @@ ifneq ($(COVER_REPORT_DIR),) .PHONY: cover-report-clean cover-report cover-report-clean: - $(gen_verbose) rm -rf $(COVER_REPORT_DIR) $(COVER_DATA_DIR) + $(gen_verbose) rm -rf $(COVER_REPORT_DIR) + # Remove the COVER_DATA_DIR only if it is empty. + -$(verbose) rmdir $(COVER_DATA_DIR) ifeq ($(COVERDATA),) cover-report: diff --git a/test/plugin_cover.mk b/test/plugin_cover.mk index 905e6d2..c9ba3d7 100644 --- a/test/plugin_cover.mk +++ b/test/plugin_cover.mk @@ -84,6 +84,12 @@ cover-custom-dir: build clean $t $(MAKE) -C $(APP) distclean $v $t test ! -e $(APP)/custom_dir/ + $i "Check that the custom dir is not removed if not empty" + $t mkdir $(APP)/custom_dir + $t touch $(APP)/custom_dir/file + $t $(MAKE) -C $(APP) distclean $v + $t test -f $(APP)/custom_dir/file + cover-eunit: build clean $i "Bootstrap a new OTP application named $(APP)" -- cgit v1.2.3