summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorKota Tsuyuzaki <bloodeagle40234@gmail.com>2015-04-19 21:28:02 -0700
committerKota Tsuyuzaki <bloodeagle40234@gmail.com>2015-04-19 21:38:44 -0700
commitc68881cef6eb1a7d3dc7d637ff956ede5dc8450e (patch)
treeefc58bacd6348a01c9185c1b2f32d7af5e8305a4 /test
parenta380246762c16ea8eb7dbfccd50d296c3743b39e (diff)
downloadliberasurecode-fix-decode.tar.gz
Fix decode only with paritiesfix-decode
When decoding only with parities (e.g. k=10, m=10 and decode with 10 parity fragments and no data fragments), current liberasurecode will give up to decode with a failure because liberasurecode retrieves original content length and payload size only from a "DATA" fragment. This patch allows liberasurecode to retrieve also a parity fragment (if the available fragments consist of only parity fragments) and then fixes the bug. Note that this failure happens only when the number of parity fragments equals to or more than the number of data fragments. (i.e. m >= k)
Diffstat (limited to 'test')
-rw-r--r--test/liberasurecode_test.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/liberasurecode_test.c b/test/liberasurecode_test.c
index 6291be5..602e0dc 100644
--- a/test/liberasurecode_test.c
+++ b/test/liberasurecode_test.c
@@ -1123,6 +1123,26 @@ static void test_decode_with_missing_multi_data_parity(
}
}
+static void test_decode_only_with_parities(
+ const ec_backend_id_t be_id, struct ec_args *args)
+{
+
+ struct ec_args double_parity_args = {
+ .k = 10,
+ .m = 10,
+ };
+
+ int i;
+ int *skip = create_skips_array(&double_parity_args, -1);
+ assert(skip != NULL);
+ for (i = 0; i < 10; i++) {
+ skip[i]=1;
+ }
+ encode_decode_test_impl(be_id, &double_parity_args, skip);
+ free(skip);
+}
+
+
static void test_simple_encode_decode(const ec_backend_id_t be_id,
struct ec_args *args)
{
@@ -1435,6 +1455,10 @@ struct testcase testcases[] = {
test_decode_with_missing_multi_data_parity,
EC_BACKEND_JERASURE_RS_VAND, CHKSUM_NONE,
.skip = false},
+ {"test_decode_only_with_parities_jerasure_rs_vand",
+ test_decode_only_with_parities,
+ EC_BACKEND_JERASURE_RS_VAND, CHKSUM_NONE,
+ .skip = false},
{"simple_reconstruct_jerasure_rs_vand",
test_simple_reconstruct,
EC_BACKEND_JERASURE_RS_VAND, CHKSUM_NONE,
@@ -1496,6 +1520,11 @@ struct testcase testcases[] = {
test_decode_with_missing_multi_data_parity,
EC_BACKEND_JERASURE_RS_CAUCHY, CHKSUM_NONE,
.skip = false},
+ // FIXME: something wrong on rs_cauchy
+ // {"test_decode_only_with_parities_jerasure_rs_cauchy",
+ // test_decode_only_with_parities,
+ // EC_BACKEND_JERASURE_RS_CAUCHY, CHKSUM_NONE,
+ // .skip = false},
{"simple_reconstruct_jerasure_rs_cauchy",
test_simple_reconstruct,
EC_BACKEND_JERASURE_RS_CAUCHY, CHKSUM_NONE,
@@ -1557,6 +1586,10 @@ struct testcase testcases[] = {
test_decode_with_missing_multi_data_parity,
EC_BACKEND_ISA_L_RS_VAND, CHKSUM_NONE,
.skip = false},
+ {"test_decode_only_with_parities_isa_l",
+ test_decode_only_with_parities,
+ EC_BACKEND_ISA_L_RS_VAND, CHKSUM_NONE,
+ .skip = false},
{"simple_reconstruct_isa_l",
test_simple_reconstruct,
EC_BACKEND_ISA_L_RS_VAND, CHKSUM_NONE,
@@ -1614,6 +1647,10 @@ struct testcase testcases[] = {
test_decode_with_missing_multi_data_parity,
EC_BACKEND_SHSS, CHKSUM_NONE,
.skip = false},
+ {"test_decode_only_with_parities_shss",
+ test_decode_only_with_parities,
+ EC_BACKEND_SHSS, CHKSUM_NONE,
+ .skip = false},
{"simple_reconstruct_shss",
test_simple_reconstruct,
EC_BACKEND_SHSS, CHKSUM_NONE,