2014-11-28 18:38:24 +01:00
|
|
|
#include "testutils/FuseUtimensTest.h"
|
|
|
|
|
|
|
|
using ::testing::_;
|
2019-10-13 17:49:57 +02:00
|
|
|
using ::testing::Eq;
|
2014-11-28 18:38:24 +01:00
|
|
|
using ::testing::Return;
|
|
|
|
|
|
|
|
class FuseUtimensFilenameTest: public FuseUtimensTest {
|
|
|
|
};
|
|
|
|
|
|
|
|
TEST_F(FuseUtimensFilenameTest, UtimensFile) {
|
|
|
|
ReturnIsFileOnLstat("/myfile");
|
2019-10-13 17:49:57 +02:00
|
|
|
EXPECT_CALL(*fsimpl, utimens(Eq("/myfile"), _, _))
|
2014-11-28 18:38:24 +01:00
|
|
|
.Times(1).WillOnce(Return());
|
|
|
|
|
2016-02-09 09:36:07 +01:00
|
|
|
Utimens("/myfile", TIMEVALUE, TIMEVALUE);
|
2014-11-28 18:38:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(FuseUtimensFilenameTest, UtimensFileNested) {
|
|
|
|
ReturnIsDirOnLstat("/mydir");
|
|
|
|
ReturnIsFileOnLstat("/mydir/myfile");
|
2019-10-13 17:49:57 +02:00
|
|
|
EXPECT_CALL(*fsimpl, utimens(Eq("/mydir/myfile"), _, _))
|
2014-11-28 18:38:24 +01:00
|
|
|
.Times(1).WillOnce(Return());
|
|
|
|
|
2016-02-09 09:36:07 +01:00
|
|
|
Utimens("/mydir/myfile", TIMEVALUE, TIMEVALUE);
|
2014-11-28 18:38:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(FuseUtimensFilenameTest, UtimensFileNested2) {
|
|
|
|
ReturnIsDirOnLstat("/mydir");
|
|
|
|
ReturnIsDirOnLstat("/mydir/mydir2");
|
|
|
|
ReturnIsFileOnLstat("/mydir/mydir2/myfile");
|
2019-10-13 17:49:57 +02:00
|
|
|
EXPECT_CALL(*fsimpl, utimens(Eq("/mydir/mydir2/myfile"), _, _))
|
2014-11-28 18:38:24 +01:00
|
|
|
.Times(1).WillOnce(Return());
|
|
|
|
|
2016-02-09 09:36:07 +01:00
|
|
|
Utimens("/mydir/mydir2/myfile", TIMEVALUE, TIMEVALUE);
|
2014-11-28 18:38:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(FuseUtimensFilenameTest, UtimensDir) {
|
|
|
|
ReturnIsDirOnLstat("/mydir");
|
2019-10-13 17:49:57 +02:00
|
|
|
EXPECT_CALL(*fsimpl, utimens(Eq("/mydir"), _, _))
|
2014-11-28 18:38:24 +01:00
|
|
|
.Times(1).WillOnce(Return());
|
|
|
|
|
2016-02-09 09:36:07 +01:00
|
|
|
Utimens("/mydir", TIMEVALUE, TIMEVALUE);
|
2014-11-28 18:38:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(FuseUtimensFilenameTest, UtimensDirNested) {
|
|
|
|
ReturnIsDirOnLstat("/mydir");
|
|
|
|
ReturnIsDirOnLstat("/mydir/mydir2");
|
2019-10-13 17:49:57 +02:00
|
|
|
EXPECT_CALL(*fsimpl, utimens(Eq("/mydir/mydir2"), _, _))
|
2014-11-28 18:38:24 +01:00
|
|
|
.Times(1).WillOnce(Return());
|
|
|
|
|
2016-02-09 09:36:07 +01:00
|
|
|
Utimens("/mydir/mydir2", TIMEVALUE, TIMEVALUE);
|
2014-11-28 18:38:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(FuseUtimensFilenameTest, UtimensDirNested2) {
|
|
|
|
ReturnIsDirOnLstat("/mydir");
|
|
|
|
ReturnIsDirOnLstat("/mydir/mydir2");
|
|
|
|
ReturnIsDirOnLstat("/mydir/mydir2/mydir3");
|
2019-10-13 17:49:57 +02:00
|
|
|
EXPECT_CALL(*fsimpl, utimens(Eq("/mydir/mydir2/mydir3"), _, _))
|
2014-11-28 18:38:24 +01:00
|
|
|
.Times(1).WillOnce(Return());
|
|
|
|
|
2016-02-09 09:36:07 +01:00
|
|
|
Utimens("/mydir/mydir2/mydir3", TIMEVALUE, TIMEVALUE);
|
2014-11-28 18:38:24 +01:00
|
|
|
}
|