summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTushar Gohad <tushar.gohad@intel.com>2015-01-30 18:28:42 -0700
committerTushar Gohad <tushar.gohad@intel.com>2015-01-30 18:42:04 -0700
commitff5dd3901748c5419ba3cfd328ebcfb2503be4d1 (patch)
treed547e8a2ddee1d6b13e510c2151c61edd84dc625 /test
parent09efa2dd8402ecf8a783e6b34bd6b8f667ee3298 (diff)
downloadliberasurecode-ff5dd3901748c5419ba3cfd328ebcfb2503be4d1.tar.gz
Add optional fragment metadata check for decode
Signed-off-by: Tushar Gohad <tushar.gohad@intel.com>
Diffstat (limited to 'test')
-rw-r--r--test/libec_slap.c8
-rw-r--r--test/liberasurecode_test.c22
2 files changed, 15 insertions, 15 deletions
diff --git a/test/libec_slap.c b/test/libec_slap.c
index f3166fe..0f3c24b 100644
--- a/test/libec_slap.c
+++ b/test/libec_slap.c
@@ -283,8 +283,8 @@ static int test_hd_code(struct ec_args *args,
create_frags_array_set(&frags,encoded_data, args->k, encoded_parity,
args->m, mask);
rc = liberasurecode_decode(desc, frags.array, frags.num_fragments,
- encoded_fragment_len, &out_data,
- &out_data_len);
+ encoded_fragment_len, 1,
+ &out_data, &out_data_len);
assert(rc == 0);
assert(out_data_len == blocksize * args->k);
if (memcmp(data, out_data, out_data_len) != 0) {
@@ -308,8 +308,8 @@ static int test_hd_code(struct ec_args *args,
create_frags_array_set(&frags,encoded_data, args->k, encoded_parity,
args->m, mask);
rc = liberasurecode_decode(desc, frags.array, frags.num_fragments,
- encoded_fragment_len, &out_data,
- &out_data_len);
+ encoded_fragment_len, 1,
+ &out_data, &out_data_len);
free(frags.array);
free(out_data);
diff --git a/test/liberasurecode_test.c b/test/liberasurecode_test.c
index 49b70c6..b3c17df 100644
--- a/test/liberasurecode_test.c
+++ b/test/liberasurecode_test.c
@@ -346,23 +346,23 @@ static void test_decode_invalid_args()
encoded_parity, &null_args, skips);
rc = liberasurecode_decode(-1, avail_frags, num_avail_frags,
- encoded_fragment_len, &decoded_data,
- &decoded_data_len);
+ encoded_fragment_len, 1,
+ &decoded_data, &decoded_data_len);
assert(rc < 0);
rc = liberasurecode_decode(desc, NULL, num_avail_frags,
- encoded_fragment_len, &decoded_data,
- &decoded_data_len);
+ encoded_fragment_len, 1,
+ &decoded_data, &decoded_data_len);
assert(rc < 0);
rc = liberasurecode_decode(desc, avail_frags, num_avail_frags,
- encoded_fragment_len, NULL,
- &decoded_data_len);
+ encoded_fragment_len, 1,
+ NULL, &decoded_data_len);
assert(rc < 0);
rc = liberasurecode_decode(desc, avail_frags, num_avail_frags,
- encoded_fragment_len, &decoded_data,
- NULL);
+ encoded_fragment_len, 1,
+ &decoded_data, NULL);
assert(rc < 0);
free(skips);
liberasurecode_encode_cleanup(desc, encoded_data, encoded_parity);
@@ -540,8 +540,8 @@ static void encode_decode_test_impl(const ec_backend_id_t be_id,
assert(num_avail_frags != -1);
rc = liberasurecode_decode(desc, avail_frags, num_avail_frags,
- encoded_fragment_len, &decoded_data,
- &decoded_data_len);
+ encoded_fragment_len, 1,
+ &decoded_data, &decoded_data_len);
assert(0 == rc);
assert(decoded_data_len == orig_data_size);
assert(memcmp(decoded_data, orig_data, orig_data_size) == 0);
@@ -1002,7 +1002,7 @@ static void verify_fragment_metadata_mismatch_impl(const ec_backend_id_t be_id,
default:
assert(false);
}
- rc = is_valid_fragment(desc, avail_frags[i]);
+ rc = is_invalid_fragment(desc, avail_frags[i]);
assert(rc == 1);
//heal fragment
switch (scenario) {