Add ability to select individual tests to run.

This commit is contained in:
Rane Brown 2019-12-30 05:58:20 -07:00
parent 19f913429f
commit 719036b011

View File

@ -19,6 +19,9 @@ printHelp() {
echo "" echo ""
echo "-t Select test type: 'vader', 'vint', or 'all'" echo "-t Select test type: 'vader', 'vint', or 'all'"
echo "" echo ""
echo "-o Comma seperated list of tests to run."
echo " E.g. -o \"list_margin,command_toc\""
echo ""
echo "-v Turn on verbose output." echo "-v Turn on verbose output."
exit 0 exit 0
} }
@ -31,12 +34,32 @@ printVersions() {
runVader() { runVader() {
echo "Starting Docker container and Vader tests." echo "Starting Docker container and Vader tests."
if [[ -z $only ]]; then
ind="test/independent_runs/*.vader"
res="test/*"
else
IFS=',' read -ra TEST <<< "$only"
for i in "${TEST[@]}"; do
if [[ -f "$i" ]]; then
res="$res test/${i}"
elif [[ -f "${i}.vader" ]]; then
res="$res test/${i}.vader"
elif [[ -f "independent_runs/${i}" ]]; then
ind="$ind test/independent_runs/${i}"
elif [[ -f "independent_runs/${i}.vader" ]]; then
ind="$ind test/independent_runs/${i}.vader"
else
printf "WARNING: Test \"%s\" not found.\n", "$i"
fi
done
fi
# run tests for each specified version # run tests for each specified version
for v in $vers; do for v in $vers; do
echo "" echo ""
echo "Running version: $v" echo "Running version: $v"
vim="/vim-build/bin/$v -u test/vimrc -i NONE" vim="/vim-build/bin/$v -u test/vimrc -i NONE"
test_cmd="for VF in test/independent_runs/*.vader; do $vim \"+Vader! \$VF\"; done" test_cmd="for VF in ${ind}; do $vim \"+Vader! \$VF\"; done"
set -o pipefail set -o pipefail
@ -47,7 +70,7 @@ runVader() {
# remaining tests # remaining tests
docker run -a stderr -e VADER_OUTPUT_FILE=/dev/stderr "${flags[@]}" \ docker run -a stderr -e VADER_OUTPUT_FILE=/dev/stderr "${flags[@]}" \
"$v" -u test/vimrc -i NONE "+Vader! test/*" 2>&1 | vader_filter | vader_color "$v" -u test/vimrc -i NONE "+Vader! ${res}" 2>&1 | vader_filter | vader_color
set +o pipefail set +o pipefail
done done
@ -142,10 +165,13 @@ type="all"
# verbose output flag # verbose output flag
verbose=0 verbose=0
# only run these tests
only=""
# docker flags # docker flags
flags=(--rm -v "$PWD/../:/testplugin" -v "$PWD/../test:/home" -w /testplugin vimwiki) flags=(--rm -v "$PWD/../:/testplugin" -v "$PWD/../test:/home" -w /testplugin vimwiki)
while getopts ":hvn:lt:" opt; do while getopts ":hvn:lt:o:" opt; do
case ${opt} in case ${opt} in
h ) h )
printHelp printHelp
@ -162,6 +188,9 @@ while getopts ":hvn:lt:" opt; do
t ) t )
type="$OPTARG" type="$OPTARG"
;; ;;
o )
only="$OPTARG"
;;
\? ) \? )
echo "Invalid option: $OPTARG" 1>&2 echo "Invalid option: $OPTARG" 1>&2
exit 1 exit 1