File tree 3 files changed +34
-2
lines changed
3 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -159,6 +159,20 @@ jobs:
159
159
rm -rf /tmp/.buildx-cache
160
160
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
161
161
162
+ miri :
163
+ name : Miri
164
+ runs-on : ubuntu-latest
165
+ steps :
166
+ - uses : actions/checkout@v4
167
+ with :
168
+ submodules : true
169
+ - name : Install Rust (rustup)
170
+ run : rustup update nightly --no-self-update && rustup default nightly
171
+ shell : bash
172
+ - run : rustup component add miri
173
+ - run : cargo miri setup
174
+ - run : ./ci/miri.sh
175
+
162
176
rustfmt :
163
177
name : Rustfmt
164
178
runs-on : ubuntu-latest
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ set -ex
3
+
4
+ # We need Tree Borrows as some of our raw pointer patterns are not
5
+ # compatible with Stacked Borrows.
6
+ export MIRIFLAGS=" -Zmiri-tree-borrows"
7
+
8
+ # One target that sets `mem-unaligned` and one that does not,
9
+ # and a big-endian target.
10
+ TARGETS=(x86_64-unknown-linux-gnu \
11
+ armv7-unknown-linux-gnueabihf \
12
+ s390x-unknown-linux-gnu)
13
+ for TARGET in " ${TARGETS[@]} " ; do
14
+ # Only run the `mem` tests to avoid this taking too long.
15
+ cargo miri test --manifest-path testcrate/Cargo.toml --features no-asm --target $TARGET -- mem
16
+ done
Original file line number Diff line number Diff line change @@ -128,11 +128,13 @@ fn memcmp_eq() {
128
128
#[ test]
129
129
fn memcmp_ne ( ) {
130
130
let arr1 @ arr2 = gen_arr :: < 256 > ( ) ;
131
- for i in 0 ..256 {
131
+ // Reduce iteration count in Miri as it is too slow otherwise.
132
+ let limit = if cfg ! ( miri) { 64 } else { 256 } ;
133
+ for i in 0 ..limit {
132
134
let mut diff_arr = arr1;
133
135
diff_arr. 0 [ i] = 127 ;
134
136
let expect = diff_arr. 0 [ i] . cmp ( & arr2. 0 [ i] ) ;
135
- for k in i + 1 ..256 {
137
+ for k in i + 1 ..limit {
136
138
let result = unsafe { memcmp ( diff_arr. 0 . as_ptr ( ) , arr2. 0 . as_ptr ( ) , k) } ;
137
139
assert_eq ! ( expect, result. cmp( & 0 ) ) ;
138
140
}
You can’t perform that action at this time.
0 commit comments