mirror of
https://github.com/mgree/ffs.git
synced 2024-09-11 19:17:40 +03:00
test for rename
This commit is contained in:
parent
6d74ad98ea
commit
520c606821
@ -194,7 +194,7 @@ impl Filesystem for FS {
|
||||
} else {
|
||||
mask -= mask & mode;
|
||||
}
|
||||
|
||||
|
||||
if mask == 0 {
|
||||
reply.ok();
|
||||
} else {
|
||||
@ -679,7 +679,6 @@ impl Filesystem for FS {
|
||||
reply.ok();
|
||||
}
|
||||
|
||||
// TODO
|
||||
fn rename(
|
||||
&mut self,
|
||||
req: &Request<'_>,
|
||||
|
48
tests/rename.sh
Executable file
48
tests/rename.sh
Executable file
@ -0,0 +1,48 @@
|
||||
#!/bin/sh
|
||||
|
||||
fail() {
|
||||
echo FAILED: $1
|
||||
if [ "$MNT" ]
|
||||
then
|
||||
cd
|
||||
umount "$MNT"
|
||||
rmdir "$MNT"
|
||||
fi
|
||||
exit 1
|
||||
}
|
||||
|
||||
MNT=$(mktemp -d)
|
||||
|
||||
ffs "$MNT" ../json/object.json &
|
||||
PID=$!
|
||||
sleep 2
|
||||
cd "$MNT"
|
||||
case $(ls) in
|
||||
(eyes*fingernails*human*name) ;;
|
||||
(*) fail ls1;;
|
||||
esac
|
||||
mv name full_name
|
||||
[ "$(cat full_name)" = "Michael Greenberg" ] || fail name1
|
||||
case $(ls) in
|
||||
(eyes*fingernails*full_name*human) ;;
|
||||
(*) fail ls2;;
|
||||
esac
|
||||
echo Prof. G >name
|
||||
mv full_name name
|
||||
case $(ls) in
|
||||
(eyes*fingernails*human*name) ;;
|
||||
(*) fail ls3;;
|
||||
esac
|
||||
[ "$(cat name)" = "Michael Greenberg" ] || fail name2
|
||||
mv nonesuch name && fail mv1
|
||||
case $(ls) in
|
||||
(eyes*fingernails*human*name) ;;
|
||||
(*) fail ls4;;
|
||||
esac
|
||||
cd - >/dev/null 2>&1
|
||||
umount "$MNT" || fail unmount
|
||||
sleep 1
|
||||
|
||||
kill -0 $PID >/dev/null 2>&1 && fail process
|
||||
|
||||
rmdir "$MNT" || fail mount
|
Loading…
Reference in New Issue
Block a user