diff options
author | Roy Marples <roy@marples.name> | 2008-07-03 12:20:32 +0000 |
---|---|---|
committer | Roy Marples <roy@marples.name> | 2008-07-03 12:20:32 +0000 |
commit | e0968a1c2e7feda0e6146c1efdc0ec99027ca608 (patch) | |
tree | 74d2b7fb06a85653ef663b7e88e5a26c623c1cee /src/test/units | |
parent | 2f5d2855ba5497106a3b3ca02c242fb490bb425b (diff) |
Fix test.
Diffstat (limited to 'src/test/units')
-rw-r--r-- | src/test/units/.gitignore | 1 | ||||
-rwxr-xr-x | src/test/units/is_older_than | 28 |
2 files changed, 18 insertions, 11 deletions
diff --git a/src/test/units/.gitignore b/src/test/units/.gitignore new file mode 100644 index 00000000..94a37de3 --- /dev/null +++ b/src/test/units/.gitignore @@ -0,0 +1 @@ +tmp-* diff --git a/src/test/units/is_older_than b/src/test/units/is_older_than index 8c6d23aa..209d75d2 100755 --- a/src/test/units/is_older_than +++ b/src/test/units/is_older_than @@ -15,7 +15,7 @@ is_older_than() { local x= ref="$1" shift - for x in; do + for x; do [ "${x}" -nt "${ref}" ] && return 0 [ -d "${x}" ] && is_older_than "${ref}" "${x}"/* && return 0 done @@ -34,29 +34,35 @@ do_test() { ./"${TMPDIR}"/is_older_than "$@" r2=$? + [ -n "${VERBOSE}" ] && echo "baselayout = $r1 | OpenRC = $r2" [ $r1 = $r2 ] } +echo_cmd() { + [ -n "${VERBOSE}" ] && echo "$@" + "$@" +} + test_it() { do_test "${TMPDIR}"/ref "${TMPDIR}"/dir1 "${TMPDIR}"/dir2 || exit 1 } -mkdir -p "${TMPDIR}"/dir1 "${TMPDIR}"/dir2 -touch "${TMPDIR}"/dir1/f1 "${TMPDIR}"/dir1/f2 "${TMPDIR}"/dir1/f3 "${TMPDIR}"/dir2/f1 "${TMPDIR}"/dir2/f2 "${TMPDIR}"/dir2/f3 -sleep 1 -touch "${TMPDIR}"/ref +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 -sleep 1 -touch "${TMPDIR}"/dir1/f2 +echo_cmd sleep 1 +echo_cmd touch "${TMPDIR}"/dir1/f2 test_it -sleep 1 -touch "${TMPDIR}"/ref +echo_cmd sleep 1 +echo_cmd touch "${TMPDIR}"/ref test_it -sleep 1 -touch "${TMPDIR}"/dir2/f2 +echo_cmd sleep 1 +echo_cmd touch "${TMPDIR}"/dir2/f2 test_it rm -rf "${TMPDIR}" |