Add a script to run compare using the docker image.
This commit is contained in:
parent
e28290ed79
commit
5768c8acda
5
Makefile
5
Makefile
@ -42,6 +42,11 @@ dockertest:
|
||||
> $(MAKE) -C docker/organic_test
|
||||
> docker run --rm -i -t -v "$$(readlink -f ./):/.source:ro" --mount source=cargo-cache,target=/usr/local/cargo/registry -w / organic-test sh -c "cp -r /.source /source && cd /source && cargo test --no-fail-fast --lib --test test_loader"
|
||||
|
||||
.PHONY: dockerclean
|
||||
dockerclean:
|
||||
# Delete volumes created for running the tests in docker. This does not touch anything related to the jaeger docker container.
|
||||
> docker volume rm cargo-cache rust-cache
|
||||
|
||||
.PHONY: integrationtest
|
||||
integrationtest:
|
||||
> cargo test --no-fail-fast --test test_loader -- --test-threads $(TESTJOBS)
|
||||
|
46
scripts/run_docker_compare.bash
Executable file
46
scripts/run_docker_compare.bash
Executable file
@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
: ${SHELL:="NO"} # or YES to launch a shell instead of running the test
|
||||
|
||||
cd "$DIR/../"
|
||||
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"
|
||||
}
|
||||
|
||||
function build_container {
|
||||
$MAKE -C "$DIR/../docker/organic_test"
|
||||
}
|
||||
|
||||
function launch_container {
|
||||
local org_file="$1"
|
||||
local additional_flags=()
|
||||
local additional_args=()
|
||||
|
||||
local init_script=$(cat <<EOF
|
||||
set -euo pipefail
|
||||
IFS=\$'\n\t'
|
||||
|
||||
cd /source
|
||||
export CARGO_TARGET_DIR=/target
|
||||
cargo run -- /input.org
|
||||
EOF
|
||||
)
|
||||
|
||||
if [ "$SHELL" != "YES" ]; then
|
||||
additional_args+=(sh -c "$init_script")
|
||||
else
|
||||
additional_flags+=(-i -t)
|
||||
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 -w / organic-test "${additional_args[@]}"
|
||||
}
|
||||
|
||||
main "${@}"
|
@ -22,10 +22,11 @@ function get_test_names {
|
||||
done
|
||||
}
|
||||
|
||||
make -C "$DIR/../docker/organic_test"
|
||||
|
||||
get_test_names "$@" | while read test; do
|
||||
(
|
||||
cd "$DIR/../"
|
||||
make -C docker/organic_test
|
||||
docker run --rm -v "$(readlink -f ./):/.source:ro" --mount source=cargo-cache,target=/usr/local/cargo/registry -w / organic-test sh -c "cp -r /.source /source && cd /source && cargo test --no-fail-fast --lib --test test_loader \"$test\" -- --show-output"
|
||||
)
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user