make(sharness): add plugins as part of sharness build
License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
Jakub Sztandera committed
Jul 12, 2017 at 20:48 UTC
d2cc708650a2555fffea77cc3c446427f9e8da57
4 files changed
+20
-3
Rules.mk
+4
-2
@@ -27,6 +27,10 @@ export IPFS_REUSEPORT=false
27
dir := bin
28
include $(dir)/Rules.mk
29
30
+# tests need access to rules from plugin
31
+dir := plugin
32
+include $(dir)/Rules.mk
33
+
34
dir := test
35
include $(dir)/Rules.mk
36
@@ -56,8 +60,6 @@ include $(dir)/Rules.mk
60
dir := pin/internal/pb
61
include $(dir)/Rules.mk
62
59
-dir := plugin
60
-include $(dir)/Rules.mk
63
64
# -------------------- #
65
# universal rules #
mk/util.mk
+1
@@ -1,4 +1,5 @@
1
# util functions
2
+OS ?= $(shell sh -c 'uname -s 2>/dev/null || echo not')
3
ifeq ($(OS),Windows_NT)
4
WINDOWS :=1
5
?exe :=.exe # windows compat
test/sharness/.gitignore
+1
@@ -1,3 +1,4 @@
1
lib/sharness/
2
test-results/
3
trash directory.*.sh/
4
+plugins
test/sharness/Rules.mk
+14
-1
@@ -1,6 +1,5 @@
1
include mk/header.mk
2
3
-
3
SHARNESS_$(d) = $(d)/lib/sharness/sharness.sh
4
5
T_$(d) = $(sort $(wildcard $(d)/t[0-9][0-9][0-9][0-9]-*.sh))
@@ -12,6 +11,20 @@ DEPS_$(d) += cmd/ipfs/ipfs
11
DEPS_$(d) += $(d)/clean-test-results
12
DEPS_$(d) += $(SHARNESS_$(d))
13
14
+ifeq ($(OS),Linux)
15
+PLUGINS_DIR_$(d) := $(d)/plugins/
16
+ORGIN_PLUGINS_$(d) := $(plugin/plugins_plugins_so)
17
+PLUGINS_$(d) := $(addprefix $(PLUGINS_DIR_$(d)),$(notdir $(ORGIN_PLUGINS_$(d))))
18
+
19
+$(PLUGINS_$(d)): $(ORGIN_PLUGINS_$(d))
20
+ @mkdir -p $(@D)
21
+ cp -f plugin/plugins/$(@F) $@
22
+
23
+ifneq ($(TEST_NO_PLUGIN),1)
24
+DEPS_$(d) += $(PLUGINS_$(d))
25
+endif
26
+endif
27
+
28
export MAKE_SKIP_PATH=1
29
30
$(T_$(d)): $$(DEPS_$(d)) # use second expansion so coverage can inject dependency