mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-22 07:48:50 -05:00
provide default values for test scripts
Our test scripts currently require that the first argument be the library or binary to be tested. This makes integrating them with automake which doesn't have a mechanism for passing specific arguments to individual tests. Instead, provide a default built from paths in the environment which can be provided to all test scripts by automake. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
1152052b3e
commit
9263cc5874
@ -3,11 +3,12 @@
|
|||||||
declare -i testcount=0 fail=0 pass=0 total=15
|
declare -i testcount=0 fail=0 pass=0 total=15
|
||||||
|
|
||||||
# source the library function
|
# source the library function
|
||||||
if [[ -z $1 || ! -f $1 ]]; then
|
lib=${1:-${PMTEST_SCRIPTLIB_DIR}human_to_size.sh}
|
||||||
printf "Bail out! path to human_to_size library not provided or does not exist\n"
|
if [[ -z $lib || ! -f $lib ]]; then
|
||||||
|
echo "Bail out! human_to_size library ($lib) could not be located\n"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
. "$1"
|
. "$lib"
|
||||||
|
|
||||||
if ! type -t human_to_size >/dev/null; then
|
if ! type -t human_to_size >/dev/null; then
|
||||||
printf 'Bail out! human_to_size function not found\n'
|
printf 'Bail out! human_to_size function not found\n'
|
||||||
|
@ -3,11 +3,12 @@
|
|||||||
declare -i testcount=0 pass=0 fail=0 total=25
|
declare -i testcount=0 pass=0 fail=0 total=25
|
||||||
|
|
||||||
# source the library function
|
# source the library function
|
||||||
if [[ -z $1 || ! -f $1 ]]; then
|
lib=${1:-${PMTEST_SCRIPTLIB_DIR}parseopts.sh}
|
||||||
printf "Bail out! path to parseopts library not provided or does not exist\n"
|
if [[ -z $lib || ! -f $lib ]]; then
|
||||||
|
printf "Bail out! parseopts library ($lib) could not be located\n"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
. "$1"
|
. "$lib"
|
||||||
|
|
||||||
if ! type -t parseopts >/dev/null; then
|
if ! type -t parseopts >/dev/null; then
|
||||||
printf 'Bail out! parseopts function not found\n'
|
printf 'Bail out! parseopts function not found\n'
|
||||||
|
@ -19,12 +19,17 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# default binary if one was not specified as $1
|
# default binary if one was not specified as $1
|
||||||
bin='pacsort'
|
bin=${1:-${PMTEST_UTIL_DIR}pacsort}
|
||||||
# holds counts of tests
|
# holds counts of tests
|
||||||
total=23
|
total=23
|
||||||
run=0
|
run=0
|
||||||
failure=0
|
failure=0
|
||||||
|
|
||||||
|
if ! type -p "$bin"; then
|
||||||
|
echo "Bail out! pacsort binary ($bin) could not be located"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# args:
|
# args:
|
||||||
# runtest input expected test_description optional_opts
|
# runtest input expected test_description optional_opts
|
||||||
runtest() {
|
runtest() {
|
||||||
@ -42,14 +47,6 @@ runtest() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# use first arg as our binary if specified
|
|
||||||
[[ -n "$1" ]] && bin="$1"
|
|
||||||
|
|
||||||
if ! type -p "$bin"; then
|
|
||||||
echo "Bail out! pacsort binary ($bin) could not be located"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Running pacsort tests..."
|
echo "Running pacsort tests..."
|
||||||
|
|
||||||
echo "1..$total"
|
echo "1..$total"
|
||||||
|
@ -18,12 +18,18 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# default binary if one was not specified as $1
|
# default binary if one was not specified as $1
|
||||||
bin='vercmp'
|
bin=${1:-${PMTEST_UTIL_DIR}vercmp}
|
||||||
# holds counts of tests
|
# holds counts of tests
|
||||||
total=92
|
total=92
|
||||||
run=0
|
run=0
|
||||||
failure=0
|
failure=0
|
||||||
|
|
||||||
|
# use first arg as our binary if specified
|
||||||
|
if ! type -p "$bin"; then
|
||||||
|
echo "Bail out! vercmp binary ($bin) could not be located"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# args:
|
# args:
|
||||||
# pass ver1 ver2 ret expected
|
# pass ver1 ver2 ret expected
|
||||||
pass() {
|
pass() {
|
||||||
@ -57,14 +63,6 @@ runtest() {
|
|||||||
$func $2 $1 $ret $reverse
|
$func $2 $1 $ret $reverse
|
||||||
}
|
}
|
||||||
|
|
||||||
# use first arg as our binary if specified
|
|
||||||
[[ -n "$1" ]] && bin="$1"
|
|
||||||
|
|
||||||
if ! type -p "$bin"; then
|
|
||||||
echo "Bail out! vercmp binary ($bin) could not be located"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "# Running vercmp tests..."
|
echo "# Running vercmp tests..."
|
||||||
|
|
||||||
echo "1..$total"
|
echo "1..$total"
|
||||||
|
Loading…
Reference in New Issue
Block a user