organic/scripts/run_docker_integration_test.bash
Tom Alexander 422804d846
Some checks failed
rust-build Build rust-build has failed
rust-test Build rust-test has failed
Add script for running specific tests inside docker.
2023-08-14 12:21:15 -04:00

32 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
#
set -euo pipefail
IFS=$'\n\t'
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
REALPATH=$(command -v uu-realpath || command -v realpath)
samples_dir=$(readlink -f "$DIR/../org_mode_samples")
function get_test_names {
for test_file in "$@"
do
if [ -e "$test_file" ]; then
test_file_full_path=$(readlink -f "$test_file")
relative_to_samples=$($REALPATH --relative-to "$samples_dir" "$test_file_full_path")
without_extension="${relative_to_samples%.org}"
echo "${without_extension/\//_}" | tr '[:upper:]' '[:lower:]'
else
echo "$test_file" | tr '[:upper:]' '[:lower:]'
fi
done
}
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