aboutsummaryrefslogtreecommitdiffstats
path: root/test/core_misc.mk
blob: 2b74d98d713fe28eb918338676f1ab99d998a39b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# Core: Miscellaneous.
#
# The miscellaneous tests use the prefix "core-", not "core-misc-".

CORE_MISC_CASES = clean-crash-dump distclean-tmp help without-edoc without-index without-many
CORE_MISC_TARGETS = $(addprefix core-,$(CORE_MISC_CASES))

.PHONY: $(CORE_MISC_TARGETS)

core:: $(CORE_MISC_TARGETS)

core-clean-crash-dump: build clean

	$i "Bootstrap a new OTP library named $(APP)"
	$t mkdir $(APP)/
	$t cp ../erlang.mk $(APP)/
	$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v

	$i "Create a fake erl_crash.dump file"
	$t touch $(APP)/erl_crash.dump

	$i "Clean the application"
	$t $(MAKE) -C $(APP) clean $v

	$i "Check that the crash dump is removed"
	$t test ! -e $(APP)/erl_crash.dump

core-distclean-tmp: build clean

	$i "Bootstrap a new OTP application named $(APP)"
	$t mkdir $(APP)/
	$t cp ../erlang.mk $(APP)/
	$t $(MAKE) -C $(APP) -f erlang.mk bootstrap all $v

	$i "Check that a .erlang.mk directory exists"
	$t test -d $(APP)/.erlang.mk

	$i "Distclean the application"
	$t $(MAKE) -C $(APP) distclean $v

	$i "Check that .erlang.mk directory got removed"
	$t test ! -e $(APP)/.erlang.mk

core-help: build clean

	$i "Bootstrap a new OTP library named $(APP)"
	$t mkdir $(APP)/
	$t cp ../erlang.mk $(APP)/
	$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v

	$i "Run 'make help' and check that it prints help"
	$t test -n "`$(MAKE) -C $(APP) help` | grep Usage"

core-without-edoc: clean

	$i "Create a working directory for this test"
	$t mkdir -p $(APP)/

	$i "Generate a bleeding edge Erlang.mk without the EDoc plugin"
	$t cd .. && $(MAKE) WITHOUT=plugins/edoc ERLANG_MK=$(CURDIR)/$(APP)/erlang.mk $v

	$i "Confirm that the EDoc plugin was not included."
	$t ! grep -q distclean-edoc $(APP)/erlang.mk

	$i "Update Erlang.mk"
	$t $(MAKE) -C $(APP) -f erlang.mk erlang-mk $v

	$i "Confirm that the EDoc plugin is still not included."
	$t ! grep -q distclean-edoc $(APP)/erlang.mk

core-without-index: clean

	$i "Create a working directory for this test"
	$t mkdir -p $(APP)/

	$i "Generate a bleeding edge Erlang.mk without the package index"
	$t cd .. && $(MAKE) WITHOUT=index ERLANG_MK=$(CURDIR)/$(APP)/erlang.mk $v

	$i "Confirm that the index was not included."
	$t ! grep -q pkg_cowboy $(APP)/erlang.mk

	$i "Update Erlang.mk"
	$t $(MAKE) -C $(APP) -f erlang.mk erlang-mk $v

	$i "Confirm that the index is still not included."
	$t ! grep -q pkg_cowboy $(APP)/erlang.mk

core-without-many: clean

	$i "Create a working directory for this test"
	$t mkdir -p $(APP)/

	$i "Generate a bleeding edge Erlang.mk without the index and the EDoc plugin"
	$t cd .. && $(MAKE) WITHOUT="index plugins/edoc" ERLANG_MK=$(CURDIR)/$(APP)/erlang.mk $v

	$i "Confirm that the EDoc plugin was not included."
	$t ! grep -q distclean-edoc $(APP)/erlang.mk

	$i "Confirm that the index was not included."
	$t ! grep -q pkg_cowboy $(APP)/erlang.mk