#-*- Makefile -*-
#
# ${R_HOME}/tests/Makefile.install
srcdir = .
top_srcdir = ..
top_builddir = ..
include $(top_builddir)/etc$(R_ARCH)/Makeconf
SUBDIRS = Examples
test-src-gct = \
eval-etc.R \
simple-true.R \
arith-true.R \
arith.R \
lm-tests.R \
ok-errors.R \
method-dispatch.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
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-demo = demos.R demos2.R
test-src-errmsgs = errormsgs.R
test-src-internet = internet.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 = reg-tests-1.R reg-tests-2.R reg-IO.R reg-IO2.R \
reg-plot.R reg-S4.R
test-src-reg-auto =
test-src-reg = $(test-src-reg-1) $(test-src-reg-auto)
test-src-reg3 = reg-tests-3.R reg-plot-latin1.R
## GNU gettext disables LANGUAGE if LC_ALL=C, but other systems might not.
R = LANGUAGE=en LC_ALL=C SRCDIR=$(srcdir) R_DEFAULT_PACKAGES= $(top_builddir)/bin/R --vanilla
R2 = R_DEFAULT_PACKAGES= $(top_builddir)/bin/R --vanilla
RDIFF = $(top_builddir)/bin/R CMD Rdiff
RDCONV = $(top_builddir)/bin/R CMD Rdconv
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-demo = $(test-src-demo:.R=.Rout)
test-out-errmsgs = $(test-src-errmsgs:.R=.Rout)
test-out-internet = $(test-src-internet:.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-primitive) utf8-regex.Rout
.SUFFIXES:
.SUFFIXES: .R .Rin .Rout .Rout-gct .Rout-valgct
all-basic-tests = Examples Specific Reg Internet
## not Docs Standalone
all-devel-tests = IsAs Random Demo Rd Primitive Regexp Segfault Packages2
all check: clean2 test-all-basics
check-devel: check test-all-devel
check-all: check-devel test-Recommended
test-Packages: test-Examples test-Packages2
FORCE:
.Rin.R:
@$(ECHO) "creating '$@'"
@$(R) < $< > /dev/null
.R.Rout:
@rm -f $@ $@.fail
@$(ECHO) $(ECHO_N) "running code in '$<' ...$(ECHO_C)"
@$(R) < $< > $@ 2>&1 || (mv $@ $@.fail && exit 1)
@$(ECHO) "$(ECHO_T) OK"
@if test -f $(srcdir)/$@.save ; then \
mv $@ $@.fail; \
$(ECHO) $(ECHO_N) \
"comparing '$@' to '$(srcdir)/$@.save' ...$(ECHO_C)"; \
$(RDIFF) $@.fail $(srcdir)/$@.save $(RVAL_IF_DIFF) || exit 1; \
mv $@.fail $@; \
$(ECHO) "$(ECHO_T) OK"; \
fi
reg-plot.Rout: reg-plot.R
@rm -f $@ $@.fail
@$(ECHO) $(ECHO_N) "running code in '$<' ...$(ECHO_C)"
@$(R) < $< > $@ 2>&1 || (mv $@ $@.fail && exit 1)
@$(ECHO) "$(ECHO_T) OK"
@$(ECHO) $(ECHO_N) \
"comparing 'reg-plot.ps' to '$(srcdir)/reg-plot.ps.save' ...$(ECHO_C)"
-@diff reg-plot.ps $(srcdir)/reg-plot.ps.save
@$(ECHO) "$(ECHO_T) OK"
## allow this to fail, as it must if the locale does not support Latin-1 chars
## we can't use Rdiff as MacOS tr crashes on latin-1 chars in a UTF-8 locale
reg-plot-latin1.Rout: reg-plot-latin1.R
@rm -f $@ $@.fail
@$(ECHO) "running tests of plotting Latin-1"
@$(ECHO) " expect failure or some differences if not in a Latin or UTF-8 locale"
@$(ECHO) $(ECHO_N) "running code in '$<' ...$(ECHO_C)"
@$(R2) < $< > $@ 2>&1 || mv $@ $@.fail
@if test -e $@.fail; then \
$(ECHO) "$(ECHO_T) FAILED"; \
else \
$(ECHO) "$(ECHO_T) OK"; \
$(ECHO) $(ECHO_N) \
"comparing 'reg-plot-latin1.ps' to '$(srcdir)/reg-plot-latin1.ps.save' ...$(ECHO_C)"; \
diff reg-plot-latin1.ps $(srcdir)/reg-plot-latin1.ps.save && exitstatus=0; \
$(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 $@ $@.fail; Ro=`basename $@ .Rout-gct`.Rout; \
if test ! -r $${Ro}; then $(MAKE) $${Ro}; fi; \
$(ECHO) $(ECHO_N) "comparing '$@' to '$${Ro}' ...$(ECHO_C)"; \
grep -v 'gctorture()' $@.fail | $(RDIFF) - $${Ro} 1 || exit 1; \
mv $@.fail $@; \
$(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]*==" $@
test-all-basics:
@for name in $(all-basic-tests); do \
$(MAKE) test-$${name} || exit 1; \
done
test-all-devel:
@for name in $(all-devel-tests); do \
$(MAKE) test-$${name} || exit 1; \
done
test-Examples:
@(cd Examples && $(MAKE) $@)
test-Examples-Recommended:
@(cd Examples && $(MAKE) $@)
test-Specific-strict: $(test-out-strict)
test-Specific-sloppy: $(test-out-sloppy)
test-Specific:
@$(ECHO) "updating test dependencies"
@$(ECHO) "running strict specific tests"
@$(MAKE) test-Specific-strict RVAL_IF_DIFF=1
@$(ECHO) "running sloppy specific tests"
@$(MAKE) test-Specific-sloppy RVAL_IF_DIFF=0
test-Packages2:
@for p in $(R_PKGS_BASE); do \
if test -d "../library/$${p}/tests"; then \
$(ECHO) "checking tests from package '$${p}'"; \
(cd ../library/$${p}/tests ; \
tmp=""; \
for f in `ls *.R`; do \
tmp="$${tmp} $$f"; \
done ; \
$(MAKE) -f "$(R_SHARE_DIR)/make/tests.mk" test-src-1="$${tmp}"); \
fi; \
done
@for p in $(R_PKGS_BASE); do \
if test -d "../library/$${p}/doc"; then \
$(ECHO) "checking vignettes from package '$${p}'"; \
$(ECHO) "tools::checkVignettes(\"$${p}\", latex=FALSE, weave=TRUE)" \
| $(R) --slave; \
fi; \
done
test-Recommended: test-Examples-Recommended
@for p in $(R_PKGS_RECOMMENDED); do \
if test -d "../library/$${p}/tests"; then \
$(ECHO) "checking tests from package '$${p}'"; \
(cd ../library/$${p}/tests ; \
tmp=""; \
for f in `ls *.R`; do \
tmp="$${tmp} $$f"; \
done ; \
$(MAKE) -f "$(R_SHARE_DIR)/make/tests.mk" test-src-1="$${tmp}"); \
fi; \
done
@for p in $(R_PKGS_RECOMMENDED); do \
if test -d "./$${p}/doc"; then \
$(ECHO) "checking vignettes from package '$${p}'"; \
$(ECHO) "tools::checkVignettes(\"$${p}\", latex=FALSE, weave=TRUE)" \
| $(R) --slave; \
fi; \
done
test-Gct: $(test-out-gct)
test-Vgct: $(test-out-valgct)
test-Docs:
@$(ECHO) "running tests of documentation examples"
@cp ${top_srcdir}/doc/manual/*.R .
@$(MAKE) R-intro.Rout RVAL_IF_DIFF=0
@cp ${top_srcdir}/doc/manual/R-exts.c .
@$(top_builddir)/bin/R CMD SHLIB R-exts.c
@$(MAKE) R-exts.Rout
@rm R-exts.*
test-Demo:
@$(ECHO) "running demos from base and stats"
@$(MAKE) $(test-out-demo) RVAL_IF_DIFF=0
test-Errormsgs:
@$(ECHO) "running tests of error messages"
@$(MAKE) $(test-out-errmsgs) RVAL_IF_DIFF=0
##
## These depend on an internet connection, and the sites being up.
## So allow this to fail: it may be slow doing so.
test-Internet:
@$(ECHO) "running tests of Internet and socket functions"
@$(ECHO) " expect some differences"
-@$(MAKE) $(test-out-internet) RVAL_IF_DIFF=0
##
test-IsAs:
@$(ECHO) "running tests of consistency of as/is.*"
@$(MAKE) $(test-out-isas) RVAL_IF_DIFF=1
test-Primitive:
@$(ECHO) "running tests of primitives"
@$(MAKE) $(test-out-primitive) RVAL_IF_DIFF=1
test-Random:
@$(ECHO) "running tests of random deviate generation"
@$(MAKE) $(test-out-random) RVAL_IF_DIFF=1
test-Reg:
@$(ECHO) "running regression tests"
@$(MAKE) $(test-out-reg) RVAL_IF_DIFF=1
@$(MAKE) $(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"
@$(MAKE) $(test-out-segfault) RVAL_IF_DIFF=0
@rm -f data dumpdata.R F.Rd c0.Rd df0.Rd l0.Rd m0.Rd Rprof.out Rplots.*
##
## Not all platforms can build standalone.
## So allow this to fail.
test-Standalone:
@$(ECHO) "testing building standalone Rmath"
-@(cd $(top_builddir)/src/nmath/standalone; $(MAKE) check)
##
test-Rd: $(srcdir)/testit.Rd $(srcdir)/ver10.Rd $(srcdir)/ver11.Rd
@$(ECHO) "testing Rd conversion"
@$(RDCONV) -t txt $(srcdir)/testit.Rd > testit.txt
@diff -bw testit.txt $(srcdir)/testit.txt.save
@$(RDCONV) -t html $(srcdir)/testit.Rd > testit.html
@diff -bw testit.html $(srcdir)/testit.html.save
@$(RDCONV) -t latex $(srcdir)/testit.Rd > testit.tex
@diff -bw testit.tex $(srcdir)/testit.tex.save
@$(RDCONV) -t example $(srcdir)/testit.Rd > testit-Ex.R
@diff -bw testit-Ex.R $(srcdir)/testit-Ex.R.save
@$(RDCONV) -t txt $(srcdir)/ver11.Rd > ver11.txt
@diff -bw ver11.txt $(srcdir)/ver11.txt.save
@$(RDCONV) -t html $(srcdir)/ver11.Rd > ver11.html
@diff -bw ver11.html $(srcdir)/ver11.html.save
@$(RDCONV) -t latex $(srcdir)/ver11.Rd > ver11.tex
@diff -bw ver11.tex $(srcdir)/ver11.tex.save
@$(RDCONV) -t example $(srcdir)/ver11.Rd > ver11-Ex.R
@diff -bw ver11-Ex.R $(srcdir)/ver11-Ex.R.save
@$(RDCONV) -t txt $(srcdir)/ver10.Rd > ver10.txt 2>&1
@diff -bw ver10.txt $(srcdir)/ver10.txt.save
@$(RDCONV) -t html $(srcdir)/ver10.Rd > ver10.html 2>&1
@diff -bw ver10.html $(srcdir)/ver10.html.save
@$(RDCONV) -t latex $(srcdir)/ver10.Rd > ver10.tex 2>&1
@diff -bw ver10.tex $(srcdir)/ver10.tex.save
@$(RDCONV) -t example $(srcdir)/ver10.Rd > ver10-Ex.R
@diff -bw ver10-Ex.R $(srcdir)/ver10-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
mostlyclean: clean
clean:
-@for d in $(SUBDIRS); do \
(cd $${d} && $(MAKE) $@); \
done
-@rm -f stamp-R Rplot* Rprof.out data dumpdata.R \
reg-plot-latin1.ps reg-plot.ps reg-tests-?.ps \
R-exts.* R-intro.R R-intro.Rout \
FALSE* .R .tex mirrors.html PACKAGES*
-@rm -f testit.txt testit.html testit.tex testit-Ex.R
-@rm -f ver10.txt ver10.html ver10.tex ver10-Ex.R
-@rm -f ver11.txt ver11.html ver11.tex ver11-Ex.R
-@rm -rf anRpackage myTst* myLib
-@rm -f */tests/*.Rout
clean2: clean
-@rm -f $(test-out) $(test-src-auto) .RData
distclean: clean
-@for d in $(SUBDIRS); do \
(cd $${d} && $(MAKE) $@); \
done
-@rm -f $(test-out) $(test-src-auto) .RData
-@rm -rf *.Rcheck Packages
maintainer-clean: distclean