Symlinks update atime correctly. Also added a test case for this.

This commit is contained in:
Sebastian Messmer 2016-06-07 21:47:23 -07:00
parent 69f4c7976e
commit 5a5037c992
5 changed files with 31 additions and 3 deletions

View File

@ -44,8 +44,9 @@ fspp::Dir::EntryType CrySymlink::getType() const {
return fspp::Dir::EntryType::SYMLINK;
}
bf::path CrySymlink::target() const {
bf::path CrySymlink::target() {
device()->callFsActionCallbacks();
parent()->updateAccessTimestampForChild(key());
auto blob = LoadBlob();
return blob->target();
}

View File

@ -14,7 +14,7 @@ public:
CrySymlink(CryDevice *device, cpputils::unique_ref<parallelaccessfsblobstore::DirBlobRef> parent, const blockstore::Key &key);
~CrySymlink();
boost::filesystem::path target() const override;
boost::filesystem::path target() override;
fspp::Dir::EntryType getType() const override;

View File

@ -13,7 +13,7 @@ class Symlink: public virtual Node {
public:
virtual ~Symlink() {}
virtual boost::filesystem::path target() const = 0;
virtual boost::filesystem::path target() = 0;
};
}

View File

@ -12,6 +12,7 @@
#include "FsppOpenFileTest.h"
#include "FsppDeviceTest_Timestamps.h"
#include "FsppNodeTest_Timestamps.h"
#include "FsppSymlinkTest_Timestamps.h"
#include "FsppFileTest_Timestamps.h"
#include "FsppOpenFileTest_Timestamps.h"
@ -22,6 +23,7 @@
INSTANTIATE_TYPED_TEST_CASE_P(FS_NAME, FsppFileTest, FIXTURE); \
INSTANTIATE_TYPED_TEST_CASE_P(FS_NAME, FsppFileTest_Timestamps, FIXTURE); \
INSTANTIATE_TYPED_TEST_CASE_P(FS_NAME, FsppSymlinkTest, FIXTURE); \
INSTANTIATE_TYPED_TEST_CASE_P(FS_NAME, FsppSymlinkTest_Timestamps, FIXTURE); \
INSTANTIATE_NODE_TEST_CASE( FS_NAME, FsppNodeTest_Rename, FIXTURE); \
INSTANTIATE_NODE_TEST_CASE( FS_NAME, FsppNodeTest_Stat, FIXTURE); \
INSTANTIATE_NODE_TEST_CASE( FS_NAME, FsppNodeTest_Timestamps, FIXTURE); \

View File

@ -0,0 +1,25 @@
#pragma once
#ifndef MESSMER_FSPP_FSTEST_FSPPSYMLINKTEST_TIMESTAMPS_H_
#define MESSMER_FSPP_FSTEST_FSPPSYMLINKTEST_TIMESTAMPS_H_
#include "testutils/TimestampTestUtils.h"
template<class ConcreteFileSystemTestFixture>
class FsppSymlinkTest_Timestamps: public FileSystemTest<ConcreteFileSystemTestFixture>, public TimestampTestUtils<fspp::Node> {
public:
};
TYPED_TEST_CASE_P(FsppSymlinkTest_Timestamps);
TYPED_TEST_P(FsppSymlinkTest_Timestamps, target) {
auto symlink = this->CreateSymlink("/mysymlink");
auto operation = [&symlink] () {
symlink->target();
};
this->EXPECT_OPERATION_UPDATES_TIMESTAMPS_AS(*symlink, operation, {this->ExpectUpdatesAccessTimestamp, this->ExpectDoesntUpdateModificationTimestamp, this->ExpectDoesntUpdateMetadataTimestamp});
}
REGISTER_TYPED_TEST_CASE_P(FsppSymlinkTest_Timestamps,
target
);
#endif