[Skiboot] [PATCH 15/17] external: Consolidate Makefile.check for external tools

Cyril Bur cyril.bur at au1.ibm.com
Fri Jul 21 16:36:06 AEST 2017


The reason for this is that check targets for one tool will start to
depend on other tools. For example, future pflash tests will rely on
ffspart to generate pnors. The current method is too racey and results
in races cleaning/building ffspart for its tests and for pflash tests.

Signed-off-by: Cyril Bur <cyril.bur at au1.ibm.com>
---
 external/Makefile.check              | 31 +++++++++++++++++++++++++++++++
 external/ffspart/test/Makefile.check | 20 --------------------
 external/gard/test/Makefile.check    | 26 --------------------------
 3 files changed, 31 insertions(+), 46 deletions(-)
 create mode 100644 external/Makefile.check
 delete mode 100644 external/ffspart/test/Makefile.check
 delete mode 100644 external/gard/test/Makefile.check

diff --git a/external/Makefile.check b/external/Makefile.check
new file mode 100644
index 00000000..9147421d
--- /dev/null
+++ b/external/Makefile.check
@@ -0,0 +1,31 @@
+# -*-Makefile-*-
+
+TOOL=gard ffspart
+CHECK_TOOL=$(patsubst %,check-%,$(TOOL))
+TOOL_COVERAGE=$(patsubst %,%-coverage,$(TOOL))
+TOOL_TEST_CLEAN=$(patsubst %,%-test-clean,$(TOOL))
+
+
+.PHONY: check
+check: $(CHECK_TOOL)
+
+#Makefile knows to build and clean it before checking, should also
+#make clean before checking. If not, .o files for different
+#architectures might be lying around and clean once done to avoid the
+#opposite
+.PHONY: $(CHECK_TOOL)
+$(CHECK_TOOL):
+	$(call QTEST, RUN-TEST , make CC=$(HOSTCC) CROSS='' CROSS_COMPILE='' \
+		-C external/$(patsubst check-%,%,$@) check, $@)
+
+clean: $(TOOL_TEST_CLEAN)
+
+.PHONY: $(TOOL_COVERAGE)
+coverage: $(TOOL_COVERAGE)
+
+$(TOOL_COVERAGE): $(patsubst %-coverage, check-%, $@)
+
+.PHONY: $(TOOL_TEST_CLEAN)
+$(TOOL_TEST_CLEAN):
+	$(call QTEST, CLEANUP , make -C external/$(patsubst %-test-clean,%,$@) clean, $@)
+
diff --git a/external/ffspart/test/Makefile.check b/external/ffspart/test/Makefile.check
deleted file mode 100644
index b1a1a3ce..00000000
--- a/external/ffspart/test/Makefile.check
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*-Makefile-*-
-
-check: check-ffspart
-
-#Makefile knows to build it before checking, should also
-#make clean before checking. If not, .o files for different
-#architectures might be lying around and clean once done to
-#avoid the opposite
-check-ffspart: ffspart-test-clean
-	@make CROSS_COMPILE='' -C external/ffspart/ check
-	@make CROSS_COMPILE='' -C external/ffspart/ clean
-
-.PHONY: check-ffspart
-
-clean: ffspart-test-clean
-
-ffspart-test-clean:
-	@make -C external/ffspart clean
-
-.PHONY: ffspart-test-clean
diff --git a/external/gard/test/Makefile.check b/external/gard/test/Makefile.check
deleted file mode 100644
index 593d0530..00000000
--- a/external/gard/test/Makefile.check
+++ /dev/null
@@ -1,26 +0,0 @@
-# -*-Makefile-*-
-
-check: check-gard
-
-#Makefile knows to build it before checking, should also
-#make clean before checking. If not, .o files for different
-#architectures might be lying around and clean once done to
-#avoid the opposite
-check-gard: gard-test-clean gard
-	$(call QTEST, RUN-TEST , make CC=$(HOSTCC) CROSS='' CROSS_COMPILE='' -C external/gard/ check, $@)
-	$(call QTEST, CLEANUP , make CC=$(HOSTCC) CROSS='' CROSS_COMPILE='' -C external/gard/ clean, $@)
-
-.PHONY: check-gard
-
-clean: gard-test-clean
-
-.PHONY: gard-coverage
-
-coverage: gard-coverage
-
-gard-coverage: check-gard
-
-gard-test-clean:
-	$(call QTEST, CLEANUP , make -C external/gard clean, $@)
-
-.PHONY: gard-test-clean
-- 
2.13.3



More information about the Skiboot mailing list