nushell: 2 quote tests fail on Windows (but not in CI)

Describe the bug

If I run Nushell tests locally on Windows (Windows 11, v10.0.22000.795), 2 tests fail:

failures:
    commands::run_external::double_quote_does_not_expand_path_glob_windows
    commands::run_external::single_quote_does_not_expand_path_glob_windows

test result: FAILED. 631 passed; 2 failed; 18 ignored; 0 measured; 0 filtered out; finished in 3.72s

For some reason these tests pass in CI but not on my local machine. ~I’m not sure exactly when this started but it’s been happening for months and I’m only getting around to filing an issue now~ (edit: I might have been thinking of another issue)

How to reproduce

Run cargo test --workspace --features=extra, observe tests failing.

Expected behavior

I expect all tests to pass.

Screenshots

No response

Configuration

key value
version 0.66.3
branch main
commit_hash 34ab4d83600a630b9e7cc89bb25dec1259d5db59
build_os windows-x86_64
build_target x86_64-pc-windows-msvc
rust_version rustc 1.62.1 (e092d0b6b 2022-07-16)
rust_channel stable-x86_64-pc-windows-msvc
cargo_version cargo 1.62.1 (a748cf5a3 2022-06-08)
pkg_version 0.66.3
build_time 2022-08-05 21:29:39 -07:00
build_rust_channel debug
features default, trash, which, zip
installed_plugins

Additional context

failures:

---- commands::run_external::double_quote_does_not_expand_path_glob_windows stdout ----
=== stderr
The filename, directory name, or volume label syntax is incorrect.

thread 'commands::run_external::double_quote_does_not_expand_path_glob_windows' panicked at 'assertion failed: actual.out.contains(\"D&D_volume_1.txt\")', crates\nu-command\tests\commands\run_external.rs:226:9
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library\std\src\panicking.rs:584
   1: core::panicking::panic_fmt
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library\core\src\panicking.rs:142
   2: core::panicking::panic
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library\core\src\panicking.rs:48
   3: main::commands::run_external::double_quote_does_not_expand_path_glob_windows::closure$0
             at .\tests\commands\run_external.rs:226
   4: nu_test_support::playground::play::Playground::setup<main::commands::run_external::double_quote_does_not_expand_path_glob_windows::closure_env$0>
             at C:\Users\reill\source\nushell\crates\nu-test-support\src\playground\play.rs:128
   5: main::commands::run_external::double_quote_does_not_expand_path_glob_windows
             at .\tests\commands\run_external.rs:213
   6: main::commands::run_external::double_quote_does_not_expand_path_glob_windows::closure$0
             at .\tests\commands\run_external.rs:212
   7: core::ops::function::FnOnce::call_once<main::commands::run_external::double_quote_does_not_expand_path_glob_windows::closure_env$0,tuple$<> >
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3\library\core\src\ops\function.rs:248
   8: core::ops::function::FnOnce::call_once
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3\library\core\src\ops\function.rs:248
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

---- commands::run_external::single_quote_does_not_expand_path_glob_windows stdout ----
=== stderr
File Not Found

thread 'commands::run_external::single_quote_does_not_expand_path_glob_windows' panicked at 'assertion failed: actual.out.contains(\"D&D_volume_1.txt\")', crates\nu-command\tests\commands\run_external.rs:258:9
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library\std\src\panicking.rs:584
   1: core::panicking::panic_fmt
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library\core\src\panicking.rs:142
   2: core::panicking::panic
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library\core\src\panicking.rs:48
   3: main::commands::run_external::single_quote_does_not_expand_path_glob_windows::closure$0
             at .\tests\commands\run_external.rs:258
   4: nu_test_support::playground::play::Playground::setup<main::commands::run_external::single_quote_does_not_expand_path_glob_windows::closure_env$0>
             at C:\Users\reill\source\nushell\crates\nu-test-support\src\playground\play.rs:128
   5: main::commands::run_external::single_quote_does_not_expand_path_glob_windows
             at .\tests\commands\run_external.rs:245
   6: main::commands::run_external::single_quote_does_not_expand_path_glob_windows::closure$0
             at .\tests\commands\run_external.rs:244
   7: core::ops::function::FnOnce::call_once<main::commands::run_external::single_quote_does_not_expand_path_glob_windows::closure_env$0,tuple$<> >
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3\library\core\src\ops\function.rs:248
   8: core::ops::function::FnOnce::call_once
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3\library\core\src\ops\function.rs:248
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (17 by maintainers)

Most upvoted comments

I created a simple test repo on Github, I still do not think the test failure is a code issue,

#[cfg(test)]
mod tests {
    #[test]
    fn it_works() {
        // Try to get version information.
        let mut process = std::process::Command::new("cmd");
        let output1 = process.arg("Get-ComputerInfo").output().expect("Oops!");

        println!("Can I get the version - {:?}",String::from_utf8(output1.stdout));

        // If the shell is `CMD` then command `ls` should return an error
        let mut process = std::process::Command::new("cmd");
        let output2 = process.args(["/D", "/c", "ls"]).output().expect("Should fail to run ls");
        println!("Start to run command ls,stdout - {:?}",String::from_utf8(output2.stdout.clone()));
        println!("Start to run command ls,stderr - {:?}",String::from_utf8(output2.stderr));

        assert!(output2.stdout.is_empty());
    }
}

The ls should return a stderr, but Github CI returned the result instead. Rather than these unit tests, I would be more concerned about how the external could widely behave differently for local vs Github CI

image

Presumably @Kangaxx-0 would have more insight here.