8000 tests: fix execution on WSL2, Ubuntu 24.04 by martinkunkel2 · Pull Request #8235 · uutils/coreutils · GitHub
[go: up one dir, main page]

Skip to content

tests: fix execution on WSL2, Ubuntu 24.04 #8235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

martinkunkel2
Copy link

I tried to run

cargo nextest run --features unix

in WSL2, which results in a few failing tests

     Summary [  53.695s] 3949 tests run: 3939 passed, 10 failed, 46 skipped
        FAIL [   0.029s] coreutils::tests test_cp::test_cp_debug_default_sparse_virtual_file
        FAIL [   0.045s] coreutils::tests test_cp::test_cp_debug_sparse_always_sparse_virtual_file
        FAIL [   0.057s] coreutils::tests test_cp::test_cp_default_virtual_file
        FAIL [   0.356s] coreutils::tests test_date::test_date_tz
        FAIL [   0.155s] coreutils::tests test_date::test_date_tz_various_formats
        FAIL [   0.043s] coreutils::tests test_head::test_read_backwards_bytes_proc_fs_modules
        FAIL [   0.024s] coreutils::tests test_head::test_read_backwards_bytes_sys_kernel_profiling
        FAIL [   0.042s] coreutils::tests test_head::test_read_backwards_lines_proc_fs_modules
        FAIL [   0.041s] coreutils::tests test_logname::test_normal
        FAIL [   0.022s] coreutils::tests test_wc::test_files_from_pseudo_filesystem

This pull request skips incompatible parts of tests to ensure that they execute 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.

Test environment:

$ cat /proc/sys/kernel/osrelease 
5.15.167.4-microsoft-standard-WSL2

$ cat /etc/os-release 
PRETTY_NAME="Ubuntu 24.04.2 LTS"
NAME="Ubuntu"
VERSION_ID="24.04"
VERSION="24.04.2 LTS (Noble Numbat)"
VERSION_CODENAME=noble

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.
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/misc/stdbuf (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)

@sylvestre
Copy link
Contributor

Would it be possible to add a job in github to verify that we don't regress?

@martinkunkel2
Copy link
Author

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.
Am I allowed to use this setup-wsl2 action?

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.

@martinkunkel2
Copy link
Author

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.

@sylvestre
Copy link
Contributor

yeah, no worries for the action

This will setup WSL2 on windows-latest runner, install
Ubuntu-24.04, and run the feat_os_unix tests.
@martinkunkel2
Copy link
Author

@sylvestre : I added a new workflow for WSL2.
It uses Vampire/setup-wsl to install WSL2 on windows-latest runners.

Here is a test execution: https://github.com/martinkunkel2/coreutils/actions/runs/15799503167/job/44535926995

Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/misc/stdbuf (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0