Skip to content

Commit d166a30

Browse files
committed
Overhaul tests
* Move everything to azure pipelines * Inline docker configuration in this repo (no `cross`) * Delete `no-panic` example, use `#[no_panic]` instead.
1 parent 28c69b4 commit d166a30

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+313
-385
lines changed

.travis.yml

Lines changed: 0 additions & 58 deletions
This file was deleted.

Cargo.toml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,30 @@ documentation = "https://docs.rs/libm"
66
keywords = ["libm", "math"]
77
license = "MIT OR Apache-2.0"
88
name = "libm"
9-
repository = "https://github.com/japaric/libm"
9+
repository = "https://github.com/rust-lang-nursery/libm"
1010
version = "0.1.2"
1111
edition = "2018"
1212

1313
[features]
1414
# only used to run our test suite
15-
checked = []
1615
default = ['stable']
1716
stable = []
17+
18+
# Generate tests which are random inputs and the outputs are calculated with
19+
# musl libc.
1820
musl-reference-tests = ['rand']
1921

22+
# Used checked array indexing instead of unchecked array indexing in this
23+
# library.
24+
checked = []
25+
2026
[workspace]
2127
members = [
2228
"crates/compiler-builtins-smoke-test",
2329
]
2430

31+
[dev-dependencies]
32+
no-panic = "0.1.8"
33+
2534
[build-dependencies]
2635
rand = { version = "0.6.5", optional = true }

azure-pipelines.yml

Lines changed: 33 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,18 @@ jobs:
1010
env:
1111
TOOLCHAIN: nightly
1212
- bash: rustup target add $TARGET
13-
displayName: "Install rust cross target"
14-
- bash: |
15-
set -e
16-
mkdir cross
17-
curl -L https://github.com/rust-embedded/cross/releases/download/v0.1.14/cross-v0.1.14-x86_64-unknown-linux-musl.tar.gz | tar xzf - -C $HOME/.cargo/bin
18-
displayName: "Install cross"
19-
- bash: cross test --lib --features checked --target $TARGET --release
20-
displayName: "Run lib tests"
21-
- bash: cross test --tests --features checked --target $TARGET --release
22-
displayName: "Run integration tests"
13+
- template: ci/azure-install-rust.yml
14+
- bash: cargo generate-lockfile && ./ci/run-docker.sh $TARGET
2315
strategy:
2416
matrix:
2517
aarch64:
2618
TARGET: aarch64-unknown-linux-gnu
27-
armhv:
19+
arm:
20+
TARGET: arm-unknown-linux-gnueabi
21+
armhf:
2822
TARGET: arm-unknown-linux-gnueabihf
2923
armv7:
3024
TARGET: armv7-unknown-linux-gnueabihf
31-
i586:
32-
TARGET: i586-unknown-linux-gnu
3325
i686:
3426
TARGET: i686-unknown-linux-gnu
3527
mips:
@@ -47,97 +39,31 @@ jobs:
4739
x86_64:
4840
TARGET: x86_64-unknown-linux-gnu
4941

50-
# - job: Linux
51-
# pool:
52-
# vmImage: ubuntu-16.04
53-
# steps:
54-
# - template: ci/azure-test-all.yml
55-
# strategy:
56-
# matrix:
57-
# stable:
58-
# TOOLCHAIN: stable
59-
# beta:
60-
# TOOLCHAIN: beta
61-
# nightly:
62-
# TOOLCHAIN: nightly
63-
#
64-
# - job: macOS
65-
# pool:
66-
# vmImage: macos-10.13
67-
# steps:
68-
# - template: ci/azure-test-all.yml
69-
# strategy:
70-
# matrix:
71-
# x86_64:
72-
# TARGET: x86_64-apple-darwin
73-
#
74-
# - job: iOS
75-
# pool:
76-
# vmImage: macos-10.13
77-
# steps:
78-
# - checkout: self
79-
# submodules: true
80-
# - template: ci/azure-install-rust.yml
81-
# - script: rustup target add $TARGET
82-
# displayName: "Install rust cross target"
83-
# - bash: |
84-
# set -e
85-
# export SDK_PATH=`xcrun --show-sdk-path --sdk $SDK`
86-
# export RUSTFLAGS="-C link-arg=-isysroot -C link-arg=$SDK_PATH"
87-
# cargo test --no-run --target $TARGET
88-
# displayName: "Build for iOS"
89-
# strategy:
90-
# matrix:
91-
# aarch64:
92-
# TARGET: aarch64-apple-ios
93-
# SDK: iphoneos
94-
# armv7:
95-
# TARGET: armv7-apple-ios
96-
# SDK: iphoneos
97-
# armv7s:
98-
# TARGET: armv7s-apple-ios
99-
# SDK: iphoneos
100-
# i386:
101-
# TARGET: i386-apple-ios
102-
# SDK: iphonesimulator
103-
# x86_64:
104-
# TARGET: x86_64-apple-ios
105-
# SDK: iphonesimulator
106-
#
107-
# - job: wasm
108-
# pool:
109-
# vmImage: ubuntu-16.04
110-
# steps:
111-
# - checkout: self
112-
# submodules: true
113-
# - template: ci/azure-install-rust.yml
114-
# - script: rustup target add wasm32-unknown-unknown
115-
# displayName: "Install rust cross target"
116-
# - script: cargo build --target wasm32-unknown-unknown
117-
# displayName: "Build for wasm"
118-
#
119-
# - job: Windows
120-
# pool:
121-
# vmImage: vs2017-win2016
122-
# steps:
123-
# - template: ci/azure-test-all.yml
124-
# strategy:
125-
# matrix:
126-
# x86_64-msvc:
127-
# TARGET: x86_64-pc-windows-msvc
128-
# i686-msvc:
129-
# TARGET: i686-pc-windows-msvc
130-
# x86_64-gnu:
131-
# TARGET: x86_64-pc-windows-gnu
132-
# i686-gnu:
133-
# TARGET: i686-pc-windows-gnu
134-
#
135-
# - job: Windows_arm64
136-
# pool:
137-
# vmImage: windows-2019
138-
# steps:
139-
# - template: ci/azure-install-rust.yml
140-
# - script: rustup target add aarch64-pc-windows-msvc
141-
# displayName: "Install rust cross target"
142-
# - script: cargo test --no-run --target aarch64-pc-windows-msvc
143-
# displayName: "Build for arm64"
42+
- job: wasm
43+
pool:
44+
vmImage: ubuntu-16.04
45+
steps:
46+
- template: ci/azure-install-rust.yml
47+
env:
48+
TOOLCHAIN: nightly
49+
- script: rustup target add wasm32-unknown-unknown
50+
displayName: "Install rust wasm target"
51+
- script: cargo build --target wasm32-unknown-unknown
52+
displayName: "Build for wasm"
53+
- script: cargo build --target wasm32-unknown-unknown --no-default-features
54+
displayName: "Build for wasm (no default features)"
55+
56+
- job: rustfmt
57+
pool:
58+
vmImage: ubuntu-16.04
59+
steps:
60+
- template: ci/azure-install-rust.yml
61+
- bash: rustup component add rustfmt
62+
- bash: cargo fmt --all -- --check
63+
64+
- job: compiler_builtins_works
65+
pool:
66+
vmImage: ubuntu-16.04
67+
steps:
68+
- template: ci/azure-install-rust.yml
69+
- bash: cargo build -p cb

build.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
1+
use std::env;
2+
13
fn main() {
24
println!("cargo:rerun-if-changed=build.rs");
35

46
#[cfg(feature = "musl-reference-tests")]
57
musl_reference_tests::generate();
8+
9+
if !cfg!(feature = "checked") {
10+
let lvl = env::var("OPT_LEVEL").unwrap();
11+
if lvl != "0" {
12+
println!("cargo:rustc-cfg=assert_no_panic");
13+
}
14+
}
615
}
716

817
#[cfg(feature = "musl-reference-tests")]
@@ -335,7 +344,7 @@ mod musl_reference_tests {
335344
src.push_str("}");
336345
}
337346

338-
let path = format!("{}/tests.rs", dst);
347+
let path = format!("{}/musl-tests.rs", dst);
339348
fs::write(&path, src).unwrap();
340349

341350
// Try to make it somewhat pretty

ci/azure-test-all.yml

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,4 @@
11
steps:
2-
- checkout: self
3-
submodules: true
42
- template: azure-install-rust.yml
53

6-
- bash: cargo build --manifest-path backtrace-sys/Cargo.toml
7-
displayName: "Build backtrace-sys"
8-
- bash: cargo build
9-
displayName: "Build backtrace"
10-
- bash: cargo test
11-
displayName: "Test backtrace"
12-
- bash: cargo test --no-default-features
13-
displayName: "Test backtrace (-default)"
14-
- bash: cargo test --no-default-features --features 'std'
15-
displayName: "Test backtrace (-default + std)"
16-
- bash: cargo test --no-default-features --features 'libunwind std'
17-
displayName: "Test backtrace (-default + libunwind)"
18-
- bash: cargo test --no-default-features --features 'libunwind dladdr std'
19-
displayName: "Test backtrace (-default + libunwind + dladdr)"
20-
- bash: cargo test --no-default-features --features 'libunwind libbacktrace std'
21-
displayName: "Test backtrace (-default + libunwind + libbacktrace)"
22-
- bash: cargo test --no-default-features --features 'unix-backtrace std'
23-
displayName: "Test backtrace (-default + unix-backtrace)"
24-
- bash: cargo test --no-default-features --features 'unix-backtrace dladdr std'
25-
displayName: "Test backtrace (-default + unix-backtrace + dladdr)"
26-
- bash: cargo test --no-default-features --features 'unix-backtrace libbacktrace std'
27-
displayName: "Test backtrace (-default + unix-backtrace + libbacktrace)"
28-
- bash: cargo test --no-default-features --features 'serialize-serde std'
29-
displayName: "Test backtrace (-default + serialize-serde + std)"
30-
- bash: cargo test --no-default-features --features 'serialize-rustc std'
31-
displayName: "Test backtrace (-default + serialize-rustc + std)"
32-
- bash: cargo test --no-default-features --features 'serialize-rustc serialize-serde std'
33-
displayName: "Test backtrace (-default + serialize-rustc + serialize-serde + std)"
34-
- bash: cargo test --no-default-features --features 'cpp_demangle std'
35-
displayName: "Test backtrace (-default + cpp_demangle + std)"
36-
- bash: cargo test --no-default-features --features 'gimli-symbolize std'
37-
displayName: "Test backtrace (-default + gimli-symbolize + std)"
38-
- bash: cargo test --no-default-features --features 'dbghelp std'
39-
displayName: "Test backtrace (-default + dbghelp + std)"
40-
- bash: cd ./cpp_smoke_test && cargo test
41-
displayName: "Test cpp_smoke_test"
4+
- bash: cargo generate-lockfile && ./ci/run-docker.sh $TARGET
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM ubuntu:18.04
2+
RUN apt-get update && \
3+
apt-get install -y --no-install-recommends \
4+
gcc libc6-dev ca-certificates \
5+
gcc-aarch64-linux-gnu libc6-dev-arm64-cross \
6+
qemu-user-static
7+
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \
8+
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER=qemu-aarch64-static \
9+
QEMU_LD_PREFIX=/usr/aarch64-linux-gnu \
10+
RUST_TEST_THREADS=1
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM ubuntu:18.04
2+
RUN apt-get update && \
3+
apt-get install -y --no-install-recommends \
4+
gcc libc6-dev ca-certificates \
5+
gcc-arm-linux-gnueabi libc6-dev-armel-cross qemu-user-static
6+
ENV CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABI_LINKER=arm-linux-gnueabi-gcc \
7+
CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABI_RUNNER=qemu-arm-static \
8+
QEMU_LD_PREFIX=/usr/arm-linux-gnueabi \
9+
RUST_TEST_THREADS=1
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM ubuntu:18.04
2+
RUN apt-get update && \
3+
apt-get install -y --no-install-recommends \
4+
gcc libc6-dev ca-certificates \
5+
gcc-arm-linux-gnueabihf libc6-dev-armhf-cross qemu-user-static
6+
ENV CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc \
7+
CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_RUNNER=qemu-arm-static \
8+
QEMU_LD_PREFIX=/usr/arm-linux-gnueabihf \
9+
RUST_TEST_THREADS=1
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM ubuntu:18.04
2+
RUN apt-get update && \
3+
apt-get install -y --no-install-recommends \
4+
gcc libc6-dev ca-certificates \
5+
gcc-arm-linux-gnueabihf libc6-dev-armhf-cross qemu-user-static
6+
ENV CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc \
7+
CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_RUNNER=qemu-arm-static \
8+
QEMU_LD_PREFIX=/usr/arm-linux-gnueabihf \
9+
RUST_TEST_THREADS=1
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM ubuntu:18.04
2+
RUN apt-get update && \
3+
apt-get install -y --no-install-recommends \
4+
gcc-multilib libc6-dev ca-certificates
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM ubuntu:18.04
2+
3+
RUN apt-get update && \
4+
apt-get install -y --no-install-recommends \
5+
gcc libc6-dev ca-certificates \
6+
gcc-mips-linux-gnu libc6-dev-mips-cross \
7+
binfmt-support qemu-user-static qemu-system-mips
8+
9+
ENV CARGO_TARGET_MIPS_UNKNOWN_LINUX_GNU_LINKER=mips-linux-gnu-gcc \
10+
CARGO_TARGET_MIPS_UNKNOWN_LINUX_GNU_RUNNER=qemu-mips-static \
11+
QEMU_LD_PREFIX=/usr/mips-linux-gnu \
12+
RUST_TEST_THREADS=1
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM ubuntu:18.04
2+
RUN apt-get update && \
3+
apt-get install -y --no-install-recommends \
4+
ca-certificates \
5+
gcc \
6+
gcc-mips64-linux-gnuabi64 \
7+
libc6-dev \
8+
libc6-dev-mips64-cross \
9+
qemu-user-static \
10+
qemu-system-mips
11+
ENV CARGO_TARGET_MIPS64_UNKNOWN_LINUX_GNUABI64_LINKER=mips64-linux-gnuabi64-gcc \
12+
CARGO_TARGET_MIPS64_UNKNOWN_LINUX_GNUABI64_RUNNER=qemu-mips64-static \
13+
CC_mips64_unknown_linux_gnuabi64=mips64-linux-gnuabi64-gcc \
14+
QEMU_LD_PREFIX=/usr/mips64-linux-gnuabi64 \
15+
RUST_TEST_THREADS=1

0 commit comments

Comments
 (0)