forked from clux/muslrust
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.sh
executable file
·48 lines (44 loc) · 1.56 KB
/
test.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
#!/bin/bash
set -ex
docker_build() {
# NB: add -vv to cargo build when debugging
local -r crate="$1"crate
docker run --rm \
-v "$PWD/test/${crate}:/volume" \
-v cargo-cache:/root/.cargo/registry \
-e RUST_BACKTRACE=1 \
clux/muslrust:temp \
cargo build
cd "test/${crate}"
./target/x86_64-unknown-linux-musl/debug/"${crate}"
ldd "target/x86_64-unknown-linux-musl/debug/${crate}" 2>&1 | grep -qE "not a dynamic|statically linked" && \
echo "${crate} is a static executable"
}
# Helper to check how ekidd/rust-musl-builder does it
docker_build_ekidd() {
local -r crate="$1"crate
docker run --rm \
-v "$PWD/test/${crate}:/home/rust/src" \
-v cargo-cache:/home/rust/.cargo \
-e RUST_BACKTRACE=1 \
-it ekidd/rust-musl-builder:nightly \
cargo build -vv
cd "test/${crate}"
./target/x86_64-unknown-linux-musl/debug/"${crate}"
ldd "target/x86_64-unknown-linux-musl/debug/${crate}" 2>&1 | grep -qE "not a dynamic|statically linked" && \
echo "${crate} is a static executable"
}
# Helper to check how golddranks/rust_musl_docker does it
docker_build_golddranks() {
local -r crate="$1"crate
docker run --rm \
-v "$PWD/test/${crate}:/workdir" \
-e RUST_BACKTRACE=1 \
-it golddranks/rust_musl_docker:nightly-2017-10-03 \
cargo build -vv --target=x86_64-unknown-linux-musl
cd "test/${crate}"
./target/x86_64-unknown-linux-musl/debug/"${crate}"
ldd "target/x86_64-unknown-linux-musl/debug/${crate}" 2>&1 | grep -qE "not a dynamic|statically linked" && \
echo "${crate} is a static executable"
}
docker_build "$1"