You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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_dir using 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
nothing set in Windows env
... and runs it - as the win32 workflow in GitHub actions - for all Ruby versions supported on the Windows platform.
!!️ CLICK to see batch script output for "head" version of Ruby on Windows
---------------------------------------------------------------
platform: Windows / branch:
---------------------------------------------------------------
1/5 - %HOME% setin 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% setin 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% setin 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% setin 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 setin Windows env
---------------------------------------------------------------
Ruby *always* sets HOME [and USER for that matter]
in*its* environment, even if these are not setin
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 passed
This comprehensive testing approach ensures that the removal of Rake::Win32::win32_system_dir in #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.
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.
Uh oh!
There was an error while loading. Please reload this page.
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.This 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.