Repository navigation
Enable the R test suite on Windows (test runner + fixes) - #18069
Conversation
| # On Windows the dev/test session runs in a non-UTF-8 (CP1252) locale. There, | ||
| # base R and our hooks report non-ASCII names with different encodings, our | ||
| # hooks differ only cosmetically in path separators (mixed '\' and '/' and | ||
| # redundant slashes), and -- most importantly -- base R cannot enumerate | ||
| # non-ASCII names at all while our hooks (wide Win32 API) can. So on Windows | ||
| # we normalize encoding and separators and drop non-ASCII names before | ||
| # comparing; the assertion after the loops confirms the hooks DO surface the | ||
| # non-ASCII entries base R misses. Every other platform keeps the strict | ||
| # comparison. | ||
| normalizeListing <- function(x) { | ||
| if (!.rs.platform.isWindows) | ||
| return(x) | ||
| x <- enc2utf8(x) | ||
| x <- chartr("\\", "/", x) | ||
| x <- gsub("/+", "/", x) | ||
| x <- x[!grepl("[^\x01-\x7f]", x)] | ||
| sort(x) | ||
| } | ||
|
|
There was a problem hiding this comment.
Nit: R 4.2 and newer should default to a UTF-8 locale, so this block is probably only necessary for older R, or if the locale explicitly seems to be non-UTF-8.
There was a problem hiding this comment.
But also fine to leave as is.
There was a problem hiding this comment.
I was using 4.6.0 and for whatever reason it was not using utf8, but a codepage. 🤷♂️
🍎 macOS Desktop E2E · ARM64✅ All tests passed!
📥 Download Playwright report⬇️ playwright-report.zip — extract and open
2 shards · macos-26 ARM64 · commit |
🪟 Windows Desktop E2E · Server 2025 x64✅ All tests passed!
📥 Download Playwright report⬇️ playwright-report.zip — extract and open
2 shards · Windows Server 2025 x64 · commit |
Summary
First step towards solving #17825.
Brings the Windows test runner (
src/cpp/rstudio-tests.bat) to parity with the Unixrunner so the same test categories can run in CI, and fixes the issues that surfaced
once the R (
testthat) suite actually ran on Windows.Test runner
rstudio-tests.bat.into use the same--scope(core/rserver/rsession/r) and--filterinterface asrstudio-tests.in.coreruns core +shared_core(+server_corewhen built);rserveris skipped when its binary is notbuilt (desktop builds); the new
rscope runs thetestthatsuite.--filterimplies--scope r. With no arguments, all scopes run.now records each suite's exit code (and the
testthatfailure count for therscope),runs every requested scope, and exits non-zero if any failed.
R_HOME/R_DOC_DIR/R_LIB_DIR) and a fresh temporaryRSTUDIO_DATA_HOME/RSTUDIO_CONFIG_HOMEfor therscope.Jenkinsfile.windows: update the call torstudio-tests.bat --scope core.Session changes (required for the R suite to run and pass on Windows)
--run-scriptno longer prompts to save the workspace. On Windows, R's nativecleanup runs at script end and showed a modal "Save workspace image?" dialog, which
hangs an unattended/CI run. A headless script run now resolves the save action to
no-save (
saveWorkspaceAction).SessionThemes.cppusedstd::getenv, which on Windows does not observeSys.setenvfrom a running R session, so the theme tests'
RS_THEME_*_HOMEredirection was ignoredand installs/discovery used the real default directories. Switched to
core::system::getenv(equivalent on POSIX; reads the live Win32 environment onWindows).
Test changes (Windows-only; other platforms unchanged)
test-files.R: in a non-UTF-8 (CP1252) Windows session, base R reports non-ASCII namesin a different encoding and cannot enumerate them, while the RStudio hooks can and differ
only in path-separator style. On Windows the comparison now normalizes encoding and
separators and excludes non-ASCII names (base R cannot list them), and separately asserts
that the hooks do list the non-ASCII entries base R misses. Non-Windows keeps the strict
comparison.
test-themes.R: skip the two POSIX file-permission tests on Windows, whereSys.chmod("0555")does not deny writes so the expected error is never raised.Verification
On Windows:
coreandrsessionpass;--scope rruns 3715testthatassertions withno failures or warnings; the full no-argument run exits 0. Failure propagation was
confirmed: a failing suite prints a diagnostic to stderr and the run exits 1 while still
running the remaining suites.
This is a developer / CI tooling change and is not associated with a GitHub issue.