-
Notifications
You must be signed in to change notification settings - Fork 0
/
unit.sh
executable file
·79 lines (63 loc) · 2.13 KB
/
unit.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/env bash
set -e
export PATH=${HOME}/.cargo/bin:${PATH}
if [ -z "${TARGET}" ]; then
export TARGET=`rustup show | awk 'match($0, /Default host: ([0-9a-zA-Z\_]).+/) { ver = substr($3, RSTART, RLENGTH); print ver;}'`
fi
echo "Testing release for ${TARGET}"
export DIST_PREFIX=${PWD}/target/${TARGET}/release
export BUILD_PREFIX=${DIST_PREFIX}/deps
export RUSTFLAGS=""
export CARGO_INCREMENTAL=1
export CFLAGS=""
export CPPFLAGS=""
export LDFLAGS=""
export OSX_VERSION_MIN="10.9"
export OSX_CPU_ARCH="core2"
export MAC_ARGS="-arch x86_64 -mmacosx-version-min=${OSX_VERSION_MIN} -march=${OSX_CPU_ARCH} -fapplication-extension"
case ${TARGET} in
x86_64-apple-darwin)
export CFLAGS="${CFLAGS} ${MAC_ARGS}"
export CPPFLAGS="${CPPFLAGS} ${MAC_ARGS}"
export LDFLAGS="${LDFLAGS} ${MAC_ARGS}"
export RUSTFLAGS="${RUSTFLAGS} -C link-arg=-fapplication-extension -C link-arg=-mmacosx-version-min=${OSX_VERSION_MIN}"
export OPENSSL_DIR=${BUILD_PREFIX}
export DEP_OPENSSL_LIBRESSL=1
;;
x86_64-unknown-linux-gnu)
export CFLAGS="${CFLAGS}"
export CPPFLAGS="${CPPFLAGS}"
export LDFLAGS="${LDFLAGS}"
;;
i686-unknown-linux-gnu)
export CFLAGS="${CFLAGS} -m32"
export CPPFLAGS="${CPPFLAGS} -m32"
export LDFLAGS="${LDFLAGS}"
export PKG_CONFIG_ALLOW_CROSS=1
;;
x86_64-unknown-linux-musl)
export CFLAGS="${CFLAGS}"
export CPPFLAGS="${CPPFLAGS}"
export LDFLAGS="${LDFLAGS}"
export CC=musl-gcc
;;
i686-unknown-linux-musl)
export CFLAGS="${CFLAGS} -m32"
export CPPFLAGS="${CPPFLAGS} -m32"
export LDFLAGS="${LDFLAGS}"
export CC=musl-gcc
export PKG_CONFIG_ALLOW_CROSS=1
;;
*)
;;
esac
mkdir -p ${DIST_PREFIX}/lib
mkdir -p ${DIST_PREFIX}/include
mkdir -p ${DIST_PREFIX}/bin
echo "Building test dependencies for ${TARGET}"
bash dep.sh
RUST_VER_FILE=$(dirname $0)/rust-toolchain
RUST_VER=$(<${RUST_VER_FILE})
rustup override set ${RUST_VER}
echo "Testing sddk for ${TARGET}"
RUST_BACKTRACE=1 cargo test --release -p sddk --target ${TARGET}