Remove dependency on files for running compare.

The tests still use files since they get the test name from a file but compare does the same action via stdin so it can operator on any org source.
This commit is contained in:
Tom Alexander
2023-08-16 21:06:22 -04:00
parent 4776898894
commit 74f4aa8d33
4 changed files with 50 additions and 33 deletions

View File

@@ -13,9 +13,8 @@ REALPATH=$(command -v uu-realpath || command -v realpath)
MAKE=$(command -v gmake || command -v make)
function main {
local org_file="$($REALPATH "$1")"
build_container
launch_container "$org_file"
launch_container
}
function build_container {
@@ -23,22 +22,13 @@ function build_container {
}
function launch_container {
local org_file="$1"
local additional_flags=()
local additional_args=()
local init_script=$(cat <<EOF
set -euo pipefail
IFS=\$'\n\t'
cargo run -- /input.org
EOF
)
if [ "$SHELL" != "YES" ]; then
additional_args+=(sh -c "$init_script")
additional_args+=(cargo run)
else
additional_flags+=(-i -t)
additional_flags+=(-t)
fi
if [ "$TRACE" = "YES" ]; then
@@ -50,7 +40,7 @@ EOF
additional_flags+=(--env RUST_BACKTRACE=full)
fi
docker run "${additional_flags[@]}" --rm -v "${org_file}:/input.org:ro" -v "$($REALPATH ./):/source:ro" --mount source=cargo-cache,target=/usr/local/cargo/registry --mount source=rust-cache,target=/target --env CARGO_TARGET_DIR=/target -w /source organic-test "${additional_args[@]}"
docker run "${additional_flags[@]}" --rm -i -v "$($REALPATH ./):/source:ro" --mount source=cargo-cache,target=/usr/local/cargo/registry --mount source=rust-cache,target=/target --env CARGO_TARGET_DIR=/target -w /source organic-test "${additional_args[@]}"
}
main "${@}"