The R Project SVN R

Rev

Rev 11652 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

#
# ${R_HOME}/tests/Makefile

VPATH = @srcdir@
srcdir = @srcdir@
top_srcdir = @top_srcdir@

top_builddir = ..
subdir = tests

include $(top_builddir)/Makeconf

distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)

test-src-gct = \
    eval-etc.R \
    simple-true.R \
    arith-true.R \
    arith.R \
    is-things.R \
    lm-tests.R \
    primitive-funs.R \
    method-dispatch.R
test-src-strict-1 = \
    $(test-src-gct) \
    d-p-q-r-tests.R
test-src-strict-auto = \
    isas-tests.R
test-src-sloppy-1 = \
    print-tests.R
test-src-sloppy-auto = \
    no-segfault.R

test-src-1 = $(test-src-strict-1) $(test-src-sloppy-1)
test-src-auto = $(test-src-strict-auto) $(test-src-sloppy-auto)
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-reg-1 = \
    reg-tests-1.R
test-src-reg-auto =
test-src-reg = $(test-src-reg-1) $(test-src-reg-auto)

DISTFILES = Makefile.in 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-reg) \
    isas-tests.Rin isas-tests.Rout.save \
    p-r-random-tests.R  p-r-random-tests.Rout.save \
    no-segfault.Rin
SUBDIRS = Examples

R = LC_ALL=C $(top_builddir)/bin/R --vanilla
RDIFF = $(top_builddir)/bin/Rdiff

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-reg = $(test-src-reg:.R=.Rout)

test-out = $(test-src:.R=.Rout) $(test-out-gct)

.SUFFIXES:
.SUFFIXES: .R .Rin .Rout .Rout-gct

all: Makefile test-All

Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
    @cd $(top_builddir) && \
      CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= \
      $(SHELL) ./config.status
Makedeps: Makefile
    @(for f in $(test-src); do \
        if test -f $(srcdir)/$${f}out.save ; then \
          echo "$${f}out: $${f} \$$(srcdir)/$${f}out.save \$$(FORCE)"; \
        else \
          echo "$${f}out: $${f} \$$(FORCE)"; \
        fi; \
        if test -f $(srcdir)/$${f}in; then \
          echo "$${f}: \$$(srcdir)/$${f}in stamp-R"; \
        fi; \
      done) >> Makefile
    @touch $@
FORCE:

.Rin.R:
    @echo "creating \`$@'"
    @$(R) < $< > /dev/null

.R.Rout:
    @rm -f $@ $@.fail
    @echo "running \`$<'"
    @$(R) < $< > $@
    @if [ -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

.R.Rout-gct:
    @echo "running gctorture() + \`$<'"
    @(echo '.ptime <- proc.time(); gctorture()' ; cat $< ; \
      echo 'cat("Time used {gctorture()}:", proc.time() - .ptime, "\n")') \
     | $(R) > $@
    @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"

test-All: Makefile
    @$(MAKE) test-Examples
    @$(MAKE) test-Specific
test-Examples:
    @(cd Examples && $(MAKE) $@)
test-Specific-strict: $(test-out-strict)
test-Specific-sloppy: $(test-out-sloppy)
test-Specific:
    @echo "updating test dependencies"
    @$(MAKE) Makedeps
    @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-Gct: $(test-out-gct)
test-Reg:
    @echo "running regression tests"
    @$(MAKE) $(test-out-reg) RVAL_IF_DIFF=0

test-undoc:
    @for p in $(R_PKGS); do \
      echo "undocumented objects in package \`$${p}':"; \
      echo "undoc(\"$${p}\")" | $(R) | grep "^ *\\["; \
      echo; \
    done

test-codoc:
    @for p in $(R_PKGS); do \
      echo "code/documentation mismatches in package \`$${p}':"; \
      echo "codoc(\"$(top_srcdir)/src/library/$${p}\")" | \
        $(R) -q | egrep -e "^($$|\\$$| *\\[)"; \
      echo; \
    done

$(test-out): Makefile stamp-R

stamp-R: $(top_builddir)/bin/R.bin $(top_builddir)/library/base/R/base
    @touch $@

mostlyclean: clean
clean:
    @-(cd Examples; $(MAKE) $@)
    @rm -f stamp-R Makedeps Rplot* *.Rd data dumpdata.R
distclean: clean
    @-(cd Examples; $(MAKE) $@)
    @rm -f Makefile $(test-out) $(test-src-auto)
maintainer-clean: distclean

distdir: $(DISTFILES)
    @for f in $(DISTFILES); do \
      test -f $(distdir)/$${f} \
        || ln $(srcdir)/$${f} $(distdir)/$${f} 2>/dev/null \
        || cp -p $(srcdir)/$${f} $(distdir)/$${f}; \
    done
    @for d in $(SUBDIRS); do \
      test -d $(distdir)/$${d} \
        || mkdir $(distdir)/$${d} \
        || exit 1; \
      chmod 755 $(distdir)/$${d}; \
      (cd $${d} && $(MAKE) distdir) \
        || exit 1; \
    done

## Automagically generated dependencies: