From bce06bda58eaecbd2cbee15f0c11ca10007a9a9b Mon Sep 17 00:00:00 2001 From: Eran Rundstein Date: Mon, 26 Feb 2024 11:55:00 -0800 Subject: [PATCH] Various small fixes. Signed-off-by: clux --- justfile | 39 +++++++++++++++++++++++++++++++-------- test.sh | 4 ++-- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/justfile b/justfile index 7d08678..6772f97 100644 --- a/justfile +++ b/justfile @@ -4,21 +4,44 @@ default: @just --list --unsorted --color=always -_build channel: - docker build --build-arg CHANNEL="{{channel}}" -t clux/muslrust:temp . -# Build the stable container locally tagged as :temp -build-stable: (_build "stable") -# Build the nightly container locally tagged as :temp -build-nightly: (_build "nightly") +_build channel ar platform ext: + docker build --build-arg CHANNEL="{{channel}}" --build-arg AR="{{ar}}" --platform="{{platform}}" -t rustmusl-temp . -f Dockerfile.{{ext}} +# Build the stable x86 container +build-stable-amd: (_build "stable" "amd64" "linux/amd64" "x86_64") +# Build the nightly x86 container +build-nightly-amd: (_build "nightly" "amd64" "linux/amd64" "x86_64") +# Build the stable arm container +build-stable-arm: (_build "stable" "arm64" "linux/arm64" "arm64") +# Build the nightly arm container +build-nightly-arm: (_build "nightly" "arm64" "linux/arm64" "arm64") # Shell into the built container run: - docker run -v $PWD/test:/volume -w /volume -it clux/muslrust:temp /bin/bash + docker run -v $PWD/test:/volume -w /volume -it rustmusl-temp /bin/bash -# Test an individual crate against built containr +test-setup: + docker build -t test-runner . -f Dockerfile.test-runner + +# Test an individual crate against built container _t crate: ./test.sh {{crate}} +# when running locally use one of these instead of _t +_t_amd crate: + #!/bin/bash + # TODO: make a variant for arm here, or do platform inference + export PLATFORM="linux/amd64" + export TARGET_DIR="x86_64-unknown-linux-musl" + export AR="amd64" + ./test.sh {{crate}} +_t_arm crate: + #!/bin/bash + export PLATFORM="linux/arm64" + export TARGET_DIR="aarch64-unknown-linux-musl" + export AR="arm64" + ./test.sh {{crate}} + + # Test all crates against built container test: (_t "plain") (_t "ssl") (_t "rustls") (_t "pq") (_t "serde") (_t "curl") (_t "zlib") (_t "hyper") (_t "dieselpg") (_t "dieselsqlite") diff --git a/test.sh b/test.sh index 329f914..a1ff77e 100755 --- a/test.sh +++ b/test.sh @@ -12,7 +12,7 @@ docker_build() { -v cargo-cache:/root/.cargo/registry \ -e RUST_BACKTRACE=1 \ -e AR=ar \ - --platform $PLATFORM \ + --platform "${PLATFORM}" \ rustmusl-temp \ cargo build @@ -24,7 +24,7 @@ docker_build() { docker run --rm \ -v "$PWD:/volume" \ -e RUST_BACKTRACE=1 \ - --platform $PLATFORM \ + --platform "${PLATFORM}" \ test-runner \ bash -c "cd volume; ./target/$TARGET_DIR/debug/${crate} && file ./target/$TARGET_DIR/debug/${crate} && file /volume/target/$TARGET_DIR/debug/${crate} 2>&1 | grep -qE 'static-pie linked|statically linked' && echo ${crate} is a static executable" }