[Rcpp-devel] How to manage testing code for Rcpp based project?

Dirk Eddelbuettel edd at debian.org
Sat Aug 4 19:17:30 CEST 2012


On 4 August 2012 at 11:48, Peng Yu wrote:
| > Seriously:  please think through what you are suggesting here. We are talking
| > about __compiled language__ and outside of a time machine I see very few
| > tools that would permit you to __test before installation__.
| 
| You clearly exaggerated my point.

Well, sorry, I wasn't quite clear what your point was.
 
| For example, if you have 100 Rcpp based files in your package. But you
| just changed 1 file. To test this 1 file, you have to compile the
| whole package which take the time to compile all the 100 Rcpp files. A
| more efficient way is just to compile the file that was changed and
| possibly other files that depends on it.

Ok, that's more to the point.  Using the script I posted in my last email,
you can just call a single unit test file at a time (see below).

And the single best tricks to making the repeated installations of package
during development easier are

  -- using something like ccache to "cache" compilation units, unchanged
     files are "compiled" instantaneously; on my Linux system that is as each
     as having this in ~/.R/Makeconf:

     VER=4.6
     CC=ccache gcc-$(VER)
     CXX=ccache g++-$(VER)
     SHLIB_CXXLD=g++-$(VER)
     FC=ccache gfortran
     F77=ccache gfortran

  -- being clever with the options to R CMD INSTALL and R CMD check, eg when
     you are testing / building new code there is no need to rebuild the
     vignette etc pp

Hope this help.  Example below.

Dirk



edd at max:~/svn/rcpp/pkg/Rcpp/inst/unitTests$ ~/bin/runit.sh -p Rcpp runit.Date.R 


Executing test function test.Date.components  ...  done successfully.



Executing test function test.Date.ctor.int  ... Error in fun("foo") : not compatible with INTSXP
 done successfully.



Executing test function test.Date.ctor.mdy  ...  done successfully.



Executing test function test.Date.ctor.sexp  ...  done successfully.



Executing test function test.Date.ctor.string  ...  done successfully.



Executing test function test.Date.ctor.ymd  ...  done successfully.



Executing test function test.Date.getFunctions  ...  done successfully.



Executing test function test.Date.operators  ...  done successfully.



Executing test function test.Datetime.fromString  ...  done successfully.



Executing test function test.Datetime.get.functions  ...  done successfully.



Executing test function test.Datetime.operators  ...  done successfully.



Executing test function test.Datetime.wrap  ...  done successfully.



Executing test function test.DateVector.operator.SEXP  ...  done successfully.



Executing test function test.DateVector.wrap  ...  done successfully.



Executing test function test.vector.Date  ...  done successfully.

edd at max:~/svn/rcpp/pkg/Rcpp/inst/unitTests$ 


-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com  


More information about the Rcpp-devel mailing list