(testsuite) Added shell script `run'

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
This commit is contained in:
Freddy Vulto 2009-12-24 09:43:24 +01:00
parent fec41f3c74
commit f9db6abdc1

31
test/run Executable file
View File

@ -0,0 +1,31 @@
#!/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