Skip to content

Commit 804accc

Browse files
committed
.
1 parent b25557d commit 804accc

File tree

2 files changed

+44
-3
lines changed

2 files changed

+44
-3
lines changed

src/memcpy/memcpy.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
#![no_std]
2-
#![allow(unused)]
3-
4-
use cfg_if::cfg_if;
52

63
/// The type signature of a `memcpy` function
74
pub type Memcpy = unsafe fn(dst: *mut u8, src: *const u8, bytes: usize);
@@ -23,6 +20,7 @@ fn memcpy_assert(dst: *mut u8, src: *const u8, bytes: usize) {
2320
pub mod memcpy_trivial;
2421

2522
/// Ensure sure all implementations have the same type
23+
#[allow(unused)]
2624
static ALL_MEMCPYS: &[Memcpy] = &[
2725
memcpy_trivial::memcpy,
2826
];

test.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
3+
# Test with miri and asan
4+
5+
set -x -e
6+
7+
export RUSTUP_TOOLCHAIN=nightly-2020-05-15
8+
9+
rustup toolchain install $RUSTUP_TOOLCHAIN
10+
rustup component add miri --toolchain $RUSTUP_TOOLCHAIN
11+
rustup component add rust-src --toolchain $RUSTUP_TOOLCHAIN
12+
13+
cargo install xargo
14+
15+
MIRI_DIR="$(pwd)/target/miri"
16+
ASAN_DIR="$(pwd)/target/asan"
17+
18+
if [[ -z "$SKIP_MIRI" ]]; then
19+
pushd src/memcpy
20+
cargo miri test -p memcpy --target-dir="$MIRI_DIR" -- -Zmiri-disable-isolation
21+
popd
22+
else
23+
echo "skipping miri"
24+
fi
25+
26+
# TODO test this with asan
27+
28+
export ASAN_OPTIONS="allow_addr2line=true"
29+
export RUSTFLAGS="-Zsanitizer=address"
30+
31+
set +e
32+
uname -a | grep x86_64-unknown-linux-gnu
33+
HAVE_X86=$?
34+
if [[ "$HAVE_X86" -ne 0 ]]; then
35+
SKIP_ASAN=1
36+
fi
37+
set -e
38+
39+
if [[ -z "$SKIP_ASAN" ]]; then
40+
cargo test -p memcpy --target-dir="$ASAN_DIR" --target=x86_64-unknown-linux-gnu
41+
else
42+
echo "skipping asan"
43+
fi

0 commit comments

Comments
 (0)