Debug names cause failing tests
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 4d 8m
- Merged PRs (30d)
- 147
Description
## Bevy version and features
main (5058f8)
## What you did
For development, I run the tests of two crates: in particular `bevy_ecs` and `bevy_scene`.
In particular, I `cd` into `crates/bevy_ecs` and `crates/bevy_scene` and run `cargo test`.
## What went wrong
Several tests fail that don't fail in CI.
For `crates/bevy_ecs` both `simple_fallible_system` and `simple_fallible_exclusive_system` fail. The output is as follows:
Terminal ouput
```
failures:
---- system::tests::simple_fallible_system stdout ----
thread 'system::tests::simple_fallible_system' panicked at crates/bevy_ecs/src/error/handler.rs:112:1:
Encountered an error in system `Enable the debug feature to see the name`: error
2: bevy_ecs::system::tests::simple_fallible_system::sys
at ./src/system/mod.rs:1857:13
3: core::ops::function::FnMut::call_mut
at /home/aida/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:166:5
4: core::ops::function::impls:: for &mut F>::call_mut
at /home/aida/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:294:21
5: Out>>::run::call_inner
at ./src/system/function_system.rs:924:21
6: Out>>::run
at ./src/system/function_system.rs:927:17
7: as bevy_ecs::system::system::System>::run_unsafe
at ./src/system/function_system.rs:709:29
8: bevy_ecs::system::system::System::run_without_applying_deferred
at ./src/system/system.rs:139:23
note: Some "noisy" backtrace lines have been filtered out. Run with `BEVY_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
0: __rustc::rust_begin_unwind
at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library/std/src/panicking.rs:697:5
1: core::panicking::panic_fmt
at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library/core/src/panicking.rs:75:14
2: bevy_ecs::error::handler::panic
at ./src/error/handler.rs:81:9
3: bevy_ecs::error::handler::panic{{reify.shim}}
at ./src/error/handler.rs:112:1
4: ::run::{{closure}}
at ./src/schedule/executor/single_threaded.rs:138:21
5: core::ops::function::FnOnce::call_once
at /home/aida/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
6: as core::ops::function::FnOnce<()>>::call_once
at /home/aida/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/panic/unwind_safe.rs:272:9
7: std::panicking::catch_unwind::do_call
at /home/aida/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:589:40
8: __rust_try
9: std::panicking::catch_unwind
at /home/aida/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:552:19
10: std::panic::catch_unwind
at /home/aida/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:359:14
11: ::run
at ./src/schedule/executor/single_threaded.rs:151:39
12: bevy_ecs::schedule::schedule::Schedule::run
at ./src/schedule/schedule.rs:493:14
13: bevy_ecs::system::tests::run_system
at ./src/system/mod.rs:473:18
14: bevy_ecs::system::tests::simple_fallible_system
at ./src/system/mod.rs:1862:9
15: bevy_ecs::system::tests::simple_fallible_system::{{closure}}
at ./src/system/mod.rs:1855:32
16: core::ops::function::FnOnce::call_once
at /home/aida/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
17: core::ops::function::FnOnce::call_once
at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Encountered a panic in system `Enable the debug feature to see the name`!
note: panic did not contain expected string
panic message: "Encountered an error in system `Enable the debug feature to see the name`: error\n 2: bevy_ecs::system::tests::simple_fallible_system::sys\n at ./src/system/mod.rs:1857:13\n 3: core::ops::function::FnMut::call_mut\n at /home/aida/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:166:5\n 4: core::ops::function::impls:: for &mut F>::call_mut\n at /home/aida/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:294:21\n 5: Out>>::run::call_inner\n at ./src/system/function_system.rs:924:21\n 6: Out>>::run\n at ./src/system/function_system.rs:927:17\n 7: as bevy_ecs::system::system::System>::run_unsafe\n at ./src/system/function_system.rs:709:29\n 8: bevy_ecs::system::system::System::run_without_applying_deferred\n at ./src/system/system.rs:139:23\nnote: Some \"noisy\" backtrace lines have been filtered out. Run with `BEVY_BACKTRACE=full` for a verbose backtrace.\n"
expected substring: "Encountered an error in system `bevy_ecs::system::tests::simple_fallible_system::sys`: error"
---- system::tests::simple_fallible_exclusive_system stdout ----
thread 'system::tests::simple_fallible_exclusive_system' panicked at crates/bevy_ecs/src/error/handler.rs:112:1:
Encountered an error in system `Enable the debug feature to see the name`: error
2: bevy_ecs::system::tests::simple_fallible_exclusive_system::sys
at ./src/system/mod.rs:1871:13
3: core::ops::function::FnMut::call_mut
at /home/aida/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:166:5
4: core::ops::function::impls:: for &mut F>::call_mut
at /home/aida/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:294:21
5: Out>>::run::call_inner
at ./src/system/exclusive_function_system.rs:270:21
6: Out>>::run
at ./src/system/exclusive_function_system.rs:273:17
7: as bevy_ecs::system::system::System>::run_unsafe::{{closure}}
at ./src/system/exclusive_function_system.rs:135:33
8: bevy_ecs::world::World::last_change_tick_scope
at ./src/world/mod.rs:2992:9
9: as bevy_ecs::system::system::System>::run_unsafe
at ./src/system/exclusive_function_system.rs:113:15
10: bevy_ecs::system::system::System::run_without_applying_deferred
at ./src/system/system.rs:139:23
note: Some "noisy" backtrace lines have been filtered out. Run with `BEVY_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
0: __rustc::rust_begin_unwind
at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library/std/src/panicking.rs:697:5
1: core::panicking::panic_fmt
at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library/core/src/panicking.rs:75:14
2: bevy_ecs::error::handler::panic
at ./src/error/handler.rs:81:9
3: bevy_ecs::error::handler::panic{{reify.shim}}
at ./src/error/handler.rs:112:1
4: ::run::{{closure}}
at ./src/schedule/executor/single_threaded.rs:138:21
5: core::ops::function::FnOnce::call_once
at /home/aida/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
6: as core::ops::function::FnOnce<()>>::call_once
at /home/aida/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/panic/unwind_safe.rs:272:9
7: std::panicking::catch_unwind::do_call
at /home/aida/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:589:40
8: __rust_try
9: std::panicking::catch_unwind
at /home/aida/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:552:19
10: std::panic::catch_unwind
at /home/aida/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:359:14
11: ::run
at ./src/schedule/executor/single_threaded.rs:151:39
12: bevy_ecs::schedule::schedule::Schedule::run
at ./src/schedule/schedule.rs:493:14
13: bevy_ecs::system::tests::run_system
at ./src/system/mod.rs:473:18
14: bevy_ecs::system::tests::simple_fallible_exclusive_system
at ./src/system/mod.rs:1876:9
15: bevy_ecs::system::tests::simple_fallible_exclusive_system::{{closure}}
at ./src/system/mod.rs:1869:42
16: core::ops::function::FnOnce::call_once
at /home/aida/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
17: core::ops::function::FnOnce::call_once
at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Encountered a panic in system `Enable the debug feature to see the name`!
note: panic did not contain expected string
panic message: "Encountered an error in system `Enable the debug feature to see the name`: error\n 2: bevy_ecs::system::tests::simple_fallible_exclusive_system::sys\n at ./src/system/mod.rs:1871:13\n 3: core::ops::function::FnMut::call_mut\n at /home/aida/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:166:5\n 4: core::ops::function::impls:: for &mut F>::call_mut\n at /home/aida/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:294:21\n 5: Out>>::run::call_inner\n at ./src/system/exclusive_function_system.rs:270:21\n 6: Out>>::run\n at ./src/system/exclusive_function_system.rs:273:17\n 7: as bevy_ecs::system::system::System>::run_unsafe::{{closure}}\n at ./src/system/exclusive_function_system.rs:135:33\n 8: bevy_ecs::world::World::last_change_tick_scope\n at ./src/world/mod.rs:2992:9\n 9: as bevy_ecs::system::system::System>::run_unsafe\n at ./src/system/exclusive_function_system.rs:113:15\n 10: bevy_ecs::system::system::System::run_without_applying_deferred\n at ./src/system/system.rs:139:23\nnote: Some \"noisy\" backtrace lines have been filtered out. Run with `BEVY_BACKTRACE=full` for a verbose backtrace.\n"
expected substring: "Encountered an error in system `bevy_ecs::system::tests::simple_fallible_exclusive_system::sys`: error"
failures:
system::tests::simple_fallible_exclusive_system
system::tests::simple_fallible_system
test result: FAILED. 767 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.37s
error: test failed, to rerun pass `--lib`
```
For `crates/bevy_scene` the following tests broke:
- `scene_spawner::tests::scene_child_order_preserved_when_archetype_order_mismatched`
- `scene_spawner::tests::spawn_and_delete`
- `tests::dynamic_scene_spawns_and_respawns_after_change`
- `tests::scene_spawns_and_respawns_after_change`
Here the log from `cargo test` looks like
Terminal Output
```
failures:
---- scene_spawner::tests::spawn_and_delete stdout ----
thread 'scene_spawner::tests::spawn_and_delete' panicked at crates/bevy_scene/src/scene_spawner.rs:762:14:
called `Result::unwrap()` on an `Err` value: NoEntities(DebugName)
---- scene_spawner::tests::scene_child_order_preserved_when_archetype_order_mismatched stdout ----
thread 'scene_spawner::tests::scene_child_order_preserved_when_archetype_order_mismatched' panicked at crates/bevy_scene/src/scene_spawner.rs:612:35:
scene contains the unregistered type `Enable the debug feature to see the name`. consider reflecting it with `#[derive(Reflect)]` and registering the type using `app.register_type::()`
Encountered a panic in system `Enable the debug feature to see the name`!
Encountered a panic in system `Enable the debug feature to see the name`!
---- tests::scene_spawns_and_respawns_after_change stdout ----
thread 'tests::scene_spawns_and_respawns_after_change' panicked at crates/bevy_scene/src/scene_spawner.rs:612:35:
scene contains the unregistered type `Enable the debug feature to see the name`. consider reflecting it with `#[derive(Reflect)]` and registering the type using `app.register_type::()`
Encountered a panic in system `Enable the debug feature to see the name`!
Encountered a panic in system `Enable the debug feature to see the name`!
---- tests::dynamic_scene_spawns_and_respawns_after_change stdout ----
thread 'tests::dynamic_scene_spawns_and_respawns_after_change' panicked at crates/bevy_scene/src/lib.rs:358:14:
The child of the scene root should itself have 2 children
failures:
scene_spawner::tests::scene_child_order_preserved_when_archetype_order_mismatched
scene_spawner::tests::spawn_and_delete
tests::dynamic_scene_spawns_and_respawns_after_change
tests::scene_spawns_and_respawns_after_change
test result: FAILED. 35 passed; 4 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.03s
error: test failed, to rerun pass `--lib`
```
## Additional information
The reason that these tests fail is due to the tests leaning on debug names that are locked behind a feature flag. This is also what most of the failing tests suggest (there are exceptions and they may or may not have caused me 4 hours of wasted time, but that aside).
I've looked into a couple of solutions, the first one being to just run the exact code CI is running. The problem here is that my laptop runs out of RAM when running every single test for every single crate.
I've also tried enabling the debug feature for bevy_ecs, but I was not able to. This may be an issue on my part however, as I'm not all to familiar with working with feature flags.
In my opinion, `cargo test` should just run every single test and not fail, or at least ignore the feature-gated tests when the feature is not enabled.
Contributor guide
Assessment
This issue has not been assessed yet.