[Bioc-devel] Debugging when test case passes in interactive session but fails R CMD check

Dan Tenenbaum dtenenba at fhcrc.org
Thu Sep 27 05:40:38 CEST 2012


Hi Cory,

On Wed, Sep 26, 2012 at 8:19 PM, Cory Barr <barr.cory at gene.com> wrote:
> Hello.
>
> I've got a test case that completes in an interactive session but fails
> when run via R CMD check. Has anyone run into this situation, and--if
> so--found a way to reproduce the error in an interactive session?

Yes. When you run R CMD check, you are actually running a script
called "check" which can be found somewhere in R_HOME (exact location
varies depending on platform), which looks like this:

echo 'tools:::.check_packages()' | R_DEFAULT_PACKAGES= LC_COLLATE=C
"${R_HOME}/bin/R" --no-restore --slave --args ${args}

So you can simulate that with:

R_DEFAULT_PACKAGES= LC_COLLATE=C R --no-restore  --vanilla

Then in R:

tools:::.check_packages("myPkg") # you need to be in the right directory

Also, I'd be curious whether
R -f myPkg/tests/*.R
would also reproduce the error.

Or, in R:
library(RUnit)
source("mypkg/inst/unitTests/test_my_test_file.R")
test_name_of_my_test_function()


>
> In this particular case, it seems asBam is writing a temp file differently
> under R CMD check than interactively. This is my current hunch since I've
> hit issues on my system with file.rename (which asBam uses) when the "from"
> and "to" arg  refer to files on different disks. This could be going on
> here if R CMD check sets ‘TMPDIR’, ‘TMP’ or ‘TEMP’ differently than in an
> interactive session.

Are you using something other than tempfile() to create the temp
files? If so, do you get different results if you use tempfile()?




>
> Any thoughts on how to debug failing test cases in general or this issue in
> particular?

Let us know if the above helps.

Dan


>
> Thanks much for the assistance.
>
> -Cory
>
>         [[alternative HTML version deleted]]
>
>
> _______________________________________________
> Bioc-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel
>



More information about the Bioc-devel mailing list