2014-11-28 16:06:28 +01:00
|
|
|
#include "testutils/FuseRmdirTest.h"
|
|
|
|
|
2019-10-13 17:49:57 +02:00
|
|
|
using ::testing::Eq;
|
2014-11-28 16:06:28 +01:00
|
|
|
|
|
|
|
class FuseRmdirDirnameTest: public FuseRmdirTest {
|
|
|
|
};
|
|
|
|
|
|
|
|
TEST_F(FuseRmdirDirnameTest, Rmdir) {
|
|
|
|
ReturnIsDirOnLstat("/mydir");
|
2019-10-13 17:49:57 +02:00
|
|
|
EXPECT_CALL(*fsimpl, rmdir(Eq("/mydir")))
|
2014-11-28 16:06:28 +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());
|
|
|
|
|
|
|
|
Rmdir("/mydir");
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(FuseRmdirDirnameTest, RmdirNested) {
|
|
|
|
ReturnIsDirOnLstat("/mydir");
|
|
|
|
ReturnIsDirOnLstat("/mydir/mysubdir");
|
2019-10-13 17:49:57 +02:00
|
|
|
EXPECT_CALL(*fsimpl, rmdir(Eq("/mydir/mysubdir")))
|
2014-11-28 16:06:28 +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());
|
|
|
|
|
|
|
|
Rmdir("/mydir/mysubdir");
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(FuseRmdirDirnameTest, RmdirNested2) {
|
|
|
|
ReturnIsDirOnLstat("/mydir");
|
|
|
|
ReturnIsDirOnLstat("/mydir/mydir2");
|
|
|
|
ReturnIsDirOnLstat("/mydir/mydir2/mydir3");
|
2019-10-13 17:49:57 +02:00
|
|
|
EXPECT_CALL(*fsimpl, rmdir(Eq("/mydir/mydir2/mydir3")))
|
2014-11-28 16:06:28 +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());
|
|
|
|
|
|
|
|
Rmdir("/mydir/mydir2/mydir3");
|
|
|
|
}
|