aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2009-02-23 10:43:24 +0000
committerRoy Marples <roy@marples.name>2009-02-23 10:43:24 +0000
commitf38ef0093915724421052abcf1f4013fe5738d32 (patch)
treee340327c2c7b911ed7c244696d367a24010dd883
parent66cd081301a0b2e72c8ac348c2f1361261caae82 (diff)
Fix unit test.
-rwxr-xr-xsrc/test/units/is_older_than42
1 files changed, 24 insertions, 18 deletions
diff --git a/src/test/units/is_older_than b/src/test/units/is_older_than
index 7737f5fd..47a62d78 100755
--- a/src/test/units/is_older_than
+++ b/src/test/units/is_older_than
@@ -28,9 +28,6 @@ ref_is_older_than()
return 1
}
-rm -rf "${TMPDIR}"
-mkdir "${TMPDIR}"
-
do_test()
{
local r1= r2=
@@ -55,23 +52,32 @@ test_it()
do_test "${TMPDIR}"/ref "${TMPDIR}"/dir1 "${TMPDIR}"/dir2
}
-echo_cmd mkdir -p "${TMPDIR}"/dir1 "${TMPDIR}"/dir2
-echo_cmd touch "${TMPDIR}"/dir1/f1 "${TMPDIR}"/dir1/f2 "${TMPDIR}"/dir1/f3 "${TMPDIR}"/dir2/f1 "${TMPDIR}"/dir2/f2 "${TMPDIR}"/dir2/f3
-echo_cmd sleep 1
-echo_cmd touch "${TMPDIR}"/ref
-test_it
+run_test()
+{
+ echo_cmd mkdir -p "${TMPDIR}"/dir1 "${TMPDIR}"/dir2
+ echo_cmd touch "${TMPDIR}"/dir1/f1 "${TMPDIR}"/dir1/f2 \
+ "${TMPDIR}"/dir1/f3 "${TMPDIR}"/dir2/f1 \
+ "${TMPDIR}"/dir2/f2 "${TMPDIR}"/dir2/f3
+ echo_cmd sleep 1
+ echo_cmd touch "${TMPDIR}"/ref
+ test_it || return 1
-echo_cmd sleep 1
-echo_cmd touch "${TMPDIR}"/dir1/f2
-test_it
+ echo_cmd sleep 1
+ echo_cmd touch "${TMPDIR}"/dir1/f2
+ test_it || return 1
-echo_cmd sleep 1
-echo_cmd touch "${TMPDIR}"/ref
-test_it
+ echo_cmd sleep 1
+ echo_cmd touch "${TMPDIR}"/ref
+ test_it || return 1
-echo_cmd sleep 1
-echo_cmd touch "${TMPDIR}"/dir2/f2
-test_it
+ echo_cmd sleep 1
+ echo_cmd touch "${TMPDIR}"/dir2/f2
+ test_it || return 1
+}
rm -rf "${TMPDIR}"
-exit 0
+mkdir "${TMPDIR}"
+run_test
+retval=$?
+rm -rf "${TMPDIR}"
+exit ${retval}