diff --git a/test/API/H5_api_dataset_test.c b/test/API/H5_api_dataset_test.c index 4110dd714de..768ba490130 100644 --- a/test/API/H5_api_dataset_test.c +++ b/test/API/H5_api_dataset_test.c @@ -9805,27 +9805,49 @@ test_dataset_vlen_io(void) goto error; } - if ((dset_int = H5Dcreate2(file_id, DATASET_VLEN_IO_DSET_NAME "_int", vlen_int, space_id, H5P_DEFAULT, - H5P_DEFAULT, H5P_DEFAULT)) < 0) { + if ((dset_int = H5Dcreate2(container_group, DATASET_VLEN_IO_DSET_NAME "_int", vlen_int, space_id, + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); printf(" couldn't create dataset with vlen integer sequence datatype"); goto error; } - if ((dset_float = H5Dcreate2(file_id, DATASET_VLEN_IO_DSET_NAME "_float", vlen_float, space_id, + if ((dset_float = H5Dcreate2(container_group, DATASET_VLEN_IO_DSET_NAME "_float", vlen_float, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); printf(" couldn't create dataset with vlen float sequence datatype"); goto error; } - if ((dset_string = H5Dcreate2(file_id, DATASET_VLEN_IO_DSET_NAME "_string", vlen_string, space_id, + if ((dset_string = H5Dcreate2(container_group, DATASET_VLEN_IO_DSET_NAME "_string", vlen_string, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); printf(" couldn't create dataset with vlen string sequence datatype"); goto error; } + /* Close datasets until individual tests */ + if (H5Dclose(dset_int) < 0) { + H5_FAILED(); + printf(" couldn't close dataset with vlen integer sequence datatype"); + } + + dset_int = H5I_INVALID_HID; + + if (H5Dclose(dset_float) < 0) { + H5_FAILED(); + printf(" couldn't close dataset with vlen float sequence datatype"); + } + + dset_float = H5I_INVALID_HID; + + if (H5Dclose(dset_string) < 0) { + H5_FAILED(); + printf(" couldn't close dataset with vlen string sequence datatype"); + } + + dset_string = H5I_INVALID_HID; + memset(wbuf, 0, sizeof(hvl_t) * DATASET_VLEN_IO_DSET_DIMS); memset(rbuf, 0, sizeof(hvl_t) * DATASET_VLEN_IO_DSET_DIMS); @@ -9848,10 +9870,39 @@ test_dataset_vlen_io(void) wbuf[i].len = i + 1; } + /* Open dataset */ + if ((dset_int = H5Dopen2(container_group, DATASET_VLEN_IO_DSET_NAME "_int", H5P_DEFAULT)) < 0) + PART_TEST_ERROR(rw_all_int); + /* Perform write */ if ((H5Dwrite(dset_int, vlen_int, space_id, H5S_ALL, H5P_DEFAULT, (const void *)wbuf)) < 0) PART_TEST_ERROR(rw_all_int); + /* Close and reopen file objects to flush cache */ + if (H5Dclose(dset_int) < 0) + PART_TEST_ERROR(rw_all_int); + + dset_int = H5I_INVALID_HID; + + if (H5Gclose(container_group) < 0) + PART_TEST_ERROR(rw_all_int); + + container_group = H5I_INVALID_HID; + + if (H5Fclose(file_id) < 0) + PART_TEST_ERROR(rw_all_int); + + file_id = H5I_INVALID_HID; + + if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) + PART_TEST_ERROR(rw_all_int); + + if ((container_group = H5Gopen(file_id, DATASET_TEST_GROUP_NAME, H5P_DEFAULT)) < 0) + PART_TEST_ERROR(rw_all_int); + + if ((dset_int = H5Dopen2(container_group, DATASET_VLEN_IO_DSET_NAME "_int", H5P_DEFAULT)) < 0) + PART_TEST_ERROR(rw_all_int); + /* Perform read */ if ((H5Dread(dset_int, vlen_int, space_id, H5S_ALL, H5P_DEFAULT, (void *)rbuf)) < 0) PART_TEST_ERROR(rw_all_int); @@ -9869,10 +9920,13 @@ test_dataset_vlen_io(void) PART_TEST_ERROR(rw_all_int); } - PASSED(); + /* Close before use in selection tests */ + if (H5Dclose(dset_int) < 0) + PART_TEST_ERROR(rw_all_int); - /* Reset buffers */ + dset_int = H5I_INVALID_HID; + /* Reset buffers */ if (H5Treclaim(vlen_int, space_id, H5P_DEFAULT, rbuf) < 0) PART_TEST_ERROR(rw_all_int); @@ -9881,8 +9935,11 @@ test_dataset_vlen_io(void) memset(wbuf, 0, sizeof(hvl_t) * DATASET_VLEN_IO_DSET_DIMS); memset(rbuf, 0, sizeof(hvl_t) * DATASET_VLEN_IO_DSET_DIMS); + + PASSED(); } PART_END(rw_all_int) + PART_BEGIN(rw_all_float) { TESTING_2("write and read entire dataspace with float sequence"); /* Set up write buffer */ @@ -9897,10 +9954,39 @@ test_dataset_vlen_io(void) wbuf[i].len = i + 1; } + /* Open dataset */ + if ((dset_float = H5Dopen2(container_group, DATASET_VLEN_IO_DSET_NAME "_float", H5P_DEFAULT)) < 0) + PART_TEST_ERROR(rw_all_float); + /* Perform write */ if ((H5Dwrite(dset_float, vlen_float, space_id, H5S_ALL, H5P_DEFAULT, (const void *)wbuf)) < 0) PART_TEST_ERROR(rw_all_float); + /* Close and reopen file objects to flush cache */ + if (H5Dclose(dset_float) < 0) + PART_TEST_ERROR(rw_all_float); + + dset_float = H5I_INVALID_HID; + + if (H5Gclose(container_group) < 0) + PART_TEST_ERROR(rw_all_float); + + container_group = H5I_INVALID_HID; + + if (H5Fclose(file_id) < 0) + PART_TEST_ERROR(rw_all_float); + + file_id = H5I_INVALID_HID; + + if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) + PART_TEST_ERROR(rw_all_float); + + if ((container_group = H5Gopen2(file_id, DATASET_TEST_GROUP_NAME, H5P_DEFAULT)) < 0) + PART_TEST_ERROR(rw_all_float); + + if ((dset_float = H5Dopen2(container_group, DATASET_VLEN_IO_DSET_NAME "_float", H5P_DEFAULT)) < 0) + PART_TEST_ERROR(rw_all_float); + /* Perform read */ if ((H5Dread(dset_float, vlen_float, space_id, H5S_ALL, H5P_DEFAULT, (void *)rbuf)) < 0) PART_TEST_ERROR(rw_all_float); @@ -9922,8 +10008,6 @@ test_dataset_vlen_io(void) } } - PASSED(); - /* Reset buffers */ if (H5Treclaim(vlen_float, space_id, H5P_DEFAULT, rbuf) < 0) @@ -9934,7 +10018,8 @@ test_dataset_vlen_io(void) memset(wbuf, 0, sizeof(hvl_t) * DATASET_VLEN_IO_DSET_DIMS); memset(rbuf, 0, sizeof(hvl_t) * DATASET_VLEN_IO_DSET_DIMS); - PART_BEGIN(rw_all_float) + + PASSED(); } PART_END(rw_all_float); @@ -9954,10 +10039,41 @@ test_dataset_vlen_io(void) wbuf[i].len = i + 1; } + /* Open the dataset */ + if ((dset_string = H5Dopen2(container_group, DATASET_VLEN_IO_DSET_NAME "_string", H5P_DEFAULT)) < + 0) + PART_TEST_ERROR(rw_all_string); + /* Perform write */ if ((H5Dwrite(dset_string, vlen_string, space_id, H5S_ALL, H5P_DEFAULT, (const void *)wbuf)) < 0) PART_TEST_ERROR(rw_all_string); + /* Close and reopen file objects to flush cache */ + if (H5Dclose(dset_string) < 0) + PART_TEST_ERROR(rw_all_string); + + dset_string = H5I_INVALID_HID; + + if (H5Gclose(container_group) < 0) + PART_TEST_ERROR(rw_all_string); + + container_group = H5I_INVALID_HID; + + if (H5Fclose(file_id) < 0) + PART_TEST_ERROR(rw_all_string); + + file_id = H5I_INVALID_HID; + + if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) + PART_TEST_ERROR(rw_all_string); + + if ((container_group = H5Gopen2(file_id, DATASET_TEST_GROUP_NAME, H5P_DEFAULT)) < 0) + PART_TEST_ERROR(rw_all_string); + + if ((dset_string = H5Dopen2(container_group, DATASET_VLEN_IO_DSET_NAME "_string", H5P_DEFAULT)) < + 0) + PART_TEST_ERROR(rw_all_string); + /* Perform read */ if ((H5Dread(dset_string, vlen_string, space_id, H5S_ALL, H5P_DEFAULT, (void *)rbuf)) < 0) PART_TEST_ERROR(rw_all_string); @@ -9981,8 +10097,6 @@ test_dataset_vlen_io(void) } } - PASSED(); - /* Reset buffers */ if (H5Treclaim(vlen_string, space_id, H5P_DEFAULT, rbuf) < 0) @@ -9993,6 +10107,8 @@ test_dataset_vlen_io(void) memset(wbuf, 0, sizeof(hvl_t) * DATASET_VLEN_IO_DSET_DIMS); memset(rbuf, 0, sizeof(hvl_t) * DATASET_VLEN_IO_DSET_DIMS); + + PASSED(); } PART_END(rw_all_string); @@ -10019,10 +10135,36 @@ test_dataset_vlen_io(void) wbuf[i].len = i + 1; } + /* Open dataset */ + if ((dset_int = H5Dopen2(container_group, DATASET_VLEN_IO_DSET_NAME "_int", H5P_DEFAULT)) < 0) + PART_TEST_ERROR(rw_point_selection); + /* Perform write */ if ((H5Dwrite(dset_int, vlen_int, space_id, space_id, H5P_DEFAULT, (const void *)wbuf)) < 0) PART_TEST_ERROR(rw_point_selection); + /* Close and reopen file objects to flush cache */ + if (H5Dclose(dset_int) < 0) + PART_TEST_ERROR(rw_point_selection); + dset_int = H5I_INVALID_HID; + + if (H5Gclose(container_group) < 0) + PART_TEST_ERROR(rw_point_selection); + container_group = H5I_INVALID_HID; + + if (H5Fclose(file_id) < 0) + PART_TEST_ERROR(rw_point_selection); + file_id = H5I_INVALID_HID; + + if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) + PART_TEST_ERROR(rw_point_selection); + + if ((container_group = H5Gopen2(file_id, DATASET_TEST_GROUP_NAME, H5P_DEFAULT)) < 0) + PART_TEST_ERROR(rw_point_selection); + + if ((dset_int = H5Dopen2(container_group, DATASET_VLEN_IO_DSET_NAME "_int", H5P_DEFAULT)) < 0) + PART_TEST_ERROR(rw_point_selection); + /* Perform read */ if ((H5Dread(dset_int, vlen_int, space_id, space_id, H5P_DEFAULT, (void *)rbuf)) < 0) PART_TEST_ERROR(rw_point_selection); @@ -10049,10 +10191,11 @@ test_dataset_vlen_io(void) } } - PASSED(); + if (H5Dclose(dset_int) < 0) + PART_TEST_ERROR(rw_point_selection); + dset_int = H5I_INVALID_HID; /* Reset buffers */ - if (H5Treclaim(vlen_int, space_id, H5P_DEFAULT, rbuf) < 0) PART_TEST_ERROR(rw_point_selection); @@ -10061,6 +10204,8 @@ test_dataset_vlen_io(void) memset(wbuf, 0, sizeof(hvl_t) * DATASET_VLEN_IO_DSET_DIMS); memset(rbuf, 0, sizeof(hvl_t) * DATASET_VLEN_IO_DSET_DIMS); + + PASSED(); } PART_END(rw_point_selection); @@ -10087,10 +10232,36 @@ test_dataset_vlen_io(void) wbuf[i].len = i + 1; } + /* Open dataset */ + if ((dset_int = H5Dopen2(container_group, DATASET_VLEN_IO_DSET_NAME "_int", H5P_DEFAULT)) < 0) + PART_TEST_ERROR(rw_hyperslab_selection); + /* Perform write */ if ((H5Dwrite(dset_int, vlen_int, space_id, space_id, H5P_DEFAULT, (const void *)wbuf)) < 0) PART_TEST_ERROR(rw_hyperslab_selection); + /* Close and reopen file objects to flush cache */ + if (H5Dclose(dset_int) < 0) + PART_TEST_ERROR(rw_hyperslab_selection); + dset_int = H5I_INVALID_HID; + + if (H5Gclose(container_group) < 0) + PART_TEST_ERROR(rw_hyperslab_selection); + container_group = H5I_INVALID_HID; + + if (H5Fclose(file_id) < 0) + PART_TEST_ERROR(rw_hyperslab_selection); + file_id = H5I_INVALID_HID; + + if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) + PART_TEST_ERROR(rw_hyperslab_selection); + + if ((container_group = H5Gopen2(file_id, DATASET_TEST_GROUP_NAME, H5P_DEFAULT)) < 0) + PART_TEST_ERROR(rw_hyperslab_selection); + + if ((dset_int = H5Dopen2(container_group, DATASET_VLEN_IO_DSET_NAME "_int", H5P_DEFAULT)) < 0) + PART_TEST_ERROR(rw_hyperslab_selection); + /* Perform read */ if ((H5Dread(dset_int, vlen_int, space_id, space_id, H5P_DEFAULT, (void *)rbuf)) < 0) PART_TEST_ERROR(rw_hyperslab_selection); @@ -10117,10 +10288,7 @@ test_dataset_vlen_io(void) } } - PASSED(); - /* Reset buffers */ - if (H5Treclaim(vlen_int, space_id, H5P_DEFAULT, rbuf) < 0) PART_TEST_ERROR(rw_hyperslab_selection); @@ -10129,6 +10297,8 @@ test_dataset_vlen_io(void) memset(wbuf, 0, sizeof(hvl_t) * DATASET_VLEN_IO_DSET_DIMS); memset(rbuf, 0, sizeof(hvl_t) * DATASET_VLEN_IO_DSET_DIMS); + + PASSED(); } PART_END(rw_hyperslab_selection); }