rhub icon indicating copy to clipboard operation
rhub copied to clipboard

Set environment variable _R_CHECK_TESTS_NLINES_

Open mllg opened this issue 6 years ago • 12 comments

See R internals. Otherwise the test output is truncated to the last 13 lines.

mllg avatar Mar 02 '18 13:03 mllg

You can set arbitrary environment variables if you like:

rhub::check(..., env_vars = c(_R_CHECK_TESTS_NLINES_ = 100))

Also, the complete test output is available in the artifacts, e.g. https://artifacts.r-hub.io/pingr_1.1.2.9000.tar.gz-3c6d70a956944620868e127fef35e10e/pingr.Rcheck/

We could also propagate the local setting to rhub, if you think that's a better default.

gaborcsardi avatar Mar 02 '18 13:03 gaborcsardi

I don't see a reason to stick to the arbitrary chosen 13 lines of output. I never caught myself thinking "oh, the output here is truncated so I don't see the error message ... how convenient!" ;)

For a service like r-hub, setting this env variable seems to me like the right thing to do. You might want to set it to 1000 lines instead of 0 (which disables truncation) though to avoid packages flooding log files uncontrollably.

mllg avatar Mar 05 '18 10:03 mllg

My only worry is that if we set it differently then the local and remote output will be different and that might surprise people.

But yeah, it is still better to set it higher... Will do.

gaborcsardi avatar Mar 05 '18 11:03 gaborcsardi

Would this mean adding the env variable to lines like https://github.com/r-hub/rhub-server/blob/f87426e4e99e18bfb434852cf7e2c5c4d5c51919/backend/templates/job-macos.xml#L35 or somewhere else?

maelle avatar Jan 21 '20 08:01 maelle

hereish: https://github.com/r-hub/macoscheck/blob/b9462271d6ba40a70b5b47149b962cfb5affd0c0/slave.sh#L17

  • windows + solaris + linux

gaborcsardi avatar Jan 21 '20 16:01 gaborcsardi

Anyone still working on this? Open for PRs?

MichaelChirico avatar Jul 12 '21 04:07 MichaelChirico

BTW for the copy-pasters coming here, the invocation should be more accurately be:

rhub::check(env_vars = c(`_R_CHECK_TESTS_NLINES_` = '0'))

MichaelChirico avatar Jul 12 '21 04:07 MichaelChirico

You can always see the full test output among the arfifacts. If we merge this, then the interactive output will potentially show hundreds or thousands of lines. I am not sure if that's ideal.

gaborcsardi avatar Jul 12 '21 07:07 gaborcsardi

Maybe a more sensible default is something like _R_CHECK_TESTS_NLINES=100 or even 1000 then? I certainly think 13 is far too few...

MichaelChirico avatar Jul 12 '21 07:07 MichaelChirico

Well, 13 is the default in base R, this env var is not set on R-hub by default. I think there is some value in keeping the default, so the output is the same on R-hub, as it is on a CRAN check or a local check.

gaborcsardi avatar Jul 12 '21 07:07 gaborcsardi

SGTM. If you have an FAQ, maybe this would be a good addition at least, otherwise motivated folks like me can find this issue. I leave it to you whether to keep open/close. Thanks!

MichaelChirico avatar Jul 12 '21 07:07 MichaelChirico

FWIW, I'm not sure that 13 is the default in base R. I'm running tests locally (Windows 10, R 4.1.0) and getting the full output of some print() statements. But on Rhub I only get the "last 13 lines". ::shrug::

kwstat avatar Sep 14 '21 20:09 kwstat