Skip to content

Commit 93cc250

Browse files
authored
Add CI in Intel's instruction emulator (rust-lang#113)
This commit adds a new builder on CI for running tests in Intel's own emulator and also adds an assertion that on this emulator no tests are skipped due to missing CPU features by accident. Closes rust-lang#92
1 parent ac1e68a commit 93cc250

File tree

5 files changed

+28
-2
lines changed

5 files changed

+28
-2
lines changed

Diff for: .travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ matrix:
88
- env: TARGET=i586-unknown-linux-gnu
99
- env: TARGET=i686-unknown-linux-gnu
1010
- env: TARGET=x86_64-unknown-linux-gnu NO_ADD=1
11+
- env: TARGET=x86_64-unknown-linux-gnu-emulated NO_ADD=1 STDSIMD_TEST_EVERYTHING=1
1112
- env: TARGET=arm-unknown-linux-gnueabihf
1213
- env: TARGET=armv7-unknown-linux-gnueabihf
1314
- env: TARGET=aarch64-unknown-linux-gnu
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM ubuntu:17.04
2+
RUN apt-get update && apt-get install -y --no-install-recommends \
3+
gcc \
4+
libc6-dev \
5+
file \
6+
make \
7+
ca-certificates \
8+
curl \
9+
bzip2
10+
11+
RUN curl https://s3-us-west-1.amazonaws.com/rust-lang-ci2/rust-ci-mirror/sde-external-8.9.0-2017-08-06-lin.tar.bz2 | \
12+
tar xjf -
13+
ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER="/sde-external-8.9.0-2017-08-06-lin/sde64 --"

Diff for: ci/run-docker.sh

+5-2
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,23 @@ run() {
77
echo $1
88
docker build -t stdsimd ci/docker/$1
99
mkdir -p target
10+
target=$(echo $1 | sed 's/-emulated//')
1011
docker run \
1112
--user `id -u`:`id -g` \
1213
--rm \
1314
--init \
1415
--volume $HOME/.cargo:/cargo \
1516
--env CARGO_HOME=/cargo \
1617
--volume `rustc --print sysroot`:/rust:ro \
17-
--env TARGET=$1 \
18+
--env TARGET=$target \
19+
--env STDSIMD_TEST_EVERYTHING \
1820
--volume `pwd`:/checkout:ro \
1921
--volume `pwd`/target:/checkout/target \
2022
--workdir /checkout \
23+
--privileged \
2124
stdsimd \
2225
bash \
23-
-c 'PATH=$PATH:/rust/bin exec ci/run.sh $1'
26+
-c 'PATH=$PATH:/rust/bin exec ci/run.sh'
2427
}
2528

2629
if [ -z "$1" ]; then

Diff for: stdsimd-test/simd-test-macro/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ pub fn simd_test(attr: proc_macro::TokenStream,
5151
fn #name() {
5252
if cfg_feature_enabled!(#target_feature) {
5353
return unsafe { #name() };
54+
} else {
55+
::stdsimd_test::assert_skip_test_ok(stringify!(#name));
5456
}
5557

5658
#[target_feature = #enable_feature]

Diff for: stdsimd-test/src/lib.rs

+7
Original file line numberDiff line numberDiff line change
@@ -294,3 +294,10 @@ pub fn assert(fnptr: usize, fnname: &str, expected: &str) {
294294
panic!("too many instructions in the disassembly");
295295
}
296296
}
297+
298+
pub fn assert_skip_test_ok(name: &str) {
299+
if env::var("STDSIMD_TEST_EVERYTHING").is_err() {
300+
return
301+
}
302+
panic!("skipped test `{}` when it shouldn't be skipped", name);
303+
}

0 commit comments

Comments
 (0)