From 36bdc54703518f18f79655a10f969f39db3fa665 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sat, 16 Sep 2023 13:34:33 -0400 Subject: [PATCH] Update bisect script to work with any depth relative path for setupfile. This also switches to using stdin rather than writing the file slices to the filesystem. --- scripts/run_docker_compare.bash | 20 ++++++++++++-- scripts/run_docker_compare_bisect.bash | 36 ++++++-------------------- 2 files changed, 26 insertions(+), 30 deletions(-) diff --git a/scripts/run_docker_compare.bash b/scripts/run_docker_compare.bash index 019a98a..6c33144 100755 --- a/scripts/run_docker_compare.bash +++ b/scripts/run_docker_compare.bash @@ -39,7 +39,7 @@ function launch_container { if [ "$SHELL" != "YES" ]; then local features_joined features_joined=$(IFS=","; echo "${features[*]}") - additional_args+=(cargo run --bin compare --no-default-features --features "$features_joined") + additional_args+=(cargo build --bin compare --no-default-features --features "$features_joined") additional_flags+=(--read-only) else additional_args+=(/bin/sh) @@ -58,7 +58,23 @@ function launch_container { 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 "${additional_args[@]}" -- "/input${full_path}" done else - docker run "${additional_flags[@]}" --init --rm -i --mount type=tmpfs,destination=/tmp -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 "${additional_args[@]}" + if [ "$SHELL" != "YES" ]; then + local current_directory init_script + current_directory=$(pwd) + init_script=$(cat < /dev/null + (run_parse "$bad") local status=$? set -e if [ $status -eq 0 ]; then @@ -71,21 +60,12 @@ function main { echo "Bad line: $bad" } -function setup_temp_dir { - local temp_dir=$(mktemp -d -t 'compare_bisect.XXXXXXXX') - cp -r "$SOURCE_FOLDER/"* "$temp_dir/" - echo "$temp_dir" -} - function run_parse { local lines="$1" - local temp_dir=$(setup_temp_dir) - folders+=("$temp_dir") - cat "$SOURCE_FOLDER/$TARGET_DOCUMENT" | head -n "$lines" > "$temp_dir/$TARGET_DOCUMENT" - "${DIR}/run_docker_compare.bash" "$temp_dir/$TARGET_DOCUMENT" + + cd "$SOURCE_FOLDER" + head -n "$lines" "$SOURCE_FOLDER/$TARGET_DOCUMENT" | "${DIR}/run_docker_compare.bash" local status=$? - rm -rf "$temp_dir" - # TODO: Remove temp_dir from folders return "$status" }