]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/seastar/tests/unit/alloc_test.cc
import quincy beta 17.1.0
[ceph.git] / ceph / src / seastar / tests / unit / alloc_test.cc
index 7569d49d9955d9b4590224a82ab736f30df9367c..820764ae44869421c8fccac188a7787e10a2ba80 100644 (file)
@@ -23,6 +23,8 @@
 #include <seastar/core/memory.hh>
 #include <seastar/core/smp.hh>
 #include <seastar/core/temporary_buffer.hh>
+#include <seastar/util/memory_diagnostics.hh>
+
 #include <vector>
 #include <future>
 #include <iostream>
@@ -99,6 +101,20 @@ SEASTAR_TEST_CASE(test_temporary_buffer_aligned) {
     return make_ready_future<>();
 }
 
+SEASTAR_TEST_CASE(test_memory_diagnostics) {
+    auto report = memory::generate_memory_diagnostics_report();
+#ifdef SEASTAR_DEFAULT_ALLOCATOR
+    BOOST_REQUIRE(report.length() == 0); // empty report with default allocator
+#else
+    // since the output format is unstructured text, not much
+    // to do except test that we get a non-empty string
+    BOOST_REQUIRE(report.length() > 0);
+    // useful while debugging diagnostics
+    // fmt::print("--------------------\n{}--------------------", report);
+#endif
+    return make_ready_future<>();
+}
+
 #ifndef SEASTAR_DEFAULT_ALLOCATOR
 
 struct thread_alloc_info {