From murdoch.duncan at gmail.com  Tue Sep  4 13:16:34 2012
From: murdoch.duncan at gmail.com (Duncan Murdoch)
Date: Tue, 04 Sep 2012 07:16:34 -0400
Subject: [Rd] if(--as-cran)?
In-Reply-To: <20549.49092.211155.310666@stat.math.ethz.ch>
References: <50444374.50709@prodsyse.com> <50449765.4030208@gmail.com>
	<50453C86.1020708@prodsyse.com> <504542DB.1020202@gmail.com>
	<50455BE3.90704@prodsyse.com>
	<20549.49092.211155.310666@stat.math.ethz.ch>
Message-ID: <5045E312.4080902@gmail.com>

On 12-09-04 4:45 AM, Martin Maechler wrote:
>>>>>> Spencer Graves <spencer.graves at prodsyse.com>
>>>>>>      on Mon, 3 Sep 2012 18:39:47 -0700 writes:
>
>      > Hi, Duncan:
>      > Duh... Thanks.  I should have been able to figure that out for
>      > myself.  Your help produced a solution much quicker.
>
>      > Thank again.
>      > Spencer
>
>
>      > On 9/3/2012 4:52 PM, Duncan Murdoch wrote:
>      >> On 12-09-03 7:25 PM, Spencer Graves wrote:
>      >>> Hi, Duncan et al.:
>      >>>
>      >>>
>      >>> I modified my CRAN() function (see below) to look for
>      >>> "_R_CHECK_TIMINGS_" and "R_CHECK_TIMINGS", but got "NOT CRAN" with "R
>      >>> CMD check --as-cran" from both.
>      >>>
>      >>>
>      >>> Suggestions?
>      >>> Thanks,
>      >>> Spencer
>      >>> p.s.  This is fda available from R-Forge via "svn checkout
>      >>> svn://svn.r-forge.r-project.org/svnroot/fda/".  It currently is
>      >>> programmed to stop no matter what.  I want it to give an error "CRAN"
>      >>> with "R CMD check --as-cran" and "NOT CRAN" without "--as-cran".
>      >>> Currently, I get "NOT CRAN" for both.
>      >>
>      >> The problem is with your test.  If I put print(names(Sys.getenv()))
>      >> into an example, I see _R_CHECK_TIMINGS_ if and only if I do the check
>      >> with --as-cran. The value is supposed to be a number, not a logical.
>      >>
>      >> Duncan Murdoch
>
> But back to the original question.
> Checking for these variables is not at all a general solution;
> If I use  'R CMD check --timings' I want to time my tests and
> actually I find this so reasonable that I've made it the default
> for me.
>
> I strongly believe we should follow the thread  Henrik has
> started and Dirk and I had followed up.

As did I.

>
> The issue is not just about "CRAN" vs "off CRAN".
> It is good to think about a more general scheme of
> "light testing" vs "normal testing" vs "extensive testing",
> e.g.,  for the situation where the package implements
> (simulation/bootstrap/ ..) based inference, and the developer
> (but not only) should be able to run the extensive tests.

I don't agree that it is good to think of it that way, as I wrote 
before.  Tests don't have a natural ordering.  I do agree that example 
(or test) code should be able to determine if certain tests have been 
enabled.  I don't know if there are any such tests where it isn't 
currently possible.

Duncan Murdoch

>
> Martin
>
>      >>> On 9/3/2012 4:41 AM, Duncan Murdoch wrote:
>      >>>> On 12-09-03 1:43 AM, Spencer Graves wrote:
>      >>>>> Hello, All:
>      >>>>>
>      >>>>>
>      >>>>> The fda package has tests that run too long for CRAN's
>      >>>>> current
>      >>>>> rules.  I'd like to wrap some examples in a construct like the
>      >>>>> following:
>      >>>>>
>      >>>>>
>      >>>>> if(!CRAN()){
>      >>>>> ...
>      >>>>> }
>      >>>>>
>      >>>>>
>      >>>>> I tried the following:
>      >>>>>
>      >>>>>
>      >>>>> CRAN <- function(x='_R_CHECK_CRAN_INCOMING_'){
>      >>>>> x. <- Sys.getenv(x)
>      >>>>> xl <- as.logical(x.)
>      >>>>> notCRAN <- is.na(xl) || xl
>      >>>>> #
>      >>>>> return(!notCRAN)
>      >>>>> }
>      >>>>>
>      >>>>>
>      >>>>> The companion help page included the following example:
>      >>>>>
>      >>>>>
>      >>>>> if(CRAN()){
>      >>>>> stop('CRAN')
>      >>>>> } else {
>      >>>>> stop('NOT CRAN')
>      >>>>> }
>      >>>>>
>      >>>>>
>      >>>>> This reported "NOT CRAN" even with "R CMD check --as-cran".
>      >>>>
>      >>>> There's no user-visible setting for --as-cran, because it just sets a
>      >>>> number of other options.  You could query one of those. The settings
>      >>>> that are visible are
>      >>>>
>      >>>> _R_CHECK_TIMINGS_  (which seems most relevant to you)
>      >>>> _R_CHECK_INSTALL_DEPENDS_
>      >>>> _R_CHECK_NO_RECOMMENDED_
>      >>>> _R_SHLIB_BUILD_OBJECTS_SYMBOL_TABLES_
>      >>>>
>      >>>> So I'd check the value in _R_CHECK_TIMINGS_, or maybe just its
>      >>>> existence.
>      >>>>
>      >>>> Duncan Murdoch
>      >>>>
>      >>>
>      >>
>
>
>      > --
>      > Spencer Graves, PE, PhD
>      > President and Chief Technology Officer
>      > Structure Inspection and Monitoring, Inc.
>      > 751 Emerson Ct.
>      > San Jos?, CA 95126
>      > ph:  408-655-4567
>      > web:  www.structuremonitoring.com
>
>      > ______________________________________________
>      > R-devel at r-project.org mailing list
>      > https://stat.ethz.ch/mailman/listinfo/r-devel
>



[Rd] if(--as-cran)?
Duncan Murdoch