From 5a36abef3eca2813ecd904479ed77ee39bb3c365 Mon Sep 17 00:00:00 2001 From: Hide Kojima Date: Wed, 29 Jul 2026 11:26:52 -0700 Subject: [PATCH] test(oracle): compare resolveOracleClientLocation home with separators neutralized The Windows daily test failed on test_system.R:1287: Expected 'resolved$home' to equal 'homeLayout'. x[1]: "C:/Users/.../file18b41bfa68e1/client64" y[1]: "C:\\Users\\...\\file18b41bfa68e1/client64" Test-only bug, not a production one. On Windows tempfile() returns backslashes, file.path() appends with a forward slash, so homeLayout is a MIXED-separator string. resolveOracleClientLocation derives home via dirname(), and dirname() on Windows rewrites every separator to a forward slash -- so the two strings describe the same directory but can never be identical() there. Mac/Linux never see it because tempfile() already returns forward slashes. Compare with the separators neutralized instead (a no-op on Mac/Linux). The assertion still pins that home is the parent of the lib directory -- the zip layout's home == "" case and the libDir assertion are untouched. Verified on the Windows daily-test box (exp-test1) against the installed package: identical() is FALSE pre-fix and TRUE post-fix; full test_system.R still passes on Mac ARM. No DESCRIPTION bump: tests only, no shipped R code change, so no rebuilt binaries are required. Co-Authored-By: Claude Opus 5 --- tests/testthat/test_system.R | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/testthat/test_system.R b/tests/testthat/test_system.R index a908cb74..45837724 100644 --- a/tests/testthat/test_system.R +++ b/tests/testthat/test_system.R @@ -1282,9 +1282,13 @@ test_that("resolveOracleClientLocation only reports an ORACLE_HOME for the lib s file.create(file.path(zipLayout, "libclntsh.dylib.23.1")) # ROracle only ever looks at $ORACLE_HOME/lib, so home is the parent of the lib directory. + # resolveOracleClientLocation derives home with dirname(), which on Windows rewrites every + # separator to a forward slash, while tempfile() hands back backslashes -- so compare with the + # separators neutralized rather than against the raw homeLayout string. (no-op on Mac/Linux) + forwardSlashes <- function(p) gsub("\\\\", "/", p) resolved <- exploratory:::resolveOracleClientLocation(homeLayout) expect_equal(resolved$libDir, file.path(homeLayout, "lib")) - expect_equal(resolved$home, homeLayout) + expect_equal(forwardSlashes(resolved$home), forwardSlashes(homeLayout)) # The zip layout cannot be expressed as an ORACLE_HOME, so home stays empty and the # caller falls back to loading the library directly.