1
1
mirror of https://github.com/mgree/ffs.git synced 2024-09-11 11:15:48 +03:00
ffs/tests/rename_object.sh

35 lines
599 B
Bash
Raw Normal View History

#!/bin/sh
fail() {
echo FAILED: $1
if [ "$MNT" ]
then
2021-06-13 22:09:39 +03:00
cd
2021-06-09 04:44:24 +03:00
umount "$MNT"
rmdir "$MNT"
fi
exit 1
}
MNT=$(mktemp -d)
ffs "$MNT" ../json/obj_rename.json &
PID=$!
sleep 1
cd "$MNT"
case $(ls) in
(dot*dot_*dotdot*dotdot_) ;;
(*) fail ls;;
esac
[ "$(cat dot)" = "first" ] || fail dot
2021-06-09 04:44:24 +03:00
[ "$(cat dotdot)" = "second" ] || fail dotdot
[ "$(cat dot_)" = "third" ] || fail dot_
[ "$(cat dotdot_)" = "fourth" ] || fail dotdot_
cd - >/dev/null 2>&1
umount "$MNT" || fail unmount
sleep 1
kill -0 $PID >/dev/null 2>&1 && fail process
rmdir "$MNT" || fail mount