@@ -12,7 +12,7 @@ set -ex
1212
1313export RUSTFLAGS=" ${RUSTFLAGS} -D warnings -Z merge-functions=disabled -Z verify-llvm-ir"
1414export HOST_RUSTFLAGS=" ${RUSTFLAGS} "
15- export PROFILE=" ${PROFILE:= " --profile= release" } "
15+ export PROFILE=" ${PROFILE:= " release" } "
1616
1717case ${TARGET} in
1818 # On Windows the linker performs identical COMDAT folding (ICF) by default
@@ -63,14 +63,20 @@ cargo_test() {
6363 if [ " $NORUN " = " 1" ]; then
6464 export subcmd=" build"
6565 fi
66- cmd=" $cmd ${subcmd} --target=$TARGET $1 "
66+ cmd=" $cmd ${subcmd} --target=$TARGET --profile= $PROFILE $1 "
6767 cmd=" $cmd -- $2 "
6868
6969 case ${TARGET} in
7070 # wasm targets can't catch panics so if a test failures make sure the test
7171 # harness isn't trying to capture output, otherwise we won't get any useful
7272 # output.
7373 wasm32* )
74+ if [ " $PROFILE " = " release" ]; then
75+ dir=" release"
76+ else
77+ dir=" debug"
78+ fi
79+ export CARGO_TARGET_WASM32_WASIP1_RUNNER=" wasmtime -Wexceptions --dir /checkout/target/wasm32-wasip1/$dir /deps::."
7480 cmd=" $cmd --nocapture"
7581 ;;
7682 esac
@@ -80,54 +86,45 @@ cargo_test() {
8086CORE_ARCH=" --manifest-path=crates/core_arch/Cargo.toml"
8187STDARCH_EXAMPLES=" --manifest-path=examples/Cargo.toml"
8288
83- cargo_test " ${CORE_ARCH} ${PROFILE} "
89+ cargo_test " ${CORE_ARCH} "
8490
8591if [ " $NOSTD " != " 1" ]; then
86- cargo_test " ${STDARCH_EXAMPLES} ${PROFILE} "
92+ cargo_test " ${STDARCH_EXAMPLES} "
8793fi
8894
8995
9096# Test targets compiled with extra features.
9197case ${TARGET} in
92- x86_64-unknown-linux-gnu)
93- export STDARCH_DISABLE_ASSERT_INSTR=1
94-
95- export RUSTFLAGS=" ${RUSTFLAGS} -C target-feature=+avx"
96- cargo_test " ${PROFILE} "
97-
98- export RUSTFLAGS=" ${RUSTFLAGS} -C target-feature=+avx512f"
99- cargo_test " ${PROFILE} "
100- ;;
10198 x86_64* | i686* )
10299 export STDARCH_DISABLE_ASSERT_INSTR=1
103100
104101 export RUSTFLAGS=" ${RUSTFLAGS} -C target-feature=+avx"
105- cargo_test " ${PROFILE} "
102+ cargo_test
106103 ;;
107104 # FIXME: don't build anymore
108105 # mips-*gnu* | mipsel-*gnu*)
109106 # export RUSTFLAGS="${RUSTFLAGS} -C target-feature=+msa,+fp64,+mips32r5"
110- # cargo_test "${PROFILE}"
107+ # cargo_test
111108 # ;;
112109 mips64* )
113110 export RUSTFLAGS=" ${RUSTFLAGS} -C target-feature=+msa"
114- cargo_test " ${PROFILE} "
111+ cargo_test
115112 ;;
116113 s390x* )
117114 export RUSTFLAGS=" ${RUSTFLAGS} -C target-feature=+vector-enhancements-1"
118- cargo_test " ${PROFILE} "
115+ cargo_test
119116 ;;
120117 powerpc64* )
121118 export RUSTFLAGS=" ${RUSTFLAGS} -C target-feature=+altivec"
122- cargo_test " ${PROFILE} "
119+ cargo_test
123120
124121 export RUSTFLAGS=" ${RUSTFLAGS} -C target-feature=+vsx"
125- cargo_test " ${PROFILE} "
122+ cargo_test
126123 ;;
127124 powerpc* )
128125 # qemu has a bug in PPC32 which leads to a crash when compiled with `vsx`
129126 export RUSTFLAGS=" ${RUSTFLAGS} -C target-feature=+altivec"
130- cargo_test " ${PROFILE} "
127+ cargo_test
131128 ;;
132129 * )
133130 ;;
@@ -138,7 +135,7 @@ if [ "$NORUN" != "1" ] && [ "$NOSTD" != 1 ]; then
138135 # Test examples
139136 (
140137 cd examples
141- cargo test --target " $TARGET " " ${PROFILE} "
142- echo test | cargo run --target " $TARGET " " ${PROFILE} " hex
138+ cargo test --target " ${ TARGET} " --profile " ${PROFILE} "
139+ echo test | cargo run --target " ${ TARGET} " --profile " ${PROFILE} " hex
143140 )
144141fi
0 commit comments