aboutsummaryrefslogtreecommitdiffstats
path: root/util/system/mincore_ut.cpp
diff options
context:
space:
mode:
authorAlexey Salmin <alexey.salmin@gmail.com>2022-02-10 16:49:37 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:37 +0300
commit71af077a5dfe7e9f932a508422c2dac81a57ebc0 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /util/system/mincore_ut.cpp
parent3c5b1607b38f637d2f3313791ed25c2e080d2647 (diff)
downloadydb-71af077a5dfe7e9f932a508422c2dac81a57ebc0.tar.gz
Restoring authorship annotation for Alexey Salmin <alexey.salmin@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'util/system/mincore_ut.cpp')
-rw-r--r--util/system/mincore_ut.cpp90
1 files changed, 45 insertions, 45 deletions
diff --git a/util/system/mincore_ut.cpp b/util/system/mincore_ut.cpp
index 1a7afcc6a5..fc46cb1632 100644
--- a/util/system/mincore_ut.cpp
+++ b/util/system/mincore_ut.cpp
@@ -1,47 +1,47 @@
#include <library/cpp/testing/unittest/registar.h>
-
-#ifdef _unix_
+
+#ifdef _unix_
#include <sys/resource.h>
-#endif
-
-#include "filemap.h"
-#include "info.h"
-#include "mincore.h"
-#include "mlock.h"
-#include "tempfile.h"
-
-#include <util/generic/size_literals.h>
-#include <util/system/fs.h>
-
-#include <cstring>
-#include <cstdio>
-
-Y_UNIT_TEST_SUITE(MincoreSuite) {
- static const char* FileName_("./mappped_file");
-
- Y_UNIT_TEST(TestLockAndInCore) {
- TVector<char> content(2_MB);
-
- TTempFile cleanup(FileName_);
- TFile file(FileName_, CreateAlways | WrOnly);
- file.Write(content.data(), content.size());
- file.Close();
-
- TFileMap mappedFile(FileName_, TMemoryMapCommon::oRdWr);
- mappedFile.Map(0, mappedFile.Length());
- UNIT_ASSERT_EQUAL(mappedFile.MappedSize(), content.size());
- UNIT_ASSERT_EQUAL(mappedFile.Length(), static_cast<i64>(content.size()));
-
- LockMemory(mappedFile.Ptr(), mappedFile.Length());
-
- TVector<unsigned char> incore(mappedFile.Length() / NSystemInfo::GetPageSize());
- InCoreMemory(mappedFile.Ptr(), mappedFile.Length(), incore.data(), incore.size());
-
- // compile and run on all platforms, but assume non-zero results only on Linux
-#if defined(_linux_)
- for (const auto& flag : incore) {
- UNIT_ASSERT(IsPageInCore(flag));
- }
-#endif
- }
-}
+#endif
+
+#include "filemap.h"
+#include "info.h"
+#include "mincore.h"
+#include "mlock.h"
+#include "tempfile.h"
+
+#include <util/generic/size_literals.h>
+#include <util/system/fs.h>
+
+#include <cstring>
+#include <cstdio>
+
+Y_UNIT_TEST_SUITE(MincoreSuite) {
+ static const char* FileName_("./mappped_file");
+
+ Y_UNIT_TEST(TestLockAndInCore) {
+ TVector<char> content(2_MB);
+
+ TTempFile cleanup(FileName_);
+ TFile file(FileName_, CreateAlways | WrOnly);
+ file.Write(content.data(), content.size());
+ file.Close();
+
+ TFileMap mappedFile(FileName_, TMemoryMapCommon::oRdWr);
+ mappedFile.Map(0, mappedFile.Length());
+ UNIT_ASSERT_EQUAL(mappedFile.MappedSize(), content.size());
+ UNIT_ASSERT_EQUAL(mappedFile.Length(), static_cast<i64>(content.size()));
+
+ LockMemory(mappedFile.Ptr(), mappedFile.Length());
+
+ TVector<unsigned char> incore(mappedFile.Length() / NSystemInfo::GetPageSize());
+ InCoreMemory(mappedFile.Ptr(), mappedFile.Length(), incore.data(), incore.size());
+
+ // compile and run on all platforms, but assume non-zero results only on Linux
+#if defined(_linux_)
+ for (const auto& flag : incore) {
+ UNIT_ASSERT(IsPageInCore(flag));
+ }
+#endif
+ }
+}