-
Notifications
You must be signed in to change notification settings - Fork 204
/
Copy pathMakefile.common
460 lines (407 loc) · 14.4 KB
/
Makefile.common
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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
#-*- Makefile -*-
#
# ${R_HOME}/tests/Makefile.common
## If you add test scripts here, review ../src/library/tools/R/testing.R
test-src-gct = \
eval-etc.R \
simple-true.R \
arith-true.R \
arith.R \
lm-tests.R \
ok-errors.R \
method-dispatch.R \
any-all.R
test-src-strict-1 = \
$(test-src-gct) \
d-p-q-r-tests.R
test-src-strict-auto =
test-src-sloppy-1 = \
complex.R \
print-tests.R \
lapack.R \
datasets.R \
datetime.R \
iec60559.R
test-src-sloppy-auto =
test-src-1 = $(test-src-strict-1) $(test-src-sloppy-1)
test-src-auto = $(test-src-strict-auto) $(test-src-sloppy-auto) \
${test-src-isas} ${test-src-segfault}
test-src-sloppy = $(test-src-sloppy-1) $(test-src-sloppy-auto)
test-src-strict = $(test-src-strict-1) $(test-src-strict-auto)
test-src = $(test-src-strict) $(test-src-sloppy)
test-src-dt = datetime2.R
test-src-demo = demos.R demos2.R
test-src-internet = internet.R
test-src-internet2 = internet2.R libcurl.R
test-src-isas = isas-tests.R
test-src-primitive = primitives.R
test-src-random = p-r-random-tests.R
test-src-regexp = utf8-regex.R
test-src-segfault = no-segfault.R
test-src-reg-1 = array-subset.R \
reg-tests-1a.R reg-tests-1b.R reg-tests-1c.R reg-tests-2.R \
reg-examples1.R reg-examples2.R reg-packages.R p-qbeta-strict-tst.R \
r-strict-tst.R \
reg-IO.R reg-IO2.R reg-plot.R reg-S4.R reg-BLAS.R
## added to in Makefile.win
test-src-reg-1e =
test-src-reg = $(test-src-reg-1) $(test-src-reg-1e)
## overridden in Makefile if recommended packages are not installed.
test-src-reg3 = reg-tests-3.R reg-examples3.R reg-plot-latin1.R
test-out-strict = $(test-src-strict:.R=.Rout)
test-out-sloppy = $(test-src-sloppy:.R=.Rout)
test-out-gct = $(test-src-gct:.R=.Rout-gct)
test-out-valgct = $(test-src-gct:.R=.Rout-valgct)
test-out-dt = $(test-src-dt:.R=.Rout)
test-out-demo = $(test-src-demo:.R=.Rout)
test-out-internet = $(test-src-internet:.R=.Rout)
test-out-internet2 = $(test-src-internet2:.R=.Rout)
test-out-isas = $(test-src-isas:.R=.Rout)
test-out-primitive = $(test-src-primitive:.R=.Rout)
test-out-random = $(test-src-random:.R=.Rout)
test-out-reg = $(test-src-reg:.R=.Rout)
test-out-regexp = $(test-src-regexp:.R=.Rout)
test-out-reg3 = $(test-src-reg3:.R=.Rout)
test-out-segfault = $(test-src-segfault:.R=.Rout)
## This macro is used only for dependencies and for distclean
test-out = $(test-src:.R=.Rout) $(test-out-demo) $(test-out-gct) \
$(test-out-internet) \
$(test-out-random) $(test-out-reg) $(test-out-reg3) \
$(test-out-segfault) $(test-out-isas) $(test-out-internet2) \
$(test-out-primitive) $(test-out-dt) utf8-regex.Rout
.SUFFIXES:
.SUFFIXES: .R .Rin .Rout .Rout-gct .Rout-valgct .trin .tsin .log
$(test-out): FORCE
FORCE:
.Rin.R:
@$(ECHO) "creating '$@'"
@$(R) < $< > /dev/null
.R.Rout:
@rm -f $@ [email protected] [email protected]
@$(ECHO) $(ECHO_N) "running code in '$<' ...$(ECHO_C)" > [email protected]
@$(ECHO) "$(ECHO_T) OK" >> [email protected]
@if test -f $(srcdir)/[email protected] ; then \
$(ECHO) $(ECHO_N) \
" comparing '$@' to '$(srcdir)/[email protected]' ...$(ECHO_C)" >> [email protected]; \
|| (cat [email protected] && rm [email protected] && exit 1) || exit 1; \
mv [email protected] $@; \
$(ECHO) "$(ECHO_T) OK" >> [email protected]; \
else \
mv [email protected] $@; \
fi
@cat [email protected]; rm [email protected]
reg-plot.Rout: reg-plot.R
@rm -f $@ [email protected] [email protected]
@$(ECHO) $(ECHO_N) "running code in '$<' ...$(ECHO_C)" > [email protected]
@$(R) < $< > $@ 2>&1 || (mv $@ [email protected] && cat [email protected] && rm [email protected] && exit 1)
@$(ECHO) "$(ECHO_T) OK" >> [email protected]
@$(ECHO) $(ECHO_N) \
" comparing 'reg-plot.pdf' to '$(srcdir)/reg-plot.pdf.save' ...$(ECHO_C)" >> [email protected]
@$(RDIFF) reg-plot.pdf $(srcdir)/reg-plot.pdf.save >> [email protected]
@$(ECHO) "$(ECHO_T) OK" >> [email protected]
@cat [email protected]; rm [email protected]
## allow this to fail, as it may if the locale does not support Latin-1 chars
reg-plot-latin1.Rout: reg-plot-latin1.R
@rm -f $@ [email protected]
@$(ECHO) "running tests of plotting Latin-1"
@$(ECHO) " expect failure or some differences if not in a Latin-1 or UTF-8 locale"
@$(ECHO) $(ECHO_N) "running code in '$<' ...$(ECHO_C)"
@$(R2) < $< > $@ 2>&1 || mv $@ [email protected]
@if test -f [email protected]; then \
$(ECHO) "$(ECHO_T) FAILED"; \
else \
$(ECHO) "$(ECHO_T) OK"; \
$(ECHO) $(ECHO_N) \
" comparing 'reg-plot-latin1.pdf' to '$(srcdir)/reg-plot-latin1.pdf.save' ...$(ECHO_C)"; \
$(RDIFF) reg-plot-latin1.pdf $(srcdir)/reg-plot-latin1.pdf.save; \
$(ECHO) "$(ECHO_T) OK"; \
fi
.R.Rout-gct:
@$(ECHO) "running gctorture() + '$<'"
@($(ECHO) '.ptime <- proc.time(); gctorture()' ; \
cat $< $(srcdir)/gct-foot.R) | $(R) > $@ 2>&1
@mv $@ [email protected]; Ro=`basename $@ .Rout-gct`.Rout; \
if test ! -r $${Ro}; then $(MK) $${Ro}; fi; \
$(ECHO) $(ECHO_N) " comparing '$@' to '$${Ro}' ...$(ECHO_C)"; \
grep -v 'gctorture()' [email protected] | $(RDIFF) - $${Ro} 1 || exit 1; \
mv [email protected] $@; \
$(ECHO) "$(ECHO_T) OK"
R-valgrind = $(R) --debugger="valgrind --tool=memcheck"
.R.Rout-valgct:
@$(ECHO) "running gctorture() + valgrind + '$<'"
@($(ECHO) '.ptime <- proc.time(); gctorture()' ; \
cat $< $(srcdir)/gct-foot.R) | $(R-valgrind) > $@ 2>&1
grep "==[0-9]*==" $@
## The definitions for Internet are in Makefile.{in,win}.
all-basic-tests = Examples Specific Reg Internet
test-all-basics:
@for name in $(all-basic-tests); do \
$(MK) test-$${name} || exit 1; \
done
## if you change this, also edit Makefile.install
## The definitions for Standalone are in Makefile.{in,win}.
all-devel-tests = DateTime Docs IsAs Random Demo Primitive Regexp \
Internet2 Segfault Standalone Packages
test-all-devel:
@for name in $(all-devel-tests); do \
$(MK) test-$${name} || exit 1; \
done
test-Examples:
@(cd Examples && $(MK) $@)
test-Examples-Recommended:
@(cd Examples && $(MK) $@)
test-Specific-strict: $(test-out-strict)
test-Specific-sloppy: $(test-out-sloppy)
test-Specific:
@$(ECHO) "running strict specific tests"
@$(MK) test-Specific-strict RVAL_IF_DIFF=1
@$(ECHO) "running sloppy specific tests"
@$(MK) test-Specific-sloppy RVAL_IF_DIFF=0
test-Packages:
@if test -n "${TEST_MC_CORES}"; then \
$(ECHO) "Using ${TEST_MC_CORES} cores to check packages"; \
$(MK) -j ${TEST_MC_CORES} test-Packages2; \
else \
$(MK) test-Packages1; \
fi
test-Packages1:
@for p in $(R_PKGS_BASE); do \
$(ECHO) "checking package '$${p}'"; \
_R_CHECK_FF_CALLS_=registration \
_R_CHECK_CODE_USAGE_WITH_ONLY_BASE_ATTACHED_=true \
$(top_builddir)/bin/R CMD check --install=skip \
--no-build-vignettes \
$(top_srcdir)/src/library/$${p} || $(ECHO); \
done
PKG_OBJECTS = $(R_PKGS_BASE:=.log)
test-Packages2:
@for p in $(R_PKGS_BASE); do \
touch $${p}.tsin; \
done
+@$(MK) stamp-Packages
@rm -f *.tsin
stamp-Packages: $(PKG_OBJECTS)
.tsin.log:
@$(ECHO) "begin checking package '`basename $@ .log`'"
@rm -f $@
@_R_CHECK_FF_CALLS_=registration \
_R_CHECK_CODE_USAGE_WITH_ONLY_BASE_ATTACHED_=true \
$(top_builddir)/bin/R CMD check --install=skip --no-build-vignettes \
$(top_srcdir)/src/library/`basename $@ .log` > $@ 2>&1
@cat $@
test-Gct: $(test-out-gct)
test-Vgct: $(test-out-valgct)
test-DateTime:
@$(ECHO) "running tests of date-time printing"
@$(ECHO) " expect platform-specific differences"
@$(RM) -f $(test-out-dt)
@$(MK) $(test-out-dt) RVAL_IF_DIFF=0
test-Docs:
@$(ECHO) "running tests of documentation examples"
@cp ${top_srcdir}/doc/manual/*.R .
@$(MK) R-intro.Rout RVAL_IF_DIFF=0
@cp ${top_srcdir}/doc/manual/R-exts.c .
@$(top_builddir)/bin/R CMD SHLIB R-exts.c
@$(MK) R-exts.Rout
@rm R-exts.*
test-Demo:
@$(ECHO) "running demos from base and stats"
@$(MK) $(test-out-demo) RVAL_IF_DIFF=0
test-IsAs:
@$(ECHO) "running tests of consistency of as/is.*"
@$(MK) $(test-out-isas) RVAL_IF_DIFF=1
test-Internet2:
@$(ECHO) "running more Internet and socket tests"
@$(MK) $(test-out-internet2) RVAL_IF_DIFF=1
test-Primitive:
@$(ECHO) "running tests of primitives"
@$(MK) $(test-out-primitive) RVAL_IF_DIFF=0
test-Random:
@$(ECHO) "running tests of random deviate generation"
@$(MK) $(test-out-random) RVAL_IF_DIFF=1
test-Reg:
@$(ECHO) "running regression tests ..."
@if test -n "${TEST_MC_CORES}"; then \
$(MK) -j ${TEST_MC_CORES} $(test-out-reg) RVAL_IF_DIFF=1; \
else \
$(MK) $(test-out-reg) RVAL_IF_DIFF=1; \
fi
@$(MK) $(test-out-reg3) RVAL_IF_DIFF=0
test-Regexp:
@$(ECHO) "running regexp regression tests"
@$(R2) < $(srcdir)/utf8-regex.R > utf8-regex.Rout 2>&1 || (mv utf8-regex.Rout utf8-regex.Rout.fail && exit 1)
test-Segfault:
@$(ECHO) "running tests to possibly trigger segfaults"
@$(MK) $(test-out-segfault) RVAL_IF_DIFF=0
-@rm -rf data dumpdata.R F.Rd c0.Rd df0.Rd l0.Rd m0.Rd Rprof.out Rplots* PACKAGES PACKAGES.gz FALSE-package.Rd FALSE.* ./-Ex.R
## Avoid site library, which could be very large
no-segfault.Rout: no-segfault.R
@rm -f $@ [email protected]
@$(ECHO) $(ECHO_N) "running code in '$<' ...$(ECHO_C)"
@R_LIBS_SITE=no-such-dir $(R) < $< > $@ 2>&1 || (mv $@ [email protected] && exit 1)
@$(ECHO) "$(ECHO_T) OK"
test-Rd: $(srcdir)/testit.Rd $(srcdir)/ver20.Rd
@$(ECHO) "testing Rd conversion"
@$(RDCONV) -t txt $(srcdir)/testit.Rd > testit.txt
@$(RDCONV) -t html $(srcdir)/testit.Rd > testit.html 2> /dev/null
@$(RDCONV) -t latex $(srcdir)/testit.Rd > testit.tex
@$(RDCONV) -t example $(srcdir)/testit.Rd > testit-Ex.R
@diff -bw testit.txt $(srcdir)/testit.txt.save
@diff -bw testit.html $(srcdir)/testit.html.save
@diff -bw testit.tex $(srcdir)/testit.tex.save
@diff -bw testit-Ex.R $(srcdir)/testit-Ex.R.save
@$(RDCONV) -t txt $(srcdir)/ver20.Rd > ver20.txt
@$(RDCONV) -t html $(srcdir)/ver20.Rd > ver20.html
@$(RDCONV) -t latex $(srcdir)/ver20.Rd > ver20.tex
@$(RDCONV) -t example $(srcdir)/ver20.Rd > ver20-Ex.R
@diff -bw ver20.txt $(srcdir)/ver20.txt.save
@diff -bw ver20.html $(srcdir)/ver20.html.save
@diff -bw ver20.tex $(srcdir)/ver20.tex.save
@diff -bw ver20-Ex.R $(srcdir)/ver20-Ex.R.save
test-DocFiles:
@$(ECHO) "checking Rd usage sections"
@for p in $(R_PKGS_BASE); do \
$(ECHO) $(ECHO_N) "package '$${p}' ...$(ECHO_C)"; \
out=`($(ECHO) "library(\"tools\")"; \
$(ECHO) "checkDocFiles(package = \"$${p}\")") | \
$(R) -q | sed '/^>/d'`; \
if test -n "$${out}"; then \
$(ECHO) "$(ECHO_T) WARNING"; \
$(ECHO); \
$(ECHO) "$${out}"; \
$(ECHO); \
else \
$(ECHO) "$(ECHO_T) OK"; \
fi; \
done
test-DocStyle:
@$(ECHO) "checking S3 method documentation style"
@for p in $(R_PKGS_BASE); do \
$(ECHO) $(ECHO_N) "package '$${p}' ...$(ECHO_C)"; \
out=`($(ECHO) "library(\"tools\")"; \
$(ECHO) "checkDocStyle(package = \"$${p}\")") | \
$(R) -q | sed '/^>/d'`; \
if test -n "$${out}"; then \
$(ECHO) "$(ECHO_T) WARNING"; \
$(ECHO); \
$(ECHO) "$${out}"; \
$(ECHO); \
else \
$(ECHO) "$(ECHO_T) OK"; \
fi; \
done
test-FF:
@$(ECHO) "checking foreign function calls"
@for p in $(R_PKGS_BASE); do \
$(ECHO) $(ECHO_N) "package '$${p}' ...$(ECHO_C)"; \
out=`($(ECHO) "library(\"tools\")"; \
$(ECHO) "checkFF(package = \"$${p}\")") | \
$(R) -q | sed '/^>/d'`; \
if test -n "$${out}"; then \
$(ECHO) "$(ECHO_T) WARNING"; \
$(ECHO) "$${out}"; \
else \
$(ECHO) "$(ECHO_T) OK"; \
fi; \
done
test-S3methods:
@$(ECHO) "checking for S3 generic/method consistency"
@for p in $(R_PKGS_BASE); do \
$(ECHO) $(ECHO_N) "package '$${p}' ...$(ECHO_C)"; \
out=`($(ECHO) "library(\"tools\")"; \
$(ECHO) "checkS3methods(package = \"$${p}\")") | \
$(R) -q | sed '/^>/d'`; \
if test -n "$${out}"; then \
$(ECHO) "$(ECHO_T) WARNING"; \
$(ECHO); \
$(ECHO) "$${out}"; \
$(ECHO); \
else \
$(ECHO) "$(ECHO_T) OK"; \
fi; \
done
test-codoc:
@$(ECHO) "checking for code/documentation mismatches in functions"
@for p in $(R_PKGS_BASE); do \
$(ECHO) $(ECHO_N) "package '$${p}' ...$(ECHO_C)"; \
out=`($(ECHO) "library(\"tools\")"; \
$(ECHO) "codoc(package = \"$${p}\")") | \
$(R) -q | sed '/^>/d'`; \
if test -n "$${out}"; then \
$(ECHO) "$(ECHO_T) WARNING"; \
$(ECHO); \
$(ECHO) "$${out}"; \
$(ECHO); \
else \
$(ECHO) "$(ECHO_T) OK"; \
fi; \
done
test-undoc:
@$(ECHO) "checking for missing documentation entries"
@for p in $(R_PKGS_BASE); do \
$(ECHO) $(ECHO_N) "package '$${p}' ...$(ECHO_C)"; \
out=`($(ECHO) "library(\"tools\")"; \
$(ECHO) "undoc(package = \"$${p}\")") | \
$(R) -q | sed '/^>/d'`; \
if test -n "$${out}"; then \
$(ECHO) "$(ECHO_T) WARNING"; \
$(ECHO) "$${out}"; \
else \
$(ECHO) "$(ECHO_T) OK"; \
fi; \
done
test-Packages-Recommended:
@if test -n "${TEST_MC_CORES}"; then \
$(ECHO) "Using ${TEST_MC_CORES} cores to check packages"; \
$(MK) -j ${TEST_MC_CORES} test-Packages2-Recommended; \
else \
$(MK) test-Packages1-Recommended; \
fi
test-Packages1-Recommended:
@test -d RecPackages || mkdir RecPackages
@for p in $(R_PKGS_RECOMMENDED); do \
rm -rf RecPackages/$${p}; \
gzip -dc "$(top_srcdir)/src/library/Recommended/$${p}.tgz" | \
(cd RecPackages && $(TAR) xf -) ; \
$(ECHO) "checking package '$${p}'"; \
R_LIBS="$(top_builddir)/library:$${R_LIBS}" \
_R_CHECK_FORCE_SUGGESTS_=FALSE $(R3) --install=skip \
--library="$(top_builddir)/library" RecPackages/$${p} || $(ECHO); \
done
PKG_ROBJECTS = $(R_PKGS_RECOMMENDED:=.log)
test-Packages2-Recommended:
@test -d RecPackages || mkdir RecPackages
@for p in $(R_PKGS_RECOMMENDED); do \
touch $${p}.trin; \
done
+@$(MK) stamp-Packages2
@rm -f *.trin
stamp-Packages2: $(PKG_ROBJECTS)
.trin.log:
@p=`basename $@ .log`; \
rm -rf RecPackages/$${p}; \
gzip -dc "$(top_srcdir)/src/library/Recommended/$${p}.tgz" | \
(cd RecPackages && $(TAR) xf -) ; \
$(ECHO) "begin checking package '$${p}'"; \
R_LIBS="$(top_builddir)/library:$${R_LIBS}" \
_R_CHECK_FORCE_SUGGESTS_=FALSE $(R3) --install=skip \
--library="$(top_builddir)/library" RecPackages/$${p} > $@ 2>&1
@cat $@
INSTFILES = README \
$(test-src-strict-1) $(test-src-strict-1:.R=.Rout.save) \
$(test-src-sloppy-1) $(test-src-sloppy-1:.R=.Rout.save) \
$(test-src-auto:.R=.Rin) isas-tests.Rout.save \
$(test-src-dt) datetime2.Rout.save \
$(test-src-demo) demos.Rout.save \
$(test-src-internet) $(test-src-internet2) internet.Rout.save \
$(test-src-primitive) \
$(test-src-random) p-r-random-tests.Rout.save \
$(test-src-reg) $(test-src-reg3) \
reg-S4.Rout.save \
reg-IO.Rout.save reg-IO2.Rout.save reg-plot.Rout.save \
reg-plot.pdf.save reg-tests-2.Rout.save reg-tests-3.Rout.save \
reg-examples3.Rout.save reg-plot-latin1.pdf.save \
encodings.R utf8-regex.R \
nanbug.rda WinUnicode.dat arima.rda EmbeddedNuls.csv