Skip to content
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

Running tests using Bevy 0.14.0 fails on Windows #1508

Open
janhohenheim opened this issue Jul 4, 2024 · 6 comments
Open

Running tests using Bevy 0.14.0 fails on Windows #1508

janhohenheim opened this issue Jul 4, 2024 · 6 comments
Labels
C-bug Category: This is a bug. O-windows Operating system: Windows

Comments

@janhohenheim
Copy link

janhohenheim commented Jul 4, 2024

Setup

Cargo.toml
[package]
name = "minimal_doctest_fail"
version = "0.1.0"
authors = ["Jan Hohenheim <[email protected]>"]
edition = "2021"

[dependencies]
bevy = { version = "0.14.0", features = ["dynamic_linking"] }

[profile.dev]
opt-level = 1

[profile.dev.package."*"]
opt-level = 3
lib.rs
/// ```
/// use bevy::prelude::*;
/// 
/// App::new().add_plugins(DefaultPlugins);
/// ```
pub struct Foo;

Result

running 1 test
test src\lib.rs - Foo (line 1) ... FAILED

failures:

---- src\lib.rs - Foo (line 1) stdout ----
Test executable failed (exit code: 0xc000001d).

stderr:
thread 'main' panicked at C:\Users\conta\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_tasks-0.14.0\src\task_pool.rs:186:22:
Failed to spawn thread.: Os { code: 87, kind: InvalidInput, message: "The parameter is incorrect." }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace



failures:
    src\lib.rs - Foo (line 1)

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 1.28s

error: doctest failed, to rerun pass `--doc`

Additional Notes

I don't know if the fact I'm using dynamic linking is relevant for this issue.

@janhohenheim
Copy link
Author

Update: Managed to generate a smaller example that results in another error, but it pulls in another dependency:

Cargo.toml
[package]
name = "minimal_doctest_fail"
version = "0.1.0"
authors = ["Jan Hohenheim <[email protected]>"]
edition = "2021"

[dependencies]
# remove the `dynamic_linking` feature to fix the issue.
bevy = { version = "0.14.0", features = ["dynamic_linking"] }
avian3d = { git = "https://github.com/Jondolf/bevy_xpbd", branch = "avian"}

[profile.dev]
opt-level = 1

[profile.dev.package."*"]
opt-level = 3
lib.rs
/// ```
/// use bevy::prelude::*;
/// use avian3d::prelude::*;
/// 
/// App::new().add_plugins((MinimalPlugins, PhysicsPlugins::default()));
/// ```

This results in the following:

Error message
running 1 test
test src\lib.rs - Foo (line 1) ... FAILED

failures:

---- src\lib.rs - Foo (line 1) stdout ----
Test executable failed (exit code: 0xc000001d).

stderr:
thread 'main' panicked at D:\a\rustc_codegen_cranelift\rustc_codegen_cranelift\build\stdlib\library\std\src\sync\once.rs:217:20:
assertion failed: state_and_queue.addr() & STATE_MASK == RUNNING
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace



failures:
    src\lib.rs - Foo (line 1)

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 3.70s

error: doctest failed, to rerun pass `--doc`

For context, Avian is one of the two major physics engines for Bevy.

@janhohenheim
Copy link
Author

I don't think you know how this happened @Jondolf, but Avian is causing some interesting runtime failures on cranelift.

@bjorn3
Copy link
Member

bjorn3 commented Jul 4, 2024

I suspect the crash is unrelated to Avian. Are you able to get a backtrace? Does it reproduce if you move from a doctest to a standalone integration test?

@bjorn3 bjorn3 added C-bug Category: This is a bug. O-windows Operating system: Windows labels Jul 4, 2024
@janhohenheim
Copy link
Author

janhohenheim commented Jul 4, 2024

@bjorn3 running the following does indeed also trigger the first error:

#[cfg(test)]
mod tests {
    use bevy::prelude::*;

    #[test]
    fn test_bevy() {
        App::new().add_plugins(MinimalPlugins);
    }
}

results in

running 1 test
thread 'main' panicked at library\test\src\lib.rs:607:31:
failed to spawn thread to run test: The parameter is incorrect. (os error 87)
stack backtrace:
error: test failed, to rerun pass `--lib`

Caused by:
  process didn't exit successfully: `C:\Users\conta\git\janhohenheim\minimal_doctest_fail\target\debug\deps\minimal_doctest_fail-2ce86e35ecdec25f.exe --nocapture` (exit code: 0xc000001d, STATUS_ILLEGAL_INSTRUCTION)

Adding the Avian part however does not change the error and thus does not replicate my finding posted before.

All of the above does not change when I move the test into tests/minimal_test.rs.

@janhohenheim janhohenheim changed the title Running doctests on Bevy 0.14.0 fails on Windows Running tests using Bevy 0.14.0 fails on Windows Jul 19, 2024
@janhohenheim
Copy link
Author

@bjorn3 some updates: the error state_and_queue.addr() & STATE_MASK == RUNNING was confirmed to be also hit by the LLVM backend in rust-lang/rust#127979
I renamed the issue since the error The parameter is incorrect. (os error 87) can be replicated with regular tests.

@bjorn3
Copy link
Member

bjorn3 commented Nov 21, 2024

Does it work now? There have been several bug fixes related to Bevy in the past couple of months.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. O-windows Operating system: Windows
Projects
None yet
Development

No branches or pull requests

2 participants