]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/test/crimson/seastore/transaction_manager_test_state.h
update ceph source to reef 18.2.1
[ceph.git] / ceph / src / test / crimson / seastore / transaction_manager_test_state.h
index fadf17019c13f10db62f05302e9297cf84257154..81200b1db7d976ac1872a1f3f3b05c2bd0dfbed8 100644 (file)
@@ -18,6 +18,9 @@
 #include "crimson/os/seastore/random_block_manager/rbm_device.h"
 #include "crimson/os/seastore/journal/circular_bounded_journal.h"
 #include "crimson/os/seastore/random_block_manager/block_rb_manager.h"
+#ifdef UNIT_TESTS_BUILT
+#include "test/crimson/gtest_seastar.h"
+#endif
 
 using namespace crimson;
 using namespace crimson::os;
@@ -167,7 +170,12 @@ public:
   void set_primary_device_ref(DeviceRef) final;
 };
 
-class EphemeralTestState {
+class EphemeralTestState 
+#ifdef UNIT_TESTS_BUILT
+  : public ::testing::WithParamInterface<const char*> {
+#else 
+  {
+#endif
 protected:
   journal_type_t journal_type;
   size_t num_main_device_managers = 0;
@@ -209,20 +217,23 @@ protected:
     restart_fut().get0();
   }
 
-  seastar::future<> tm_setup(
-    journal_type_t type = journal_type_t::SEGMENTED) {
+  seastar::future<> tm_setup() {
     LOG_PREFIX(EphemeralTestState::tm_setup);
-    journal_type = type;
-    if (journal_type == journal_type_t::SEGMENTED) {
-      devices.reset(new
-        EphemeralSegmentedDevices(
-          num_main_device_managers, num_cold_device_managers));
-    } else {
-      assert(journal_type == journal_type_t::RANDOM_BLOCK);
+#ifdef UNIT_TESTS_BUILT
+    std::string j_type = GetParam();
+#else
+    std::string j_type = "segmented";
+#endif
+    if (j_type == "circularbounded") {
       //TODO: multiple devices
       ceph_assert(num_main_device_managers == 1);
       ceph_assert(num_cold_device_managers == 0);
       devices.reset(new EphemeralRandomBlockDevices(1));
+    } else {
+      // segmented by default
+      devices.reset(new
+        EphemeralSegmentedDevices(
+          num_main_device_managers, num_cold_device_managers));
     }
     SUBINFO(test, "begin with {} devices ...", devices->get_num_devices());
     return devices->setup(