MCPcopy Create free account
hub / github.com/ceph/ceph / TEST

Function TEST

src/test/erasure-code/TestErasureCodeShec_arguments.cc:148–350  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

146}
147
148IGNORE_DEPRECATED
149TEST(ParameterTest, combination_all)
150{
151 const unsigned int kObjectSize = 128;
152
153 //get profile
154 char* k = (char*)"4";
155 char* m = (char*)"3";
156 char* c = (char*)"2";
157 int i_k = atoi(k);
158 int i_m = atoi(m);
159 int i_c = atoi(c);
160 const unsigned alignment = i_k * 8 * sizeof(int);
161 const unsigned tail = kObjectSize % alignment;
162 const unsigned padded_length = kObjectSize + (tail ? (alignment - tail) : 0);
163 const unsigned c_size = padded_length / i_k;
164
165 //init
166 ErasureCodeShecTableCache tcache;
167 ErasureCodeShec* shec = new ErasureCodeShecReedSolomonVandermonde(
168 tcache,
169 ErasureCodeShec::MULTIPLE);
170 map < std::string, std::string > *profile = new map<std::string,
171 std::string>();
172 (*profile)["plugin"] = "shec";
173 (*profile)["technique"] = "";
174 (*profile)["crush-failure-domain"] = "osd";
175 (*profile)["k"] = k;
176 (*profile)["m"] = m;
177 (*profile)["c"] = c;
178
179 int result = shec->init(*profile, &cerr);
180
181 //check profile
182 EXPECT_EQ(i_k, shec->k);
183 EXPECT_EQ(i_m, shec->m);
184 EXPECT_EQ(i_c, shec->c);
185 EXPECT_EQ(8, shec->w);
186 EXPECT_EQ(ErasureCodeShec::MULTIPLE, shec->technique);
187 EXPECT_STREQ("default", shec->rule_root.c_str());
188 EXPECT_STREQ("osd", shec->rule_failure_domain.c_str());
189 EXPECT_TRUE(shec->matrix != NULL);
190 EXPECT_EQ(0, result);
191
192 //encode
193 bufferlist in;
194 in.append("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"//length = 62
195 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"//124
196 "0123"//128
197 );
198 set<int> want_to_encode;
199 for (unsigned int i = 0; i < shec->get_chunk_count(); ++i) {
200 want_to_encode.insert(i);
201 }
202
203 map<int, bufferlist> encoded;
204 result = shec->encode(want_to_encode, in, &encoded);
205 EXPECT_EQ(0, result);

Callers

nothing calls this directly

Calls 15

search_table_shec432Function · 0.85
initMethod · 0.45
c_strMethod · 0.45
appendMethod · 0.45
get_chunk_countMethod · 0.45
insertMethod · 0.45
encodeMethod · 0.45
sizeMethod · 0.45
lengthMethod · 0.45
minimum_to_decodeMethod · 0.45
decodeMethod · 0.45
get_chunk_sizeMethod · 0.45

Tested by

no test coverage detected