mirror of
https://github.com/uutils/coreutils.git
synced 2025-08-04 11:00:14 +00:00

* tests: fix execution on WSL2, Ubuntu 24.04 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. * Add workflow for WSL2 This will setup WSL2 on windows-latest runner, install Ubuntu-24.04, and run the feat_os_unix tests. * wsl2: implemented review findings --------- Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
31 lines
917 B
Rust
31 lines
917 B
Rust
// This file is part of the uutils coreutils package.
|
|
//
|
|
// For the full copyright and license information, please view the LICENSE
|
|
// file that was distributed with this source code.
|
|
use std::env;
|
|
use uutests::new_ucmd;
|
|
use uutests::util::is_ci;
|
|
|
|
#[test]
|
|
fn test_invalid_arg() {
|
|
new_ucmd!().arg("--definitely-invalid").fails_with_code(1);
|
|
}
|
|
|
|
#[test]
|
|
fn test_normal() {
|
|
let result = new_ucmd!().run();
|
|
println!("env::var(CI).is_ok() = {}", env::var("CI").is_ok());
|
|
|
|
for (key, value) in env::vars() {
|
|
println!("{key}: {value}");
|
|
}
|
|
if (is_ci() || uucore::os::is_wsl()) && result.stderr_str().contains("no login name") {
|
|
// ToDO: investigate WSL failure
|
|
// In the CI, some server are failing to return logname.
|
|
// As seems to be a configuration issue, ignoring it
|
|
return;
|
|
}
|
|
|
|
result.success();
|
|
assert!(!result.stdout_str().trim().is_empty());
|
|
}
|