File tree 5 files changed +62
-9
lines changed
5 files changed +62
-9
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ status = [
13
13
" check-missing-examples-in-docs" ,
14
14
" check-unused-dependencies" ,
15
15
" ci" ,
16
+ " miri" ,
16
17
" check-benches" ,
17
18
]
18
19
Original file line number Diff line number Diff line change 70
70
# See tools/ci/src/main.rs for the commands this runs
71
71
run : cargo run -p ci -- nonlocal
72
72
73
+ miri :
74
+ runs-on : ubuntu-latest
75
+ steps :
76
+ - uses : actions/checkout@v3
77
+ - uses : actions/cache@v2
78
+ with :
79
+ path : |
80
+ ~/.cargo/bin/
81
+ ~/.cargo/registry/index/
82
+ ~/.cargo/registry/cache/
83
+ ~/.cargo/git/db/
84
+ target/
85
+ key : ${{ runner.os }}-cargo-ci-${{ hashFiles('**/Cargo.toml') }}
86
+ - uses : actions-rs/toolchain@v1
87
+ with :
88
+ toolchain : nightly
89
+ components : miri
90
+ override : true
91
+ - name : Install alsa and udev
92
+ run : sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev libwayland-dev libxkbcommon-dev
93
+ - name : CI job
94
+ run : cargo miri test -p bevy_ecs
95
+ env :
96
+ # -Zrandomize-layout makes sure we dont rely on the layout of anything that might change
97
+ RUSTFLAGS : -Zrandomize-layout
98
+ # -Zmiri-disable-isolation is needed because our executor uses `fastrand` which accesses system time.
99
+ # -Zmiri-ignore-leaks is needed because running bevy_ecs tests finds a memory leak but its impossible
100
+ # to track down because allocids are nondeterministic.
101
+ # -Zmiri-tag-raw-pointers is not strictly "necessary" but enables a lot of extra UB checks relating
102
+ # to raw pointer aliasing rules that we should be trying to uphold.
103
+ MIRIFLAGS : -Zmiri-disable-isolation -Zmiri-ignore-leaks -Zmiri-tag-raw-pointers
104
+
73
105
check-benches :
74
106
runs-on : ubuntu-latest
75
107
needs : ci
Original file line number Diff line number Diff line change @@ -637,8 +637,18 @@ mod tests {
637
637
#[ test]
638
638
fn table_add_remove_many ( ) {
639
639
let mut world = World :: default ( ) ;
640
- let mut entities = Vec :: with_capacity ( 10_000 ) ;
641
- for _ in 0 ..1000 {
640
+ #[ cfg( miri) ]
641
+ let ( mut entities, to) = {
642
+ let to = 10 ;
643
+ ( Vec :: with_capacity ( to) , to)
644
+ } ;
645
+ #[ cfg( not( miri) ) ]
646
+ let ( mut entities, to) = {
647
+ let to = 10_000 ;
648
+ ( Vec :: with_capacity ( to) , to)
649
+ } ;
650
+
651
+ for _ in 0 ..to {
642
652
entities. push ( world. spawn ( ) . insert ( B ( 0 ) ) . id ( ) ) ;
643
653
}
644
654
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ keywords = ["bevy"]
10
10
11
11
[dependencies ]
12
12
futures-lite = " 1.4.0"
13
- event-listener = " 2.4.0 "
13
+ event-listener = " 2.5.2 "
14
14
async-executor = " 1.3.0"
15
15
async-channel = " 1.4.2"
16
16
num_cpus = " 1.0.1"
Original file line number Diff line number Diff line change @@ -121,13 +121,23 @@ impl TaskPool {
121
121
let ex = Arc :: clone ( & executor) ;
122
122
let shutdown_rx = shutdown_rx. clone ( ) ;
123
123
124
- let thread_name = if let Some ( thread_name) = thread_name {
125
- format ! ( "{} ({})" , thread_name, i)
126
- } else {
127
- format ! ( "TaskPool ({})" , i)
124
+ // miri does not support setting thread names
125
+ // TODO: change back when https://github.com/rust-lang/miri/issues/1717 is fixed
126
+ #[ cfg( not( miri) ) ]
127
+ let mut thread_builder = {
128
+ let thread_name = if let Some ( thread_name) = thread_name {
129
+ format ! ( "{} ({})" , thread_name, i)
130
+ } else {
131
+ format ! ( "TaskPool ({})" , i)
132
+ } ;
133
+ thread:: Builder :: new ( ) . name ( thread_name)
134
+ } ;
135
+ #[ cfg( miri) ]
136
+ let mut thread_builder = {
137
+ let _ = i;
138
+ let _ = thread_name;
139
+ thread:: Builder :: new ( )
128
140
} ;
129
-
130
- let mut thread_builder = thread:: Builder :: new ( ) . name ( thread_name) ;
131
141
132
142
if let Some ( stack_size) = stack_size {
133
143
thread_builder = thread_builder. stack_size ( stack_size) ;
You can’t perform that action at this time.
0 commit comments