Sometimes one gets an error while running bin/tests that cannot be reproduced manually by running the failing test using bin/R -f.
The reason is that the testing harness in bin/tests and the R wrapper bin/R behave differently in how the load Ř.
test harness
for each test, it creates a new temp file into which it copies the content of the test and prepends the following two lines:
The actual difference is that the code from EXTRA_LOAD_R is our own hook into the start of the R VM (implemented in library/base/R/Rprofile) which does load the file using sys.source.
The sys.source function is different from source. Among other, it evals the file in base environment.
Using two different way is not great since each executes different R code which in turns affects the compile heuristics.
Sometimes one gets an error while running
bin/tests
that cannot be reproduced manually by running the failing test usingbin/R -f
. The reason is that the testing harness inbin/tests
and the R wrapperbin/R
behave differently in how the load Ř.test harness
for each test, it creates a new temp file into which it copies the content of the test and prepends the following two lines:
R wrapper
it calls
external/custom-r/bin/R
with the following two environment variables:The actual difference is that the code from
EXTRA_LOAD_R
is our own hook into the start of the R VM (implemented inlibrary/base/R/Rprofile
) which does load the file usingsys.source
. Thesys.source
function is different fromsource
. Among other, it evals the file in base environment.Using two different way is not great since each executes different R code which in turns affects the compile heuristics.