mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 08:47:12 +03:00
ad570291e4
Summary: While I had to disable a bunch of them at first, this allow them to compile properly and run. Future diffs will attempt to enable the disabled ones. Reviewed By: pkaush Differential Revision: D21188118 fbshipit-source-id: 154fec49c76563b0856fa36e78b2bbd09f0f2381
42 lines
952 B
C++
42 lines
952 B
C++
/*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This software may be used and distributed according to the terms of the
|
|
* GNU General Public License version 2.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <gtest/gtest.h>
|
|
#include "eden/fs/inodes/TreeInode.h"
|
|
|
|
namespace facebook {
|
|
namespace eden {
|
|
|
|
#ifndef _WIN32
|
|
struct ConditionalUnloader {
|
|
static size_t unload(TreeInode& unloadFrom) {
|
|
timespec endOfTime;
|
|
endOfTime.tv_sec = std::numeric_limits<time_t>::max();
|
|
endOfTime.tv_nsec = 999999999;
|
|
return unloadFrom.unloadChildrenLastAccessedBefore(endOfTime);
|
|
}
|
|
};
|
|
#endif
|
|
|
|
struct UnconditionalUnloader {
|
|
static size_t unload(TreeInode& unloadFrom) {
|
|
return unloadFrom.unloadChildrenNow();
|
|
}
|
|
};
|
|
|
|
#ifndef _WIN32
|
|
using InodeUnloaderTypes =
|
|
::testing::Types<ConditionalUnloader, UnconditionalUnloader>;
|
|
#else
|
|
using InodeUnloaderTypes = ::testing::Types<UnconditionalUnloader>;
|
|
#endif
|
|
|
|
} // namespace eden
|
|
} // namespace facebook
|