summaryrefslogtreecommitdiff
path: root/examples/redis-unstable/deps/jemalloc/test/integration/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/redis-unstable/deps/jemalloc/test/integration/cpp')
-rw-r--r--examples/redis-unstable/deps/jemalloc/test/integration/cpp/basic.cpp24
-rw-r--r--examples/redis-unstable/deps/jemalloc/test/integration/cpp/infallible_new_false.cpp23
-rw-r--r--examples/redis-unstable/deps/jemalloc/test/integration/cpp/infallible_new_false.sh8
-rw-r--r--examples/redis-unstable/deps/jemalloc/test/integration/cpp/infallible_new_true.cpp67
-rw-r--r--examples/redis-unstable/deps/jemalloc/test/integration/cpp/infallible_new_true.sh8
5 files changed, 0 insertions, 130 deletions
diff --git a/examples/redis-unstable/deps/jemalloc/test/integration/cpp/basic.cpp b/examples/redis-unstable/deps/jemalloc/test/integration/cpp/basic.cpp
deleted file mode 100644
index c1cf6cd..0000000
--- a/examples/redis-unstable/deps/jemalloc/test/integration/cpp/basic.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-#include "test/jemalloc_test.h"
-
-TEST_BEGIN(test_basic) {
- auto foo = new long(4);
- expect_ptr_not_null(foo, "Unexpected new[] failure");
- delete foo;
- // Test nullptr handling.
- foo = nullptr;
- delete foo;
-
- auto bar = new long;
- expect_ptr_not_null(bar, "Unexpected new failure");
- delete bar;
- // Test nullptr handling.
- bar = nullptr;
- delete bar;
-}
-TEST_END
-
-int
-main() {
- return test(
- test_basic);
-}
diff --git a/examples/redis-unstable/deps/jemalloc/test/integration/cpp/infallible_new_false.cpp b/examples/redis-unstable/deps/jemalloc/test/integration/cpp/infallible_new_false.cpp
deleted file mode 100644
index 42196d6..0000000
--- a/examples/redis-unstable/deps/jemalloc/test/integration/cpp/infallible_new_false.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <memory>
-
-#include "test/jemalloc_test.h"
-
-TEST_BEGIN(test_failing_alloc) {
- bool saw_exception = false;
- try {
- /* Too big of an allocation to succeed. */
- void *volatile ptr = ::operator new((size_t)-1);
- (void)ptr;
- } catch (...) {
- saw_exception = true;
- }
- expect_true(saw_exception, "Didn't get a failure");
-}
-TEST_END
-
-int
-main(void) {
- return test(
- test_failing_alloc);
-}
-
diff --git a/examples/redis-unstable/deps/jemalloc/test/integration/cpp/infallible_new_false.sh b/examples/redis-unstable/deps/jemalloc/test/integration/cpp/infallible_new_false.sh
deleted file mode 100644
index 7d41812..0000000
--- a/examples/redis-unstable/deps/jemalloc/test/integration/cpp/infallible_new_false.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-
-XMALLOC_STR=""
-if [ "x${enable_xmalloc}" = "x1" ] ; then
- XMALLOC_STR="xmalloc:false,"
-fi
-
-export MALLOC_CONF="${XMALLOC_STR}experimental_infallible_new:false"
diff --git a/examples/redis-unstable/deps/jemalloc/test/integration/cpp/infallible_new_true.cpp b/examples/redis-unstable/deps/jemalloc/test/integration/cpp/infallible_new_true.cpp
deleted file mode 100644
index d675412..0000000
--- a/examples/redis-unstable/deps/jemalloc/test/integration/cpp/infallible_new_true.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-#include <stdio.h>
-
-#include "test/jemalloc_test.h"
-
-/*
- * We can't test C++ in unit tests. In order to intercept abort, use a secret
- * safety check abort hook in integration tests.
- */
-typedef void (*abort_hook_t)(const char *message);
-bool fake_abort_called;
-void fake_abort(const char *message) {
- if (strcmp(message, "<jemalloc>: Allocation failed and "
- "opt.experimental_infallible_new is true. Aborting.\n") != 0) {
- abort();
- }
- fake_abort_called = true;
-}
-
-static bool
-own_operator_new(void) {
- uint64_t before, after;
- size_t sz = sizeof(before);
-
- /* thread.allocated is always available, even w/o config_stats. */
- expect_d_eq(mallctl("thread.allocated", (void *)&before, &sz, NULL, 0),
- 0, "Unexpected mallctl failure reading stats");
- void *volatile ptr = ::operator new((size_t)8);
- expect_ptr_not_null(ptr, "Unexpected allocation failure");
- expect_d_eq(mallctl("thread.allocated", (void *)&after, &sz, NULL, 0),
- 0, "Unexpected mallctl failure reading stats");
-
- return (after != before);
-}
-
-TEST_BEGIN(test_failing_alloc) {
- abort_hook_t abort_hook = &fake_abort;
- expect_d_eq(mallctl("experimental.hooks.safety_check_abort", NULL, NULL,
- (void *)&abort_hook, sizeof(abort_hook)), 0,
- "Unexpected mallctl failure setting abort hook");
-
- /*
- * Not owning operator new is only expected to happen on MinGW which
- * does not support operator new / delete replacement.
- */
-#ifdef _WIN32
- test_skip_if(!own_operator_new());
-#else
- expect_true(own_operator_new(), "No operator new overload");
-#endif
- void *volatile ptr = (void *)1;
- try {
- /* Too big of an allocation to succeed. */
- ptr = ::operator new((size_t)-1);
- } catch (...) {
- abort();
- }
- expect_ptr_null(ptr, "Allocation should have failed");
- expect_b_eq(fake_abort_called, true, "Abort hook not invoked");
-}
-TEST_END
-
-int
-main(void) {
- return test(
- test_failing_alloc);
-}
-
diff --git a/examples/redis-unstable/deps/jemalloc/test/integration/cpp/infallible_new_true.sh b/examples/redis-unstable/deps/jemalloc/test/integration/cpp/infallible_new_true.sh
deleted file mode 100644
index 4a0ff54..0000000
--- a/examples/redis-unstable/deps/jemalloc/test/integration/cpp/infallible_new_true.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-
-XMALLOC_STR=""
-if [ "x${enable_xmalloc}" = "x1" ] ; then
- XMALLOC_STR="xmalloc:false,"
-fi
-
-export MALLOC_CONF="${XMALLOC_STR}experimental_infallible_new:true"