[R-pkg-devel] Testthat environment using sourceCpp
Charles Determan
cdetermanjr at gmail.com
Fri Sep 29 18:50:25 CEST 2017
Greetings,
I am trying to create some unit tests for a Rcpp::sourceCpp call. It
includes some dependencies with the // [[Rcpp::depends]] flag and compiles
and passes if I call the test file with testthat::test_file. However, if I
try to call it with devtools::test() to run all of my tests, the
compilation will fail. I have discovered that this is because of the way
it is trying to find the relevant headers.
The correct call should be:
g++ -std=gnu++11 -I"C:/Users/mydir/DOCUME~1/R/R-34~1.0/include" -DNDEBUG
-I"C:/Users/mydir/Documents/R/R-3.4.0/library/Rcpp/include"
-I"C:/Users/mydir/Documents/R/R-3.4.0/library/BH/include"
-I"C:/Users/mydir/Documents/R/R-3.4.0/library/RcppEigen/include"
-I"C:/Users/mydir/Documents/R/R-3.4.0/library/RViennaCL/include" -
*I"C:/Users/mydir/Documents/R/R-3.4.0/library/gpuR/include"*
-I"C:/Users/mydir/AppData/Local/Temp/Rtmp4MX4Mi"
-I"d:/Compiler/gcc-4.9.3/local330/include" -O2 -Wall -mtune=core2 -c
file32503f79470f.cpp -o file32503f79470f.o
but instead it is looking locally within the package for the 'include'
directory
g++ -std=gnu++11 -I"C:/Users/mydir/DOCUME~1/R/R-34~1.0/include" -DNDEBUG
-I"C:/Users/mydir/Documents/R/R-3.4.0/library/Rcpp/include"
-I"C:/Users/mydir/Documents/R/R-3.4.0/library/BH/include"
-I"C:/Users/mydir/Documents/R/R-3.4.0/library/RcppEigen/include"
-I"C:/Users/mydir/Documents/R/R-3.4.0/library/RViennaCL/include" -
*I"C:/Users/mydir/Documents/R_projects/gpuR/include"*
-I"C:/Users/mydir/AppData/Local/Temp/Rtmp4MX4Mi"
-I"d:/Compiler/gcc-4.9.3/local330/include" -O2 -Wall -mtune=core2 -c
file32503f79470f.cpp -o file32503f79470f.o
This directory is within the 'inst' directory and therefore not found when
an internal header file is referenced. Any thoughts both why this is
different when call the 'devtools::test()' versus calling the individual
'testthat::test_file()'?
Regards,
Charles
[[alternative HTML version deleted]]
More information about the R-package-devel
mailing list