f9db6abdc1
This allows tab-completion of test scripts to run, e.g.: $ ./run unit/comp<TAB> $ ./run unit/compgen.exp Instead of the old way: $ ./runUnit compgen.exp
32 lines
848 B
Bash
Executable File
32 lines
848 B
Bash
Executable File
#!/bin/bash
|
|
# Run test of specified tool.
|
|
# The first directory of the first file (first argument ending with .exp) is
|
|
# used as the `tool' specification.
|
|
# Usage: ./run [FILE]...
|
|
# Example run: ./run unit/_get_cword.exp unit/compgen.exp
|
|
|
|
|
|
# Process arguments
|
|
# @param $1 Name of variable to return `tool' name
|
|
# @param $2 Name of variable to return processed arguments
|
|
# @param $@ Arguments to process
|
|
process_args() {
|
|
local arg
|
|
for arg in "${@:3}"; do
|
|
case "$arg" in
|
|
completion/*.exp|unit/*.exp)
|
|
[[ ${!1} ]] || printf -v $1 "${arg%%/*}"
|
|
eval $2[\${#$2[@]}]=\""${arg#*/}"\"
|
|
;;
|
|
*)
|
|
eval $2[\${#$2[@]}]=\""$arg"\"
|
|
esac
|
|
done
|
|
}
|
|
|
|
args=()
|
|
process_args tool args "$@"
|
|
runtest --outdir log --tool $tool "${args[@]}"
|
|
|
|
unset -v args tool
|