Skip to content

Commit dd4248f

Browse files
committed
osd: test: Split unittest harness for EC into legacy and new code.
Signed-off-by: Alex Ainscow <[email protected]>
1 parent 1fceb55 commit dd4248f

File tree

7 files changed

+729
-26
lines changed

7 files changed

+729
-26
lines changed

src/test/osd/CMakeLists.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ add_executable(unittest_osd_types
6060
add_ceph_unittest(unittest_osd_types)
6161
target_link_libraries(unittest_osd_types global)
6262

63+
# unittest_ecbackend_l (legacy EC)
64+
add_executable(unittest_ecbackend_l
65+
TestECBackendL.cc
66+
$<TARGET_OBJECTS:unit-main>
67+
)
68+
add_ceph_unittest(unittest_ecbackend_l)
69+
target_link_libraries(unittest_ecbackend_l osd global)
70+
6371
# unittest_ecbackend
6472
add_executable(unittest_ecbackend
6573
TestECBackend.cc
@@ -112,6 +120,13 @@ endif()
112120
add_ceph_unittest(unittest_osd_osdcap)
113121
target_link_libraries(unittest_osd_osdcap osd global ${BLKID_LIBRARIES})
114122

123+
# unittest ExtentCache (Legacy)
124+
add_executable(unittest_extent_cache_l
125+
test_extent_cache_l.cc
126+
)
127+
add_ceph_unittest(unittest_extent_cache_l)
128+
target_link_libraries(unittest_extent_cache_l osd global ${BLKID_LIBRARIES})
129+
115130
# unittest ExtentCache
116131
add_executable(unittest_extent_cache
117132
test_extent_cache.cc
@@ -126,13 +141,21 @@ add_executable(unittest_pg_transaction
126141
add_ceph_unittest(unittest_pg_transaction)
127142
target_link_libraries(unittest_pg_transaction osd global ${BLKID_LIBRARIES})
128143

144+
# unittest ECTransaction (Legacy)
145+
add_executable(unittest_ec_transaction_l
146+
test_ec_transaction_l.cc
147+
)
148+
add_ceph_unittest(unittest_ec_transaction_l)
149+
target_link_libraries(unittest_ec_transaction_l osd global ${BLKID_LIBRARIES})
150+
129151
# unittest ECTransaction
130152
add_executable(unittest_ec_transaction
131153
test_ec_transaction.cc
132154
)
133155
add_ceph_unittest(unittest_ec_transaction)
134156
target_link_libraries(unittest_ec_transaction osd global ${BLKID_LIBRARIES})
135157

158+
# unittest_mclock_scheduler
136159
# unittest_mclock_scheduler
137160
add_executable(unittest_mclock_scheduler
138161
TestMClockScheduler.cc

src/test/osd/TestECBackend.cc

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
#include <sstream>
1717
#include <errno.h>
1818
#include <signal.h>
19-
#include "osd/ECCommonL.h"
20-
#include "osd/ECBackendL.h"
19+
#include "osd/ECCommon.h"
20+
#include "osd/ECBackend.h"
2121
#include "gtest/gtest.h"
2222

2323
using namespace std;
@@ -177,31 +177,31 @@ TEST(ECCommon, get_min_want_to_read_shards)
177177
// read nothing at the very beginning
178178
{
179179
std::set<int> want_to_read;
180-
ECCommonL::ReadPipeline::get_min_want_to_read_shards(
180+
ECCommon::ReadPipeline::get_min_want_to_read_shards(
181181
0, 0, s, &want_to_read);
182182
ASSERT_TRUE(want_to_read == std::set<int>{});
183183
}
184184

185185
// read nothing at the middle (0-sized partial read)
186186
{
187187
std::set<int> want_to_read;
188-
ECCommonL::ReadPipeline::get_min_want_to_read_shards(
188+
ECCommon::ReadPipeline::get_min_want_to_read_shards(
189189
2048, 0, s, &want_to_read);
190190
ASSERT_TRUE(want_to_read == std::set<int>{});
191191
}
192192

193193
// read not-so-many (< chunk_size) bytes at the middle (partial read)
194194
{
195195
std::set<int> want_to_read;
196-
ECCommonL::ReadPipeline::get_min_want_to_read_shards(
196+
ECCommon::ReadPipeline::get_min_want_to_read_shards(
197197
2048, 42, s, &want_to_read);
198198
ASSERT_TRUE(want_to_read == std::set<int>{2});
199199
}
200200

201201
// read more (> chunk_size) bytes at the middle (partial read)
202202
{
203203
std::set<int> want_to_read;
204-
ECCommonL::ReadPipeline::get_min_want_to_read_shards(
204+
ECCommon::ReadPipeline::get_min_want_to_read_shards(
205205
1024, 1024+42, s, &want_to_read);
206206
// extra () due to a language / macro limitation
207207
ASSERT_TRUE(want_to_read == (std::set<int>{1, 2}));
@@ -210,7 +210,7 @@ TEST(ECCommon, get_min_want_to_read_shards)
210210
// full stripe except last chunk
211211
{
212212
std::set<int> want_to_read;
213-
ECCommonL::ReadPipeline::get_min_want_to_read_shards(
213+
ECCommon::ReadPipeline::get_min_want_to_read_shards(
214214
0, 3*1024, s, &want_to_read);
215215
// extra () due to a language / macro limitation
216216
ASSERT_TRUE(want_to_read == (std::set<int>{0, 1, 2}));
@@ -219,7 +219,7 @@ TEST(ECCommon, get_min_want_to_read_shards)
219219
// full stripe except 1st chunk
220220
{
221221
std::set<int> want_to_read;
222-
ECCommonL::ReadPipeline::get_min_want_to_read_shards(
222+
ECCommon::ReadPipeline::get_min_want_to_read_shards(
223223
1024, swidth-1024, s, &want_to_read);
224224
// extra () due to a language / macro limitation
225225
ASSERT_TRUE(want_to_read == (std::set<int>{1, 2, 3}));
@@ -228,7 +228,7 @@ TEST(ECCommon, get_min_want_to_read_shards)
228228
// large, multi-stripe read starting just after 1st chunk
229229
{
230230
std::set<int> want_to_read;
231-
ECCommonL::ReadPipeline::get_min_want_to_read_shards(
231+
ECCommon::ReadPipeline::get_min_want_to_read_shards(
232232
1024, swidth*42, s, &want_to_read);
233233
// extra () due to a language / macro limitation
234234
ASSERT_TRUE(want_to_read == (std::set<int>{0, 1, 2, 3}));
@@ -237,7 +237,7 @@ TEST(ECCommon, get_min_want_to_read_shards)
237237
// large read from the beginning
238238
{
239239
std::set<int> want_to_read;
240-
ECCommonL::ReadPipeline::get_min_want_to_read_shards(
240+
ECCommon::ReadPipeline::get_min_want_to_read_shards(
241241
0, swidth*42, s, &want_to_read);
242242
// extra () due to a language / macro limitation
243243
ASSERT_TRUE(want_to_read == (std::set<int>{0, 1, 2, 3}));
@@ -259,10 +259,10 @@ TEST(ECCommon, get_min_want_to_read_shards_bug67087)
259259
// multitple calls with the same want_to_read can happen during
260260
// multi-region reads.
261261
{
262-
ECCommonL::ReadPipeline::get_min_want_to_read_shards(
262+
ECCommon::ReadPipeline::get_min_want_to_read_shards(
263263
512, 512, s, &want_to_read);
264264
ASSERT_EQ(want_to_read, std::set<int>{0});
265-
ECCommonL::ReadPipeline::get_min_want_to_read_shards(
265+
ECCommon::ReadPipeline::get_min_want_to_read_shards(
266266
512+16*1024, 512, s, &want_to_read);
267267
ASSERT_EQ(want_to_read, std::set<int>{0});
268268
}

0 commit comments

Comments
 (0)