Clean up run_integration_test.bash.
This commit is contained in:
parent
306878c95d
commit
ab17904b1c
@ -4,17 +4,27 @@ set -euo pipefail
|
|||||||
IFS=$'\n\t'
|
IFS=$'\n\t'
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
cd "$DIR/../"
|
||||||
REALPATH=$(command -v uu-realpath || command -v realpath)
|
REALPATH=$(command -v uu-realpath || command -v realpath)
|
||||||
|
|
||||||
samples_dir=$(readlink -f "$DIR/../org_mode_samples")
|
function main {
|
||||||
|
local test_names=$(get_test_names "${@}")
|
||||||
|
|
||||||
|
local test
|
||||||
|
while read test; do
|
||||||
|
cargo test --no-fail-fast --test test_loader "$test" -- --show-output
|
||||||
|
done<<<"$test_names"
|
||||||
|
}
|
||||||
|
|
||||||
function get_test_names {
|
function get_test_names {
|
||||||
|
local test_file
|
||||||
|
local samples_dir=$($REALPATH "$DIR/../org_mode_samples")
|
||||||
for test_file in "$@"
|
for test_file in "$@"
|
||||||
do
|
do
|
||||||
if [ -e "$test_file" ]; then
|
if [ -e "$test_file" ]; then
|
||||||
test_file_full_path=$(readlink -f "$test_file")
|
local test_file_full_path=$($REALPATH "$test_file")
|
||||||
relative_to_samples=$($REALPATH --relative-to "$samples_dir" "$test_file_full_path")
|
local relative_to_samples=$($REALPATH --relative-to "$samples_dir" "$test_file_full_path")
|
||||||
without_extension="${relative_to_samples%.org}"
|
local without_extension="${relative_to_samples%.org}"
|
||||||
echo "${without_extension/\//_}" | tr '[:upper:]' '[:lower:]'
|
echo "${without_extension/\//_}" | tr '[:upper:]' '[:lower:]'
|
||||||
else
|
else
|
||||||
echo "$test_file" | tr '[:upper:]' '[:lower:]'
|
echo "$test_file" | tr '[:upper:]' '[:lower:]'
|
||||||
@ -22,6 +32,4 @@ function get_test_names {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
get_test_names "$@" | while read test; do
|
main "${@}"
|
||||||
(cd "$DIR/../" && cargo test --no-fail-fast --test test_loader "$test" -- --show-output)
|
|
||||||
done
|
|
||||||
|
Loading…
Reference in New Issue
Block a user