Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistency between how bin/tests and bin/R run scripts #1259

Open
fikovnik opened this issue Nov 8, 2023 · 1 comment
Open

Inconsistency between how bin/tests and bin/R run scripts #1259

fikovnik opened this issue Nov 8, 2023 · 1 comment
Labels

Comments

@fikovnik
Copy link
Collaborator

fikovnik commented Nov 8, 2023

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:

    dyn.load('/home/krikava/Rsh/rir/build/debug/librir.so')
    source('/home/krikava/Rsh/rir/tools/../rir/R/rir.R')
  • R wrapper

    it calls external/custom-r/bin/R with the following two environment variables:

    EXTRA_LOAD_SO=/home/krikava/Rsh/rir/build/debug/librir.so 
    EXTRA_LOAD_R=/home/krikava/Rsh/rir/tools/../rir/R/rir.R

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.

@fikovnik fikovnik added the bug label Nov 8, 2023
@fikovnik
Copy link
Collaborator Author

fikovnik commented Nov 8, 2023

An easy(tm) fix could be to just use source or keep sys.source in the Rprofile, but do not create the temp files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant