| 146 | } |
| 147 | |
| 148 | IGNORE_DEPRECATED |
| 149 | TEST(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); |
nothing calls this directly
no test coverage detected