summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rwxr-xr-xtest/scripts/human_to_size_test.sh7
-rwxr-xr-xtest/scripts/parseopts_test.sh7
-rwxr-xr-xtest/util/pacsorttest.sh15
-rwxr-xr-xtest/util/vercmptest.sh16
4 files changed, 21 insertions, 24 deletions
diff --git a/test/scripts/human_to_size_test.sh b/test/scripts/human_to_size_test.sh
index 678fa876..63061372 100755
--- a/test/scripts/human_to_size_test.sh
+++ b/test/scripts/human_to_size_test.sh
@@ -3,11 +3,12 @@
declare -i testcount=0 fail=0 pass=0 total=15
# source the library function
-if [[ -z $1 || ! -f $1 ]]; then
- printf "Bail out! path to human_to_size library not provided or does not exist\n"
+lib=${1:-${PMTEST_SCRIPTLIB_DIR}human_to_size.sh}
+if [[ -z $lib || ! -f $lib ]]; then
+ echo "Bail out! human_to_size library ($lib) could not be located\n"
exit 1
fi
-. "$1"
+. "$lib"
if ! type -t human_to_size >/dev/null; then
printf 'Bail out! human_to_size function not found\n'
diff --git a/test/scripts/parseopts_test.sh b/test/scripts/parseopts_test.sh
index 8df1908b..5ff4bc55 100755
--- a/test/scripts/parseopts_test.sh
+++ b/test/scripts/parseopts_test.sh
@@ -3,11 +3,12 @@
declare -i testcount=0 pass=0 fail=0 total=25
# source the library function
-if [[ -z $1 || ! -f $1 ]]; then
- printf "Bail out! path to parseopts library not provided or does not exist\n"
+lib=${1:-${PMTEST_SCRIPTLIB_DIR}parseopts.sh}
+if [[ -z $lib || ! -f $lib ]]; then
+ printf "Bail out! parseopts library ($lib) could not be located\n"
exit 1
fi
-. "$1"
+. "$lib"
if ! type -t parseopts >/dev/null; then
printf 'Bail out! parseopts function not found\n'
diff --git a/test/util/pacsorttest.sh b/test/util/pacsorttest.sh
index 0abddc26..ac16c459 100755
--- a/test/util/pacsorttest.sh
+++ b/test/util/pacsorttest.sh
@@ -19,12 +19,17 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# default binary if one was not specified as $1
-bin='pacsort'
+bin=${1:-${PMTEST_UTIL_DIR}pacsort}
# holds counts of tests
total=23
run=0
failure=0
+if ! type -p "$bin"; then
+ echo "Bail out! pacsort binary ($bin) could not be located"
+ exit 1
+fi
+
# args:
# runtest input expected test_description optional_opts
runtest() {
@@ -42,14 +47,6 @@ runtest() {
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 "1..$total"
diff --git a/test/util/vercmptest.sh b/test/util/vercmptest.sh
index 9297cdcb..a7fd8517 100755
--- a/test/util/vercmptest.sh
+++ b/test/util/vercmptest.sh
@@ -18,12 +18,18 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# default binary if one was not specified as $1
-bin='vercmp'
+bin=${1:-${PMTEST_UTIL_DIR}vercmp}
# holds counts of tests
total=92
run=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:
# pass ver1 ver2 ret expected
pass() {
@@ -57,14 +63,6 @@ runtest() {
$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 "1..$total"