[DON'T MERGE] win32_system_dir comparison script & GitHub action
#670
+187
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before removing it in #669 this draft PR (submitted as evidence only for the other PR) is intended to validate the equivalency of two approaches for determining Rake's "standard system directory" on Windows platforms, using "real life" scenarios that cannot be correctly reproduced in the unit tests.
The ultimate goal is to prove that Rake's custom Windows-specific implementation (
Rake::Win32::win32_system_dir) produces identical results to Ruby's standard library approach (File.join(Dir.home, "Rake")), thereby demonstrating that the Rake-specific patch is superfluous and can be safely removed.The Windows batch script calculates and compares the value for
win32_system_dirusing both approaches for the 5 scenarios also covered by the unit tests:%%HOME%%set in Windows env%%HOMEDRIVE%%and%%HOMEPATH%%set in Windows env%%APPDATA%%set in Windows env%%USERPROFILE%%set in Windows env... and runs it - as the
win32workflow in GitHub actions - for all Ruby versions supported on the Windows platform.--------------------------------------------------------------- platform: Windows / branch: --------------------------------------------------------------- 1/5 - %HOME% set in Windows env --------------------------------------------------------------- [Windows] %HOME%=C:\HP [Windows] %HOMEDRIVE%= [Windows] %HOMEPATH%= [Windows] %APPDATA%= [Windows] %USERPROFILE%= [Ruby] ENV["HOME"] = C:\HP [Ruby] ENV["HOMEDRIVE"] = nil [Ruby] ENV["HOMEPATH"] = nil [Ruby] ENV["APPDATA"] = nil [Ruby] ENV["USERPROFILE"] = nil [Ruby] File.join(Dir.home, "Rake") => C:/HP/Rake [Rake] Rake::Win32::win32_system_dir => C:/HP/Rake ✅ PASS: Values match --------------------------------------------------------------- 2/5 - %HOMEDRIVE% and %HOMEPATH% set in Windows env --------------------------------------------------------------- [Windows] %HOME%= [Windows] %HOMEDRIVE%=C: [Windows] %HOMEPATH%=\HP [Windows] %APPDATA%= [Windows] %USERPROFILE%= [Ruby] ENV["HOME"] = C:/HP [Ruby] ENV["HOMEDRIVE"] = C: [Ruby] ENV["HOMEPATH"] = \HP [Ruby] ENV["APPDATA"] = nil [Ruby] ENV["USERPROFILE"] = nil [Ruby] File.join(Dir.home, "Rake") => C:/HP/Rake [Rake] Rake::Win32::win32_system_dir => C:/HP/Rake ✅ PASS: Values match --------------------------------------------------------------- 3/5 - %APPDATA% set in Windows env --------------------------------------------------------------- [Windows] %HOME%= [Windows] %HOMEDRIVE%= [Windows] %HOMEPATH%= [Windows] %APPDATA%=C:\Documents and Settings\HP\Application Data [Windows] %USERPROFILE%= [Ruby] ENV["HOME"] = C:/Users/runneradmin [Ruby] ENV["HOMEDRIVE"] = nil [Ruby] ENV["HOMEPATH"] = nil [Ruby] ENV["APPDATA"] = C:\Documents and Settings\HP\Application Data [Ruby] ENV["USERPROFILE"] = nil [Ruby] File.join(Dir.home, "Rake") => C:/Users/runneradmin/Rake [Rake] Rake::Win32::win32_system_dir => C:/Users/runneradmin/Rake ✅ PASS: Values match --------------------------------------------------------------- 4/5 - %USERPROFILE% set in Windows env --------------------------------------------------------------- [Windows] %HOME%= [Windows] %HOMEDRIVE%= [Windows] %HOMEPATH%= [Windows] %APPDATA%= [Windows] %USERPROFILE%=C:\Documents and Settings\HP [Ruby] ENV["HOME"] = C:/Documents and Settings/HP [Ruby] ENV["HOMEDRIVE"] = nil [Ruby] ENV["HOMEPATH"] = nil [Ruby] ENV["APPDATA"] = nil [Ruby] ENV["USERPROFILE"] = C:\Documents and Settings\HP [Ruby] File.join(Dir.home, "Rake") => C:/Documents and Settings/HP/Rake [Rake] Rake::Win32::win32_system_dir => C:/Documents and Settings/HP/Rake ✅ PASS: Values match --------------------------------------------------------------- 5/5 - nothing set in Windows env --------------------------------------------------------------- Ruby *always* sets HOME [and USER for that matter] in *its* environment, even if these are not set in the Windows environment. https://github.com/ruby/ruby/commit/c41cefd492 --------------------------------------------------------------- [Windows] %HOME%= [Windows] %HOMEDRIVE%= [Windows] %HOMEPATH%= [Windows] %APPDATA%= [Windows] %USERPROFILE%= [Ruby] ENV["HOME"] = C:/Users/runneradmin [Ruby] ENV["HOMEDRIVE"] = nil [Ruby] ENV["HOMEPATH"] = nil [Ruby] ENV["APPDATA"] = nil [Ruby] ENV["USERPROFILE"] = nil [Ruby] File.join(Dir.home, "Rake") => C:/Users/runneradmin/Rake [Rake] Rake::Win32::win32_system_dir => C:/Users/runneradmin/Rake ✅ PASS: Values match ---------------------------------- ✅ OVERALL RESULT: All tests passedThis comprehensive testing approach ensures that the removal of
Rake::Win32::win32_system_dirin #669 is both safe and well-validated across the entire ecosystem of supported Ruby versions and Windows environment configurations.Note
Once #669 has been reviewed, approved and merged, this PR can be closed.