tests: fix execution on WSL2, Ubuntu 24.04#8235
Conversation
|
GNU testsuite comparison: |
|
Would it be possible to add a job in github to verify that we don't regress? |
Never tried to run WSL2 in github actions, but I will try. I see that there exists action https://github.com/vedantmgoyal9/setup-wsl2 to setup WSL2 on windows runners. If yes, I would create a new workflow file, a bit similar to freebsd or android and execute the tests based on the setup-wsl2 action. |
|
will also check https://github.com/marketplace/actions/setup-wsl. This supports setting user instead of root, which should make this even more compatible with local exection. |
|
yeah, no worries for the action |
|
@sylvestre : I added a new workflow for WSL2. Here is a test execution: https://github.com/martinkunkel2/coreutils/actions/runs/15799503167/job/44535926995 |
|
GNU testsuite comparison: |
|
@sylvestre : this is ready from my side. Please provide feedback if the new workflow should be added or not. |
|
GNU testsuite comparison: |
Skip incompatible parts of tests to ensure that
cargo nextest run --features unix
executes successfully in WSL2, Ubuntu 24.04 distribution.
Changes
* Skip tests that required sys/kernel/profiling which is not
available in WSL2 default configuration.
* Use timezones in tests that are part of the standard tzdata
list and not only available in backwards list. Backwards list is
not installed by default in Ubuntu 24.04 (package tzdata-legacy).
* check that /proc/modules is not empty when expecting content,
because it is empty in WSL2 default configuration.
* Skip logname test not only in WSL1, also in WSL2.
This will setup WSL2 on windows-latest runner, install Ubuntu-24.04, and run the feat_os_unix tests.
28ffdbc to
bee1c22
Compare
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
There was a problem hiding this comment.
Pull Request Overview
This PR fixes test execution issues on WSL2 with Ubuntu 24.04 by adding compatibility checks and skipping tests for features not available in the default WSL2 configuration.
- Adds WSL2 compatibility checks for tests that depend on kernel features not available by default
- Skips tests requiring
/sys/kernel/profilingwhen the file doesn't exist - Handles empty
/proc/modulesfile in WSL2 environments - Extends logname test skip condition to cover both WSL1 and WSL2
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/by-util/test_wc.rs | Adds check for /sys/kernel/profiling existence before running profiling-related test |
| tests/by-util/test_logname.rs | Changes WSL skip condition from WSL1-only to both WSL1 and WSL2 |
| tests/by-util/test_head.rs | Adds checks for file existence and non-empty content for /proc/modules and /sys/kernel/profiling |
| tests/by-util/test_cp.rs | Adds /sys/kernel/profiling existence checks for three virtual file copy tests |
| src/uucore/src/lib/mods/os.rs | Adds new is_wsl() function that combines WSL1 and WSL2 detection |
| .github/workflows/wsl2.yml | Adds GitHub Actions workflow for testing on WSL2 environment |
Comments suppressed due to low confidence (1)
tests/by-util/test_wc.rs:482
- This closing brace appears to be misplaced. It should be part of the conditional block above, not a separate statement.
}
|
GNU testsuite comparison: |
I tried to run
in WSL2, which results in a few failing tests
This pull request skips incompatible parts of tests to ensure that they execute successfully in WSL2, Ubuntu 24.04 distribution.
Changes
Test environment: