blob: 29dfd07a04d4a309846f8d9440af8df33eb39b6c (
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
|
# AsciiDoc plugin.
ASCIIDOC_TARGETS = $(call list_targets,asciidoc)
.PHONY: asciidoc $(ASCIIDOC_TARGETS)
asciidoc: $(ASCIIDOC_TARGETS)
# Disable the Asciidoc tests requiring the DocBook toolchain
# when Asciidoc is not installed. The toolchain is too heavy for CI.
ifneq ($(shell which a2x),)
asciidoc-build: init
$i "Bootstrap a new OTP application named $(APP)"
$t mkdir $(APP)/
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
$i "Add asciideck to the local dependencies"
$t perl -ni.bak -e 'print;if ($$.==1) {print "DOC_DEPS = asciideck\n"}' $(APP)/Makefile
$i "Run AsciiDoc"
$t $(MAKE) -C $(APP) asciidoc $v
$i "Check that no documentation was generated"
$t test ! -e $(APP)/doc/guide.pdf
$t test ! -e $(APP)/doc/html/
$t test ! -e $(APP)/doc/man3/
$t test ! -e $(APP)/doc/man7/
$i "Generate AsciiDoc documentation"
$t mkdir -p $(APP)/doc/src/guide/ $(APP)/doc/src/manual/
$t printf "%s\n" \
"= Erlang.mk tests" "" \
"Hello world!" > $(APP)/doc/src/guide/book.asciidoc
$t printf "%s\n" \
"= erlang_mk(3)" "" \
"== Name" "" \
"erlang_mk - Erlang.mk test" "" \
"== Description" "" \
"Hello world!" > $(APP)/doc/src/manual/erlang_mk.asciidoc
$t printf "%s\n" \
"= erlang_mk(7)" "" \
"== Name" "" \
"erlang_mk - Erlang.mk application" "" \
"== Description" "" \
"Summer is better than winter!" > $(APP)/doc/src/manual/erlang_mk_app.asciidoc
$i "Run AsciiDoc"
$t $(MAKE) -C $(APP) asciidoc $v
$i "Check that the documentation was generated"
$t test -f $(APP)/doc/guide.pdf
$t test -d $(APP)/doc/html/
$t test -f $(APP)/doc/man3/erlang_mk.3.gz
$t test -f $(APP)/doc/man7/erlang_mk.7.gz
$i "Distclean the application"
$t $(MAKE) -C $(APP) distclean $v
$i "Check that the generated documentation was removed"
$t test ! -e $(APP)/doc/guide.pdf
$t test ! -e $(APP)/doc/html/
$t test ! -e $(APP)/doc/man3/
$t test ! -e $(APP)/doc/man7/
$i "Generate an invalid AsciiDoc file"
$t printf "%s\n" \
"= fail(3)" "" \
"This will fail because the Name section is missing." > $(APP)/doc/src/manual/fail.asciidoc
$i "Check that AsciiDoc errors out"
$t ! $(MAKE) -C $(APP) asciidoc $v
asciidoc-docs: init
$i "Bootstrap a new OTP application named $(APP)"
$t mkdir $(APP)/
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
$i "Add asciideck to the local dependencies"
$t perl -ni.bak -e 'print;if ($$.==1) {print "DOC_DEPS = asciideck\n"}' $(APP)/Makefile
$i "Generate AsciiDoc documentation"
$t mkdir -p $(APP)/doc/src/guide/
$t printf "%s\n" \
"= Erlang.mk tests" "" \
"Hello world!" > $(APP)/doc/src/guide/book.asciidoc
$i "Check that AsciiDoc runs on 'make docs'"
$t $(MAKE) -C $(APP) docs $v
$t test -f $(APP)/doc/guide.pdf
$t test -d $(APP)/doc/html/
asciidoc-guide: init
$i "Bootstrap a new OTP application named $(APP)"
$t mkdir $(APP)/
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
$i "Add asciideck to the local dependencies"
$t perl -ni.bak -e 'print;if ($$.==1) {print "DOC_DEPS = asciideck\n"}' $(APP)/Makefile
$i "Generate AsciiDoc documentation"
$t mkdir -p $(APP)/doc/src/guide/ $(APP)/doc/src/manual/
$t printf "%s\n" \
"= Erlang.mk tests" "" \
"Hello world!" > $(APP)/doc/src/guide/book.asciidoc
$t printf "%s\n" \
"= erlang_mk(3)" "" \
"== Name" "" \
"erlang_mk - Erlang.mk test" "" \
"== Description" "" \
"Hello world!" > $(APP)/doc/src/manual/erlang_mk.asciidoc
$i "Check that only the guide is generated on 'make asciidoc-guide'"
$t $(MAKE) -C $(APP) asciidoc-guide $v
$t test -f $(APP)/doc/guide.pdf
$t test -d $(APP)/doc/html/
$t test ! -e $(APP)/doc/man3/
endif
asciidoc-install: init
$i "Bootstrap a new OTP application named $(APP)"
$t mkdir $(APP)/
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
$i "Add asciideck to the local dependencies"
$t perl -ni.bak -e 'print;if ($$.==1) {print "DOC_DEPS = asciideck\n"}' $(APP)/Makefile
$i "Only enable man pages section 3"
$t perl -ni.bak -e 'print;if ($$.==1) {print "MAN_SECTIONS = 3\n"}' $(APP)/Makefile
$i "Generate AsciiDoc documentation"
$t mkdir -p $(APP)/doc/src/manual/
$t printf "%s\n" \
"= erlang_mk(3)" "" \
"== Name" "" \
"erlang_mk - Erlang.mk test" "" \
"== Description" "" \
"Hello world!" > $(APP)/doc/src/manual/erlang_mk.asciidoc
$i "Build and install the man pages to $(APP)/installed/"
$t $(MAKE) -C $(APP) install-docs MAN_INSTALL_PATH=installed/share $v
$i "Check that the documentation was installed properly"
$t test -f $(APP)/installed/share/man3/erlang_mk.3.gz
asciidoc-manual: init
$i "Bootstrap a new OTP application named $(APP)"
$t mkdir $(APP)/
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
$i "Add asciideck to the local dependencies"
$t perl -ni.bak -e 'print;if ($$.==1) {print "DOC_DEPS = asciideck\n"}' $(APP)/Makefile
$i "Only enable man pages section 3"
$t perl -ni.bak -e 'print;if ($$.==1) {print "MAN_SECTIONS = 3\n"}' $(APP)/Makefile
$i "Generate AsciiDoc documentation"
$t mkdir -p $(APP)/doc/src/guide/ $(APP)/doc/src/manual/
$t printf "%s\n" \
"= Erlang.mk tests" "" \
"Hello world!" > $(APP)/doc/src/guide/book.asciidoc
$t printf "%s\n" \
"= erlang_mk(3)" "" \
"== Name" "" \
"erlang_mk - Erlang.mk test" "" \
"== Description" "" \
"Hello world!" > $(APP)/doc/src/manual/erlang_mk.asciidoc
$t printf "%s\n" \
"= name_changed(3)" "" \
"== Name" "" \
"name_changed - Manual page name different than output" "" \
"== Description" "" \
"Name changed!" > $(APP)/doc/src/manual/change_name.asciidoc
$i "Run 'make asciidoc-manual'"
$t $(MAKE) -C $(APP) asciidoc-manual $v
$i "Check that only the manual was generated"
$t test ! -e $(APP)/doc/guide.pdf
$t test ! -e $(APP)/doc/html/
$t test -f $(APP)/doc/man3/erlang_mk.3.gz
$t test -f $(APP)/doc/man3/name_changed.3.gz
|