2014-11-28 16:15:15 +01:00
|
|
|
#include "testutils/FuseUnlinkTest.h"
|
|
|
|
|
2019-10-13 17:49:57 +02:00
|
|
|
using ::testing::Eq;
|
2014-11-28 16:15:15 +01:00
|
|
|
|
|
|
|
class FuseUnlinkFilenameTest: public FuseUnlinkTest {
|
|
|
|
};
|
|
|
|
|
|
|
|
TEST_F(FuseUnlinkFilenameTest, Unlink) {
|
|
|
|
ReturnIsFileOnLstat("/mydir");
|
2019-10-13 17:49:57 +02:00
|
|
|
EXPECT_CALL(*fsimpl, unlink(Eq("/mydir")))
|
2014-11-28 16:15:15 +01:00
|
|
|
// After rmdir was called, lstat should return that it doesn't exist anymore
|
|
|
|
// This is needed to make the ::rmdir() syscall pass.
|
|
|
|
.Times(1).WillOnce(FromNowOnReturnDoesntExistOnLstat());
|
|
|
|
|
|
|
|
Unlink("/mydir");
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(FuseUnlinkFilenameTest, UnlinkNested) {
|
|
|
|
ReturnIsDirOnLstat("/mydir");
|
|
|
|
ReturnIsFileOnLstat("/mydir/mysubdir");
|
2019-10-13 17:49:57 +02:00
|
|
|
EXPECT_CALL(*fsimpl, unlink(Eq("/mydir/mysubdir")))
|
2014-11-28 16:15:15 +01:00
|
|
|
// After rmdir was called, lstat should return that it doesn't exist anymore
|
|
|
|
// This is needed to make the ::rmdir() syscall pass.
|
|
|
|
.Times(1).WillOnce(FromNowOnReturnDoesntExistOnLstat());
|
|
|
|
|
|
|
|
Unlink("/mydir/mysubdir");
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(FuseUnlinkFilenameTest, UnlinkNested2) {
|
|
|
|
ReturnIsDirOnLstat("/mydir");
|
|
|
|
ReturnIsDirOnLstat("/mydir/mydir2");
|
|
|
|
ReturnIsFileOnLstat("/mydir/mydir2/mydir3");
|
2019-10-13 17:49:57 +02:00
|
|
|
EXPECT_CALL(*fsimpl, unlink(Eq("/mydir/mydir2/mydir3")))
|
2014-11-28 16:15:15 +01:00
|
|
|
// After rmdir was called, lstat should return that it doesn't exist anymore
|
|
|
|
// This is needed to make the ::rmdir() syscall pass.
|
|
|
|
.Times(1).WillOnce(FromNowOnReturnDoesntExistOnLstat());
|
|
|
|
|
|
|
|
Unlink("/mydir/mydir2/mydir3");
|
|
|
|
}
|