Просмотр исходного кода

Fix removal of COVER_DATA_DIR if not empty

Loïc Hoguin 7 лет назад
Родитель
Сommit
b0623a2803
2 измененных файлов с 9 добавлено и 1 удалено
  1. 3 1
      plugins/cover.mk
  2. 6 0
      test/plugin_cover.mk

+ 3 - 1
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:

+ 6 - 0
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)"