summaryrefslogtreecommitdiffstats
path: root/staging_vespalib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-02-09 13:37:59 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2022-02-09 13:37:59 +0000
commit3903e12659b57760a8ffe3140747daa13d01068d (patch)
tree3209cdd80d2bc9076d88c855e584776836028a07 /staging_vespalib
parent1a67c21b53b747b1aca81e8b942238583234c985 (diff)
Add a simple MallocMmapGuard
Diffstat (limited to 'staging_vespalib')
-rw-r--r--staging_vespalib/src/tests/shutdownguard/shutdownguard_test.cpp14
-rw-r--r--staging_vespalib/src/vespa/vespalib/util/CMakeLists.txt3
2 files changed, 10 insertions, 7 deletions
diff --git a/staging_vespalib/src/tests/shutdownguard/shutdownguard_test.cpp b/staging_vespalib/src/tests/shutdownguard/shutdownguard_test.cpp
index 79777cdd53f..0fb2dfdda4b 100644
--- a/staging_vespalib/src/tests/shutdownguard/shutdownguard_test.cpp
+++ b/staging_vespalib/src/tests/shutdownguard/shutdownguard_test.cpp
@@ -1,6 +1,7 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/vespalib/util/shutdownguard.h>
+#include <vespa/vespalib/util/malloc_mmap_guard.h>
#include <thread>
#include <unistd.h>
#include <sys/wait.h>
@@ -8,12 +9,8 @@
using namespace vespalib;
-TEST_SETUP(Test);
-
-int
-Test::Main()
+TEST("test shutdown guard")
{
- TEST_INIT("shutdownguard_test");
{
ShutdownGuard farFuture(1000000s);
std::this_thread::sleep_for(20ms);
@@ -37,5 +34,10 @@ Test::Main()
}
EXPECT_TRUE(i < 800);
}
- TEST_DONE();
}
+
+TEST("test malloc mmap guard") {
+ MallocMmapGuard guard(0x100000);
+}
+
+TEST_MAIN() { TEST_RUN_ALL(); } \ No newline at end of file
diff --git a/staging_vespalib/src/vespa/vespalib/util/CMakeLists.txt b/staging_vespalib/src/vespa/vespalib/util/CMakeLists.txt
index 2b52e9e167f..e69dd36d6f5 100644
--- a/staging_vespalib/src/vespa/vespalib/util/CMakeLists.txt
+++ b/staging_vespalib/src/vespa/vespalib/util/CMakeLists.txt
@@ -5,6 +5,7 @@ vespa_add_library(staging_vespalib_vespalib_util OBJECT
bits.cpp
clock.cpp
crc.cpp
+ document_runnable.cpp
doom.cpp
foregroundtaskexecutor.cpp
growablebytebuffer.cpp
@@ -12,10 +13,10 @@ vespa_add_library(staging_vespalib_vespalib_util OBJECT
jsonexception.cpp
jsonstream.cpp
jsonwriter.cpp
+ malloc_mmap_guard.cpp
process_memory_stats.cpp
programoptions.cpp
programoptions_testutils.cpp
- document_runnable.cpp
rusage.cpp
sequencedtaskexecutor.cpp
sequencedtaskexecutorobserver.cpp