3
3
set -eux
4
4
5
5
export RUST_BACKTRACE=" ${RUST_BACKTRACE:- full} "
6
+ export NEXTEST_STATUS_LEVEL=all
6
7
7
8
target=" ${1:- } "
9
+ flags=" "
8
10
9
11
if [ -z " $target " ]; then
10
12
host_target=$( rustc -vV | awk ' /^host/ { print $2 }' )
@@ -13,22 +15,22 @@ if [ -z "$target" ]; then
13
15
fi
14
16
15
17
# We enumerate features manually.
16
- extra_flags= " --no-default-features"
18
+ flags= " $flags --no-default-features"
17
19
18
20
# Enable arch-specific routines when available.
19
- extra_flags =" $extra_flags --features arch"
21
+ flags =" $flags --features arch"
20
22
21
23
# Always enable `unstable-float` since it expands available API but does not
22
24
# change any implementations.
23
- extra_flags =" $extra_flags --features unstable-float"
25
+ flags =" $flags --features unstable-float"
24
26
25
27
# We need to specifically skip tests for musl-math-sys on systems that can't
26
28
# build musl since otherwise `--all` will activate it.
27
29
case " $target " in
28
30
# Can't build at all on MSVC, WASM, or thumb
29
- * windows-msvc* ) extra_flags =" $extra_flags --exclude musl-math-sys" ;;
30
- * wasm* ) extra_flags =" $extra_flags --exclude musl-math-sys" ;;
31
- * thumb* ) extra_flags =" $extra_flags --exclude musl-math-sys" ;;
31
+ * windows-msvc* ) flags =" $flags --exclude musl-math-sys" ;;
32
+ * wasm* ) flags =" $flags --exclude musl-math-sys" ;;
33
+ * thumb* ) flags =" $flags --exclude musl-math-sys" ;;
32
34
33
35
# We can build musl on MinGW but running tests gets a stack overflow
34
36
* windows-gnu* ) ;;
@@ -38,7 +40,7 @@ case "$target" in
38
40
* powerpc64le* ) ;;
39
41
40
42
# Everything else gets musl enabled
41
- * ) extra_flags =" $extra_flags --features libm-test/build-musl" ;;
43
+ * ) flags =" $flags --features libm-test/build-musl" ;;
42
44
esac
43
45
44
46
# Configure which targets test against MPFR
@@ -50,17 +52,17 @@ case "$target" in
50
52
# Targets that aren't cross compiled work fine
51
53
# FIXME(ci): we should be able to enable aarch64 Linux here once GHA
52
54
# support rolls out.
53
- x86_64* ) extra_flags =" $extra_flags --features libm-test/build-mpfr" ;;
54
- i686* ) extra_flags =" $extra_flags --features libm-test/build-mpfr" ;;
55
- i586* ) extra_flags =" $extra_flags --features libm-test/build-mpfr --features gmp-mpfr-sys/force-cross" ;;
55
+ x86_64* ) flags =" $flags --features libm-test/build-mpfr" ;;
56
+ i686* ) flags =" $flags --features libm-test/build-mpfr" ;;
57
+ i586* ) flags =" $flags --features libm-test/build-mpfr --features gmp-mpfr-sys/force-cross" ;;
56
58
# Apple aarch64 is native
57
- aarch64* apple* ) extra_flags =" $extra_flags --features libm-test/build-mpfr" ;;
59
+ aarch64* apple* ) flags =" $flags --features libm-test/build-mpfr" ;;
58
60
esac
59
61
60
62
# FIXME: `STATUS_DLL_NOT_FOUND` testing macros on CI.
61
63
# <https://github.com/rust-lang/rust/issues/128944>
62
64
case " $target " in
63
- * windows-gnu) extra_flags =" $extra_flags --exclude libm-macros" ;;
65
+ * windows-gnu) flags =" $flags --exclude libm-macros" ;;
64
66
esac
65
67
66
68
# Make sure we can build with overriding features.
@@ -76,13 +78,31 @@ if [ "${BUILD_ONLY:-}" = "1" ]; then
76
78
exit
77
79
fi
78
80
79
- # Otherwise, run the test suite.
80
-
81
- cmd=" cargo test --all --target $target $extra_flags "
81
+ flags=" $flags --all --target $target "
82
+ cmd=" cargo test $flags "
83
+ profile=" --profile"
84
+
85
+ # If nextest is available, use that
86
+ command -v cargo-nextest && nextest=1 || nextest=0
87
+ if [ " $nextest " = " 1" ]; then
88
+ # Workaround for https://github.com/nextest-rs/nextest/issues/2066
89
+ if [ -f /.dockerenv ]; then
90
+ cfg_file=" /tmp/nextest-config.toml"
91
+ echo " [store]" >> " $cfg_file "
92
+ echo " dir = \" $CARGO_TARGET_DIR /nextest\" " >> " $cfg_file "
93
+ cfg_flag=" --config-file $cfg_file "
94
+ fi
95
+
96
+ cmd=" cargo nextest run ${cfg_flag:- } $flags "
97
+ profile=" --cargo-profile"
98
+ fi
82
99
83
100
# Test once without intrinsics
84
101
$cmd
85
102
103
+ # Run doctests if they were excluded by nextest
104
+ [ " $nextest " = " 1" ] && cargo test --doc $flags
105
+
86
106
# Exclude the macros and utile crates from the rest of the tests to save CI
87
107
# runtime, they shouldn't have anything feature- or opt-level-dependent.
88
108
cmd=" $cmd --exclude util --exclude libm-macros"
@@ -93,10 +113,10 @@ $cmd --features unstable-intrinsics --benches
93
113
94
114
# Test the same in release mode, which also increases coverage. Also ensure
95
115
# the soft float routines are checked.
96
- $cmd -- profile release-checked
97
- $cmd -- profile release-checked --features force-soft-floats
98
- $cmd -- profile release-checked --features unstable-intrinsics
99
- $cmd -- profile release-checked --features unstable-intrinsics --benches
116
+ $cmd " $ profile" release-checked
117
+ $cmd " $ profile" release-checked --features force-soft-floats
118
+ $cmd " $ profile" release-checked --features unstable-intrinsics
119
+ $cmd " $ profile" release-checked --features unstable-intrinsics --benches
100
120
101
121
# Ensure that the routines do not panic.
102
122
ENSURE_NO_PANIC=1 cargo build -p libm --target " $target " --no-default-features --release
0 commit comments