From 6137a46231daea5c3212d1a4dade146028c152af Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sat, 16 Sep 2023 14:15:19 -0400 Subject: [PATCH] Default to the release-lto profile for running compare in docker. Since we're using docker volumes to cache the build, the extra build cost will only be paid once but the extra speed will be nice while investigating. --- scripts/run_docker_compare.bash | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/scripts/run_docker_compare.bash b/scripts/run_docker_compare.bash index 428e23e1..e77491df 100755 --- a/scripts/run_docker_compare.bash +++ b/scripts/run_docker_compare.bash @@ -8,6 +8,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" : ${TRACE:="NO"} # or YES to send traces to jaeger : ${BACKTRACE:="NO"} # or YES to print a rust backtrace when panicking : ${NO_COLOR:=""} # Set to anything to disable color output +: ${PROFILE:="release-lto"} REALPATH=$(command -v uu-realpath || command -v realpath) MAKE=$(command -v gmake || command -v make) @@ -67,6 +68,14 @@ function launch_container { local features_joined features_joined=$(IFS=","; echo "${features[*]}") + local build_flags=() + if [ "$PROFILE" = "dev" ] || [ "$PROFILE" = "debug" ]; then + PROFILE="debug" + else + build_flags+=(--profile "$PROFILE") + fi + + if [ $# -gt 0 ]; then # If we passed in args, we need to forward them along for path in "${@}"; do @@ -76,11 +85,10 @@ function launch_container { set -euo pipefail IFS=\$'\n\t' -cargo build --bin compare --no-default-features --features "$features_joined" -exec /target/debug/compare "/input${full_path}" +cargo build --bin compare --no-default-features --features "$features_joined" ${build_flags[@]} +exec /target/${PROFILE}/compare "/input${full_path}" EOF ) - log "INIT SCRIPT: $init_script" docker run "${additional_flags[@]}" --init --rm -i --mount type=tmpfs,destination=/tmp -v "/:/input:ro" -v "$($REALPATH "$DIR/../"):/source:ro" --mount source=cargo-cache,target=/usr/local/cargo/registry --mount source=rust-cache,target=/target --env CARGO_TARGET_DIR=/target -w /source --entrypoint "" organic-test sh -c "$init_script" done else @@ -90,9 +98,9 @@ EOF set -euo pipefail IFS=\$'\n\t' -cargo build --bin compare --no-default-features --features "$features_joined" +cargo build --bin compare --no-default-features --features "$features_joined" ${build_flags[@]} cd /input${current_directory} -exec /target/debug/compare +exec /target/${PROFILE}/compare EOF )