]> git.proxmox.com Git - rustc.git/blame - library/stdarch/ci/run.sh
New upstream version 1.53.0+dfsg1
[rustc.git] / library / stdarch / ci / run.sh
CommitLineData
0731742a 1#!/usr/bin/env sh
0531ce1d
XL
2
3set -ex
4
0731742a 5: "${TARGET?The TARGET environment variable must be set.}"
83c7162d 6
0531ce1d
XL
7# Tests are all super fast anyway, and they fault often enough on travis that
8# having only one thread increases debuggability to be worth it.
83c7162d 9#export RUST_BACKTRACE=full
0531ce1d 10#export RUST_TEST_NOCAPTURE=1
416331ca 11#export RUST_TEST_THREADS=1
0531ce1d 12
416331ca 13RUSTFLAGS="$RUSTFLAGS -D warnings "
83c7162d 14
0531ce1d 15case ${TARGET} in
fc512014
XL
16 *-pc-windows-msvc)
17 ;;
8faf50e0
XL
18 # On 32-bit use a static relocation model which avoids some extra
19 # instructions when dealing with static data, notably allowing some
20 # instruction assertion checks to pass below the 20 instruction limit. If
21 # this is the default, dynamic, then too many instructions are generated
22 # when we assert the instruction for a function and it causes tests to fail.
0bf4aa26
XL
23 #
24 # It's not clear why `-Z plt=yes` is required here. Probably a bug in LLVM.
25 # If you can remove it and CI passes, please feel free to do so!
8faf50e0 26 i686-* | i586-*)
0bf4aa26 27 export RUSTFLAGS="${RUSTFLAGS} -C relocation-model=static -Z plt=yes"
8faf50e0 28 ;;
48663c56
XL
29 #Unoptimized build uses fast-isel which breaks with msa
30 mips-* | mipsel-*)
31 export RUSTFLAGS="${RUSTFLAGS} -C llvm-args=-fast-isel=false"
32 ;;
0531ce1d
XL
33esac
34
0531ce1d
XL
35echo "RUSTFLAGS=${RUSTFLAGS}"
36echo "FEATURES=${FEATURES}"
37echo "OBJDUMP=${OBJDUMP}"
416331ca
XL
38echo "STDARCH_DISABLE_ASSERT_INSTR=${STDARCH_DISABLE_ASSERT_INSTR}"
39echo "STDARCH_TEST_EVERYTHING=${STDARCH_TEST_EVERYTHING}"
0531ce1d
XL
40
41cargo_test() {
9fa01778 42 cmd="cargo"
0731742a 43 subcmd="test"
9fa01778
XL
44 if [ "$NORUN" = "1" ]; then
45 export subcmd="build"
0731742a
XL
46 fi
47 cmd="$cmd ${subcmd} --target=$TARGET $1"
0531ce1d 48 cmd="$cmd -- $2"
3dfed10e
XL
49
50 # wasm targets can't catch panics so if a test failures make sure the test
51 # harness isn't trying to capture output, otherwise we won't get any useful
52 # output.
53 case ${TARGET} in
54 wasm32*)
55 cmd="$cmd --nocapture"
56 ;;
57 esac
58
cdc7bbd5
XL
59 if [ "$SKIP_TESTS" != "" ]; then
60 cmd="$cmd --skip "$SKIP_TESTS
61 fi
0531ce1d
XL
62 $cmd
63}
64
9fa01778
XL
65CORE_ARCH="--manifest-path=crates/core_arch/Cargo.toml"
66STD_DETECT="--manifest-path=crates/std_detect/Cargo.toml"
416331ca 67STDARCH_EXAMPLES="--manifest-path=examples/Cargo.toml"
9fa01778 68cargo_test "${CORE_ARCH} --release"
416331ca 69
9fa01778
XL
70if [ "$NOSTD" != "1" ]; then
71 cargo_test "${STD_DETECT}"
72 cargo_test "${STD_DETECT} --release"
0731742a 73
9fa01778
XL
74 cargo_test "${STD_DETECT} --no-default-features"
75 cargo_test "${STD_DETECT} --no-default-features --features=std_detect_file_io"
76 cargo_test "${STD_DETECT} --no-default-features --features=std_detect_dlsym_getauxval"
77 cargo_test "${STD_DETECT} --no-default-features --features=std_detect_dlsym_getauxval,std_detect_file_io"
78
416331ca
XL
79 cargo_test "${STDARCH_EXAMPLES}"
80 cargo_test "${STDARCH_EXAMPLES} --release"
9fa01778 81fi
83c7162d 82
0bf4aa26 83# Test targets compiled with extra features.
83c7162d
XL
84case ${TARGET} in
85 x86*)
416331ca 86 export STDARCH_DISABLE_ASSERT_INSTR=1
0731742a 87 export RUSTFLAGS="${RUSTFLAGS} -C target-feature=+avx"
83c7162d
XL
88 cargo_test "--release"
89 ;;
3dfed10e
XL
90 wasm32*)
91 prev="$RUSTFLAGS"
92 export RUSTFLAGS="${RUSTFLAGS} -C target-feature=+simd128,+unimplemented-simd128"
93 cargo_test "--release"
94 export RUSTFLAGS="$prev"
0bf4aa26 95 ;;
416331ca
XL
96 # FIXME: don't build anymore
97 #mips-*gnu* | mipsel-*gnu*)
98 # export RUSTFLAGS="${RUSTFLAGS} -C target-feature=+msa,+fp64,+mips32r5"
99 # cargo_test "--release"
100 # ;;
48663c56
XL
101 mips64*)
102 export RUSTFLAGS="${RUSTFLAGS} -C target-feature=+msa"
103 cargo_test "--release"
104 ;;
105 powerpc64*)
106 # We don't build the ppc 32-bit targets with these - these targets
107 # are mostly unsupported for now.
108 OLD_RUSTFLAGS="${RUSTFLAGS}"
109 export RUSTFLAGS="${OLD_RUSTFLAGS} -C target-feature=+altivec"
110 cargo_test "--release"
111
112 export RUSTFLAGS="${OLD_RUSTFLAGS} -C target-feature=+vsx"
113 cargo_test "--release"
114 ;;
83c7162d
XL
115 *)
116 ;;
9fa01778 117
83c7162d 118esac
9fa01778 119
3dfed10e 120if [ "$NORUN" != "1" ] && [ "$NOSTD" != 1 ]; then
9fa01778
XL
121 # Test examples
122 (
123 cd examples
124 cargo test --target "$TARGET"
125 echo test | cargo run --release hex
126 )
127fi