2014-11-28 15:54:18 +01:00
|
|
|
#include "testutils/FuseMkdirTest.h"
|
|
|
|
|
|
|
|
using ::testing::_;
|
2019-10-13 17:49:57 +02:00
|
|
|
using ::testing::Eq;
|
2014-11-28 15:54:18 +01:00
|
|
|
|
|
|
|
class FuseMkdirDirnameTest: public FuseMkdirTest {
|
|
|
|
};
|
|
|
|
|
|
|
|
TEST_F(FuseMkdirDirnameTest, Mkdir) {
|
|
|
|
ReturnDoesntExistOnLstat("/mydir");
|
2019-10-13 17:49:57 +02:00
|
|
|
EXPECT_CALL(*fsimpl, mkdir(Eq("/mydir"), _, _, _))
|
2015-04-25 03:26:59 +02:00
|
|
|
// After mkdir was called, lstat should return that it is a dir.
|
|
|
|
// This is needed to make the ::mkdir() syscall pass.
|
|
|
|
.Times(1).WillOnce(FromNowOnReturnIsDirOnLstat());
|
2014-11-28 15:54:18 +01:00
|
|
|
|
|
|
|
Mkdir("/mydir", 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(FuseMkdirDirnameTest, MkdirNested) {
|
|
|
|
ReturnIsDirOnLstat("/mydir");
|
|
|
|
ReturnDoesntExistOnLstat("/mydir/mysubdir");
|
2019-10-13 17:49:57 +02:00
|
|
|
EXPECT_CALL(*fsimpl, mkdir(Eq("/mydir/mysubdir"), _, _, _))
|
2015-04-25 03:26:59 +02:00
|
|
|
// After mkdir was called, lstat should return that it is a dir.
|
|
|
|
// This is needed to make the ::mkdir() syscall pass.
|
|
|
|
.Times(1).WillOnce(FromNowOnReturnIsDirOnLstat());
|
2014-11-28 15:54:18 +01:00
|
|
|
|
|
|
|
Mkdir("/mydir/mysubdir", 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(FuseMkdirDirnameTest, MkdirNested2) {
|
|
|
|
ReturnIsDirOnLstat("/mydir");
|
|
|
|
ReturnIsDirOnLstat("/mydir/mydir2");
|
|
|
|
ReturnDoesntExistOnLstat("/mydir/mydir2/mydir3");
|
2019-10-13 17:49:57 +02:00
|
|
|
EXPECT_CALL(*fsimpl, mkdir(Eq("/mydir/mydir2/mydir3"), _, _, _))
|
2015-04-25 03:26:59 +02:00
|
|
|
// After mkdir was called, lstat should return that it is a dir.
|
|
|
|
// This is needed to make the ::mkdir() syscall pass.
|
|
|
|
.Times(1).WillOnce(FromNowOnReturnIsDirOnLstat());
|
2014-11-28 15:54:18 +01:00
|
|
|
|
|
|
|
Mkdir("/mydir/mydir2/mydir3", 0);
|
|
|
|
}
|