Hi Dan. Thanks for the informative response.

>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

This does work and reproduces the error in an interactive session.
Unfortunately, I get "Execution halted" and the session terminates before
options(error=recover) kicks in. So I'm not able to see the values of
variables in asBam prior to the failure.

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

Nope, I get this:

gmapR RUnit Tests - 23 test functions, 0 errors, 0 failures
Number of test functions: 23
Number of errors: 0
Number of failures: 0

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

Nope, it didn't reproduce. (I added library(gmapR) to the above commands.)
I get RUnit returning TRUE.

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

I'm calling asBam, which calls ofl <- tempfile().  ofl is then passed to
Rsamtools:::.file.rename.  I'm wondering if conditions are being handled
differently when run under R CMD check vs a normal interactive session.
 Possibly I can trace asBam and step through the code to see what going
on...

-Cory

On Wed, Sep 26, 2012 at 8:40 PM, Dan Tenenbaum <dtenenba@fhcrc.org> wrote:

> Hi Cory,
>
> On Wed, Sep 26, 2012 at 8:19 PM, Cory Barr <barr.cory@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@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/bioc-devel
> >
>

	[[alternative HTML version deleted]]

