diff options
author | vchoi-hdfgroup <55293060+vchoi-hdfgroup@users.noreply.github.com> | 2023-03-14 01:36:11 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-14 01:36:11 (GMT) |
commit | e0a981dd3fa3f148ec6ea86aefc7af0df2e9f3c6 (patch) | |
tree | 6e37dfcb82e81f4331202b6f62d9b4185a380953 /test | |
parent | 22751322e346c1f903755cf8c6369bc417f1d42f (diff) | |
download | hdf5-e0a981dd3fa3f148ec6ea86aefc7af0df2e9f3c6.zip hdf5-e0a981dd3fa3f148ec6ea86aefc7af0df2e9f3c6.tar.gz hdf5-e0a981dd3fa3f148ec6ea86aefc7af0df2e9f3c6.tar.bz2 |
Fix up the H5Pencode2 test for virtual layout. (#2325) (#2356)
Diffstat (limited to 'test')
-rw-r--r-- | test/enc_dec_plist.c | 226 |
1 files changed, 111 insertions, 115 deletions
diff --git a/test/enc_dec_plist.c b/test/enc_dec_plist.c index f41d985..077d5e0 100644 --- a/test/enc_dec_plist.c +++ b/test/enc_dec_plist.c @@ -22,13 +22,12 @@ #define SRC_DSET "src_dset" static int -test_encode_decode(hid_t orig_pl, H5F_libver_t low, H5F_libver_t high, hbool_t support_virtual) +test_encode_decode(hid_t orig_pl, H5F_libver_t low, H5F_libver_t high) { hid_t pl = (-1); /* Decoded property list */ hid_t fapl = -1; /* File access property list */ void *temp_buf = NULL; /* Pointer to encoding buffer */ size_t temp_size = 0; /* Size of encoding buffer */ - herr_t ret; /* Return value */ /* Create file access property list */ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) @@ -38,68 +37,58 @@ test_encode_decode(hid_t orig_pl, H5F_libver_t low, H5F_libver_t high, hbool_t s if (H5Pset_libver_bounds(fapl, low, high) < 0) TEST_ERROR - H5E_BEGIN_TRY - { - ret = H5Pencode2(orig_pl, NULL, &temp_size, fapl); - } - H5E_END_TRY; - - if (support_virtual && high < H5F_LIBVER_V110) - VERIFY(ret, FAIL, "H5Pencode2"); - else { + if (H5Pencode2(orig_pl, NULL, &temp_size, fapl) < 0) + TEST_ERROR; - VERIFY(ret, SUCCEED, "H5Pencode2"); + /* Allocate the buffer for encoding */ + if (NULL == (temp_buf = (void *)HDmalloc(temp_size))) + TEST_ERROR; - /* Allocate the buffer for encoding */ - if (NULL == (temp_buf = (void *)HDmalloc(temp_size))) - TEST_ERROR + /* Encode the property list to the buffer */ + if (H5Pencode2(orig_pl, temp_buf, &temp_size, fapl) < 0) + TEST_ERROR; - /* Encode the property list to the buffer */ - if (H5Pencode2(orig_pl, temp_buf, &temp_size, fapl) < 0) - TEST_ERROR + /* Decode the buffer */ + if ((pl = H5Pdecode(temp_buf)) < 0) + STACK_ERROR; - /* Decode the buffer */ - if ((pl = H5Pdecode(temp_buf)) < 0) - STACK_ERROR + /* Check if the original and the decoded property lists are equal */ + if (!H5Pequal(orig_pl, pl)) + PUTS_ERROR("encoding-decoding cycle failed\n"); - /* Check if the original and the decoded property lists are equal */ - if (!H5Pequal(orig_pl, pl)) - PUTS_ERROR("encoding-decoding cycle failed\n") + /* Close the decoded property list */ + if ((H5Pclose(pl)) < 0) + TEST_ERROR; - /* Close the decoded property list */ - if ((H5Pclose(pl)) < 0) - TEST_ERROR - - /* Free the buffer */ - if (temp_buf) - HDfree(temp_buf); + /* Free the buffer */ + if (temp_buf) + HDfree(temp_buf); #ifndef H5_NO_DEPRECATED_SYMBOLS - /* Test H5Pencode1() */ + /* Test H5Pencode1() */ - /* first call to encode returns only the size of the buffer needed */ - if (H5Pencode1(orig_pl, NULL, &temp_size) < 0) - STACK_ERROR + /* first call to encode returns only the size of the buffer needed */ + if (H5Pencode1(orig_pl, NULL, &temp_size) < 0) + STACK_ERROR; - if (NULL == (temp_buf = (void *)HDmalloc(temp_size))) - TEST_ERROR + if (NULL == (temp_buf = (void *)HDmalloc(temp_size))) + TEST_ERROR; - if (H5Pencode1(orig_pl, temp_buf, &temp_size) < 0) - STACK_ERROR + if (H5Pencode1(orig_pl, temp_buf, &temp_size) < 0) + STACK_ERROR; - if ((pl = H5Pdecode(temp_buf)) < 0) - STACK_ERROR + if ((pl = H5Pdecode(temp_buf)) < 0) + STACK_ERROR; - if (!H5Pequal(orig_pl, pl)) - PUTS_ERROR("encoding-decoding cycle failed\n") + if (!H5Pequal(orig_pl, pl)) + PUTS_ERROR("encoding-decoding cycle failed\n"); - if ((H5Pclose(pl)) < 0) - STACK_ERROR + if ((H5Pclose(pl)) < 0) + STACK_ERROR; - if (temp_buf) - HDfree(temp_buf); + if (temp_buf) + HDfree(temp_buf); #endif /* H5_NO_DEPRECATED_SYMBOLS */ - } if ((H5Pclose(fapl)) < 0) TEST_ERROR @@ -211,8 +200,8 @@ main(void) FAIL_STACK_ERROR /* Test encoding & decoding default property list */ - if (test_encode_decode(dcpl, low, high, FALSE) < 0) - FAIL_PUTS_ERROR("Default DCPL encoding/decoding failed\n") + if (test_encode_decode(dcpl, low, high) < 0) + FAIL_PUTS_ERROR("Default DCPL encoding/decoding failed\n"); PASSED(); @@ -241,8 +230,8 @@ main(void) FAIL_STACK_ERROR /* Test encoding & decoding property list */ - if (test_encode_decode(dcpl, low, high, FALSE) < 0) - FAIL_PUTS_ERROR("DCPL encoding/decoding failed\n") + if (test_encode_decode(dcpl, low, high) < 0) + FAIL_PUTS_ERROR("DCPL encoding/decoding failed\n"); /* release resource */ if ((H5Pclose(dcpl)) < 0) @@ -252,31 +241,38 @@ main(void) /******* ENCODE/DECODE DCPLS *****/ TESTING("DCPL Encoding/Decoding for virtual layout"); - if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - FAIL_STACK_ERROR + if (high < H5F_LIBVER_V110) + HDprintf(" SKIPPED: virtual layout not supported yet\n"); - /* Set virtual layout */ - if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) - TEST_ERROR + else { + if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + FAIL_STACK_ERROR; - /* Create source dataspace */ - if ((srcspace = H5Screate_simple(1, dims, NULL)) < 0) - TEST_ERROR + /* Set virtual layout */ + if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) + TEST_ERROR; - /* Create virtual dataspace */ - if ((vspace = H5Screate_simple(1, dims, NULL)) < 0) - TEST_ERROR + /* Create source dataspace */ + if ((srcspace = H5Screate_simple(1, dims, NULL)) < 0) + TEST_ERROR; - /* Add virtual layout mapping */ - if (H5Pset_virtual(dcpl, vspace, SRC_FNAME, SRC_DSET, srcspace) < 0) - TEST_ERROR + /* Create virtual dataspace */ + if ((vspace = H5Screate_simple(1, dims, NULL)) < 0) + TEST_ERROR; - if (test_encode_decode(dcpl, low, high, TRUE) < 0) - FAIL_PUTS_ERROR("DCPL encoding/decoding failed\n") + /* Add virtual layout mapping */ + if (H5Pset_virtual(dcpl, vspace, SRC_FNAME, SRC_DSET, srcspace) < 0) + TEST_ERROR; - /* release resource */ - if ((H5Pclose(dcpl)) < 0) - FAIL_STACK_ERROR + if (test_encode_decode(dcpl, low, high) < 0) + FAIL_PUTS_ERROR("DCPL encoding/decoding failed\n"); + + /* release resource */ + if ((H5Pclose(dcpl)) < 0) + FAIL_STACK_ERROR; + + PASSED(); + } /******* ENCODE/DECODE DAPLS *****/ TESTING("Default DAPL Encoding/Decoding"); @@ -284,8 +280,8 @@ main(void) FAIL_STACK_ERROR /* Test encoding & decoding default property list */ - if (test_encode_decode(dapl, low, high, FALSE) < 0) - FAIL_PUTS_ERROR("Default DAPL encoding/decoding failed\n") + if (test_encode_decode(dapl, low, high) < 0) + FAIL_PUTS_ERROR("Default DAPL encoding/decoding failed\n"); PASSED(); @@ -295,8 +291,8 @@ main(void) FAIL_STACK_ERROR /* Test encoding & decoding property list */ - if (test_encode_decode(dapl, low, high, FALSE) < 0) - FAIL_PUTS_ERROR("DAPL encoding/decoding failed\n") + if (test_encode_decode(dapl, low, high) < 0) + FAIL_PUTS_ERROR("DAPL encoding/decoding failed\n"); /* release resource */ if ((H5Pclose(dapl)) < 0) @@ -310,8 +306,8 @@ main(void) FAIL_STACK_ERROR /* Test encoding & decoding default property list */ - if (test_encode_decode(ocpl, low, high, FALSE) < 0) - FAIL_PUTS_ERROR("Default OCPL encoding/decoding failed\n") + if (test_encode_decode(ocpl, low, high) < 0) + FAIL_PUTS_ERROR("Default OCPL encoding/decoding failed\n"); PASSED(); @@ -327,8 +323,8 @@ main(void) FAIL_STACK_ERROR /* Test encoding & decoding property list */ - if (test_encode_decode(ocpl, low, high, FALSE) < 0) - FAIL_PUTS_ERROR("OCPL encoding/decoding failed\n") + if (test_encode_decode(ocpl, low, high) < 0) + FAIL_PUTS_ERROR("OCPL encoding/decoding failed\n"); /* release resource */ if ((H5Pclose(ocpl)) < 0) @@ -342,8 +338,8 @@ main(void) FAIL_STACK_ERROR /* Test encoding & decoding default property list */ - if (test_encode_decode(dxpl, low, high, FALSE) < 0) - FAIL_PUTS_ERROR("Default DXPL encoding/decoding failed\n") + if (test_encode_decode(dxpl, low, high) < 0) + FAIL_PUTS_ERROR("Default DXPL encoding/decoding failed\n"); PASSED(); @@ -372,8 +368,8 @@ main(void) FAIL_STACK_ERROR /* Test encoding & decoding property list */ - if (test_encode_decode(dxpl, low, high, FALSE) < 0) - FAIL_PUTS_ERROR("DXPL encoding/decoding failed\n") + if (test_encode_decode(dxpl, low, high) < 0) + FAIL_PUTS_ERROR("DXPL encoding/decoding failed\n"); /* release resource */ if ((H5Pclose(dxpl)) < 0) @@ -387,8 +383,8 @@ main(void) FAIL_STACK_ERROR /* Test encoding & decoding default property list */ - if (test_encode_decode(gcpl, low, high, FALSE) < 0) - FAIL_PUTS_ERROR("Default GCPL encoding/decoding failed\n") + if (test_encode_decode(gcpl, low, high) < 0) + FAIL_PUTS_ERROR("Default GCPL encoding/decoding failed\n"); PASSED(); @@ -411,8 +407,8 @@ main(void) FAIL_STACK_ERROR /* Test encoding & decoding property list */ - if (test_encode_decode(gcpl, low, high, FALSE) < 0) - FAIL_PUTS_ERROR("GCPL encoding/decoding failed\n") + if (test_encode_decode(gcpl, low, high) < 0) + FAIL_PUTS_ERROR("GCPL encoding/decoding failed\n"); /* release resource */ if ((H5Pclose(gcpl)) < 0) @@ -426,8 +422,8 @@ main(void) FAIL_STACK_ERROR /* Test encoding & decoding default property list */ - if (test_encode_decode(lcpl, low, high, FALSE) < 0) - FAIL_PUTS_ERROR("Default LCPL encoding/decoding failed\n") + if (test_encode_decode(lcpl, low, high) < 0) + FAIL_PUTS_ERROR("Default LCPL encoding/decoding failed\n"); PASSED(); @@ -437,8 +433,8 @@ main(void) FAIL_STACK_ERROR /* Test encoding & decoding property list */ - if (test_encode_decode(lcpl, low, high, FALSE) < 0) - FAIL_PUTS_ERROR("LCPL encoding/decoding failed\n") + if (test_encode_decode(lcpl, low, high) < 0) + FAIL_PUTS_ERROR("LCPL encoding/decoding failed\n"); /* release resource */ if ((H5Pclose(lcpl)) < 0) @@ -452,8 +448,8 @@ main(void) FAIL_STACK_ERROR /* Test encoding & decoding default property list */ - if (test_encode_decode(lapl, low, high, FALSE) < 0) - FAIL_PUTS_ERROR("Default LAPL encoding/decoding failed\n") + if (test_encode_decode(lapl, low, high) < 0) + FAIL_PUTS_ERROR("Default LAPL encoding/decoding failed\n"); PASSED(); @@ -482,8 +478,8 @@ main(void) FAIL_STACK_ERROR /* Test encoding & decoding property list */ - if (test_encode_decode(lapl, low, high, FALSE) < 0) - FAIL_PUTS_ERROR("LAPL encoding/decoding failed\n") + if (test_encode_decode(lapl, low, high) < 0) + FAIL_PUTS_ERROR("LAPL encoding/decoding failed\n"); /* release resource */ if ((H5Pclose(lapl)) < 0) @@ -497,8 +493,8 @@ main(void) FAIL_STACK_ERROR /* Test encoding & decoding default property list */ - if (test_encode_decode(ocpypl, low, high, FALSE) < 0) - FAIL_PUTS_ERROR("Default OCPYPL encoding/decoding failed\n") + if (test_encode_decode(ocpypl, low, high) < 0) + FAIL_PUTS_ERROR("Default OCPYPL encoding/decoding failed\n"); PASSED(); @@ -513,8 +509,8 @@ main(void) FAIL_STACK_ERROR /* Test encoding & decoding property list */ - if (test_encode_decode(ocpypl, low, high, FALSE) < 0) - FAIL_PUTS_ERROR("OCPYPL encoding/decoding failed\n") + if (test_encode_decode(ocpypl, low, high) < 0) + FAIL_PUTS_ERROR("OCPYPL encoding/decoding failed\n"); /* release resource */ if ((H5Pclose(ocpypl)) < 0) @@ -528,8 +524,8 @@ main(void) FAIL_STACK_ERROR /* Test encoding & decoding default property list */ - if (test_encode_decode(fapl, low, high, FALSE) < 0) - FAIL_PUTS_ERROR("Default FAPL encoding/decoding failed\n") + if (test_encode_decode(fapl, low, high) < 0) + FAIL_PUTS_ERROR("Default FAPL encoding/decoding failed\n"); PASSED(); @@ -563,8 +559,8 @@ main(void) FAIL_STACK_ERROR /* Test encoding & decoding property list */ - if (test_encode_decode(fapl, low, high, FALSE) < 0) - FAIL_PUTS_ERROR("FAPL encoding/decoding failed\n") + if (test_encode_decode(fapl, low, high) < 0) + FAIL_PUTS_ERROR("FAPL encoding/decoding failed\n"); /* release resource */ if ((H5Pclose(fapl)) < 0) @@ -579,8 +575,8 @@ main(void) FAIL_STACK_ERROR /* Test encoding & decoding default property list */ - if (test_encode_decode(fcpl, low, high, FALSE) < 0) - FAIL_PUTS_ERROR("Default FCPL encoding/decoding failed\n") + if (test_encode_decode(fcpl, low, high) < 0) + FAIL_PUTS_ERROR("Default FCPL encoding/decoding failed\n"); PASSED(); @@ -608,8 +604,8 @@ main(void) FAIL_STACK_ERROR /* Test encoding & decoding property list */ - if (test_encode_decode(fcpl, low, high, FALSE) < 0) - FAIL_PUTS_ERROR("FCPL encoding/decoding failed\n") + if (test_encode_decode(fcpl, low, high) < 0) + FAIL_PUTS_ERROR("FCPL encoding/decoding failed\n"); /* release resource */ if ((H5Pclose(fcpl)) < 0) @@ -624,8 +620,8 @@ main(void) FAIL_STACK_ERROR /* Test encoding & decoding default property list */ - if (test_encode_decode(strcpl, low, high, FALSE) < 0) - FAIL_PUTS_ERROR("Default STRCPL encoding/decoding failed\n") + if (test_encode_decode(strcpl, low, high) < 0) + FAIL_PUTS_ERROR("Default STRCPL encoding/decoding failed\n"); PASSED(); @@ -635,8 +631,8 @@ main(void) FAIL_STACK_ERROR /* Test encoding & decoding property list */ - if (test_encode_decode(strcpl, low, high, FALSE) < 0) - FAIL_PUTS_ERROR("STRCPL encoding/decoding failed\n") + if (test_encode_decode(strcpl, low, high) < 0) + FAIL_PUTS_ERROR("STRCPL encoding/decoding failed\n"); /* release resource */ if ((H5Pclose(strcpl)) < 0) @@ -651,8 +647,8 @@ main(void) FAIL_STACK_ERROR /* Test encoding & decoding default property list */ - if (test_encode_decode(acpl, low, high, FALSE) < 0) - FAIL_PUTS_ERROR("Default ACPL encoding/decoding failed\n") + if (test_encode_decode(acpl, low, high) < 0) + FAIL_PUTS_ERROR("Default ACPL encoding/decoding failed\n"); PASSED(); @@ -662,8 +658,8 @@ main(void) FAIL_STACK_ERROR /* Test encoding & decoding property list */ - if (test_encode_decode(acpl, low, high, FALSE) < 0) - FAIL_PUTS_ERROR("ACPL encoding/decoding failed\n") + if (test_encode_decode(acpl, low, high) < 0) + FAIL_PUTS_ERROR("ACPL encoding/decoding failed\n"); /* release resource */ if ((H5Pclose(acpl)) < 0) |