aboutsummaryrefslogtreecommitdiff
path: root/test/units
diff options
context:
space:
mode:
Diffstat (limited to 'test/units')
-rwxr-xr-xtest/units/check-is-older-than.sh (renamed from test/units/is_older_than)13
-rwxr-xr-xtest/units/check-sh-yesno.sh (renamed from test/units/sh_yesno)2
-rw-r--r--test/units/meson.build5
3 files changed, 16 insertions, 4 deletions
diff --git a/test/units/is_older_than b/test/units/check-is-older-than.sh
index 47a62d78..8987fcd2 100755
--- a/test/units/is_older_than
+++ b/test/units/check-is-older-than.sh
@@ -2,7 +2,13 @@
# unit test for is_older_than code of baselayout (2008/06/19)
# Author: Matthias Schwarzott <zzam@gentoo.org>
-TMPDIR=tmp-"$(basename "$0")"
+if [ -z "${BUILD_ROOT}" ]; then
+ printf "%s\n" "BUILD_ROOT must be defined" >&2
+ exit 1
+fi
+PATH="${BUILD_ROOT}"/src/is_older_than:${PATH}
+
+TMPDIR="${BUILD_ROOT}"/tmp-"$(basename "$0")"
# Please note that we added this unit test because the function
# should really be called is_newer_than as it's what it's really testing.
@@ -37,13 +43,14 @@ do_test()
is_older_than "$@"
r2=$?
- [ -n "${VERBOSE}" ] && echo "reference = $r1 | OpenRC = $r2"
+ [ -n "${VERBOSE}" ] &&
+ printf "reference = %s | OpenRC = %s\n" "$r1" "$r2"
[ $r1 = $r2 ]
}
echo_cmd()
{
- [ -n "${VERBOSE}" ] && echo "$@"
+ [ -n "${VERBOSE}" ] && printf "%s\n" "$@"
"$@"
}
diff --git a/test/units/sh_yesno b/test/units/check-sh-yesno.sh
index 380864ee..ecc2f6dd 100755
--- a/test/units/sh_yesno
+++ b/test/units/check-sh-yesno.sh
@@ -9,7 +9,7 @@
# This file may not be copied, modified, propagated, or distributed
# except according to the terms contained in the LICENSE file.
-: ${top_srcdir:=..}
+top_srcdir=${SOURCE_ROOT:-..}
. $top_srcdir/test/setup_env.sh
ret=0
diff --git a/test/units/meson.build b/test/units/meson.build
new file mode 100644
index 00000000..23c2758a
--- /dev/null
+++ b/test/units/meson.build
@@ -0,0 +1,5 @@
+is_older_than = find_program('check-is-older-than.sh')
+sh_yesno = find_program('check-sh-yesno.sh')
+
+test('is_older_than', is_older_than, env : test_env)
+test('sh_yesno', sh_yesno, env : test_env)