]> git.proxmox.com Git - rustc.git/blame - vendor/packed_simd/ci/run.sh
Update upstream source from tag 'upstream/1.52.1+dfsg1'
[rustc.git] / vendor / packed_simd / ci / run.sh
CommitLineData
f20569fa
XL
1#!/usr/bin/env bash
2
3set -ex
4
5: ${TARGET?"The TARGET environment variable must be set."}
6
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.
9#export RUST_TEST_THREADS=1
10#export RUST_BACKTRACE=full
11#export RUST_TEST_NOCAPTURE=1
12
13# Some appveyor builds run out-of-memory; this attempts to mitigate that:
14# https://github.com/rust-lang-nursery/packed_simd/issues/39
15# export RUSTFLAGS="${RUSTFLAGS} -C codegen-units=1"
16# export CARGO_BUILD_JOBS=1
17
18export CARGO_SUBCMD=test
19if [[ "${NORUN}" == "1" ]]; then
20 export CARGO_SUBCMD=build
21fi
22
23if [[ ${TARGET} == "x86_64-apple-ios" ]] || [[ ${TARGET} == "i386-apple-ios" ]]; then
24 export RUSTFLAGS="${RUSTFLAGS} -Clink-arg=-mios-simulator-version-min=7.0"
25 rustc ./ci/deploy_and_run_on_ios_simulator.rs -o $HOME/runtest
26 export CARGO_TARGET_X86_64_APPLE_IOS_RUNNER=$HOME/runtest
27 export CARGO_TARGET_I386_APPLE_IOS_RUNNER=$HOME/runtest
28fi
29
30# The source directory is read-only. Need to copy internal crates to the target
31# directory for their Cargo.lock to be properly written.
32mkdir target || true
33
34rustc --version
35cargo --version
36echo "TARGET=${TARGET}"
37echo "HOST=${HOST}"
38echo "RUSTFLAGS=${RUSTFLAGS}"
39echo "NORUN=${NORUN}"
40echo "NOVERIFY=${NOVERIFY}"
41echo "CARGO_SUBCMD=${CARGO_SUBCMD}"
42echo "CARGO_BUILD_JOBS=${CARGO_BUILD_JOBS}"
43echo "CARGO_INCREMENTAL=${CARGO_INCREMENTAL}"
44echo "RUST_TEST_THREADS=${RUST_TEST_THREADS}"
45echo "RUST_BACKTRACE=${RUST_BACKTRACE}"
46echo "RUST_TEST_NOCAPTURE=${RUST_TEST_NOCAPTURE}"
47
48cargo_test() {
49 cmd="cargo ${CARGO_SUBCMD} --verbose --target=${TARGET} ${@}"
50 if [ "${NORUN}" != "1" ]
51 then
52 if [ "$TARGET" != "wasm32-unknown-unknown" ]
53 then
54 cmd="$cmd -- --quiet"
55 fi
56 fi
57 mkdir target || true
58 ${cmd} 2>&1 | tee > target/output
59 if [[ ${PIPESTATUS[0]} != 0 ]]; then
60 cat target/output
61 return 1
62 fi
63}
64
65cargo_test_impl() {
66 ORIGINAL_RUSTFLAGS=${RUSTFLAGS}
67 RUSTFLAGS="${ORIGINAL_RUSTFLAGS} --cfg test_v16 --cfg test_v32 --cfg test_v64" cargo_test ${@}
68 RUSTFLAGS="${ORIGINAL_RUSTFLAGS} --cfg test_v128 --cfg test_v256" cargo_test ${@}
69 RUSTFLAGS="${ORIGINAL_RUSTFLAGS} --cfg test_v512" cargo_test ${@}
70 RUSTFLAGS=${ORIGINAL_RUSTFLAGS}
71}
72
73# Debug run:
74if [[ "${TARGET}" != "wasm32-unknown-unknown" ]]; then
75 # Run wasm32-unknown-unknown in release mode only
76 cargo_test_impl
77fi
78
79if [[ "${TARGET}" == "x86_64-unknown-linux-gnu" ]] || [[ "${TARGET}" == "x86_64-pc-windows-msvc" ]]; then
80 # use sleef on linux and windows x86_64 builds
81 cargo_test_impl --release --features=into_bits,core_arch,sleef-sys
82else
83 cargo_test_impl --release --features=into_bits,core_arch
84fi
85
86# Verify code generation
87if [[ "${NOVERIFY}" != "1" ]]; then
88 cp -r verify/verify target/verify
89 export STDSIMD_ASSERT_INSTR_LIMIT=30
90 if [[ "${TARGET}" == "i586-unknown-linux-gnu" ]]; then
91 export STDSIMD_ASSERT_INSTR_LIMIT=50
92 fi
93 cargo_test --release --manifest-path=target/verify/Cargo.toml
94fi
95
96. ci/run_examples.sh