Commit fb34e619 authored by Chris Lamb's avatar Chris Lamb

tests/touch: Tidy tests

parent 326d2cc5
......@@ -4,20 +4,33 @@
. ./common
Mount
f=target/a
exmtime=12345678
touch $f
touch -d @$exmtime $f
mtime=$(stat --format=%X-%Y $f)
[ "$mtime" = "$exmtime-$exmtime" ] || Fail "test1: Got=$mtime Expected=$exmtime"
touch $f
EXPECTED="12345678"
FILENAME="target/a"
touch ${FILENAME}
touch -d @${EXPECTED} ${FILENAME}
RESULT="$(stat --format=%X-%Y ${FILENAME})"
if [ "${RESULT}" != "${EXPECTED}-${EXPECTED}" ]
then
Fail "test1: Got=${RESULT} Expected=${EXPECTED}"
fi
# This is what tar xf does for extracted files via futimens(2)
touch -m -d @$exmtime $f
mtime=$(stat --format=%Y $f)
[ "$mtime" = "$exmtime" ] || XFail "test2: Got=$mtime Expected=$exmtime" # FIXME
touch $f
touch -a -d @$exmtime $f
atime=$(stat --format=%X $f)
[ "$atime" = "$exmtime" ] || XFail "test3: Got=$atime Expected=$exmtime" # FIXME
touch $f
touch ${FILENAME}
touch -m -d @${EXPECTED} ${FILENAME}
RESULT="$(stat --format=%Y ${FILENAME})"
if [ "${RESULT}" != "${EXPECTED}" ]
then
XFail "test2: Got=${RESULT} Expected=${EXPECTED}"
fi
touch ${FILENAME}
touch -a -d @${EXPECTED} ${FILENAME}
RESULT="$(stat --format=%X ${FILENAME})"
if [ "${RESULT}" != "${EXPECTED}" ]
then
XFail "test3: Got=${RESULT} Expected=${EXPECTED}"
fi
Unmount
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment