Enable API tests by default and fix some issues (#5223)

* Enable API tests by default

* Fix leaked file handle in API link test

* Fix some versioned API misuses
This commit is contained in:
jhendersonHDF 2025-01-10 11:08:02 -06:00 committed by GitHub
parent 5d3261910d
commit 2d0c676642
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 24 additions and 20 deletions

View File

@ -26,7 +26,7 @@
option (HDF5_DISABLE_TESTS_REGEX "Regex pattern to set execution of specific tests to DISABLED" "")
mark_as_advanced (HDF5_DISABLE_TESTS_REGEX)
option (HDF5_TEST_API "Execute HDF5 API tests" OFF)
option (HDF5_TEST_API "Execute HDF5 API tests" ON)
mark_as_advanced (HDF5_TEST_API)
if (HDF5_TEST_API)
option (HDF5_TEST_API_INSTALL "Install HDF5 API tests" OFF)

View File

@ -8641,15 +8641,15 @@ test_attribute_string_encodings(void H5_ATTR_UNUSED *params)
goto error;
}
if ((dset_id1 = H5Dcreate(container_group, ATTRIBUTE_STRING_ENCODINGS_DSET_NAME1, type_id1, space_id,
H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
if ((dset_id1 = H5Dcreate2(container_group, ATTRIBUTE_STRING_ENCODINGS_DSET_NAME1, type_id1, space_id,
H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
H5_FAILED();
printf(" couldn't create dataset with ascii string\n");
goto error;
}
if ((attr_id1 = H5Acreate(dset_id1, ATTRIBUTE_STRING_ENCODINGS_ATTR_NAME1, type_id1, space_id,
H5P_DEFAULT, H5P_DEFAULT)) < 0) {
if ((attr_id1 = H5Acreate2(dset_id1, ATTRIBUTE_STRING_ENCODINGS_ATTR_NAME1, type_id1, space_id,
H5P_DEFAULT, H5P_DEFAULT)) < 0) {
H5_FAILED();
printf(" couldn't create attribute with ascii string\n");
goto error;
@ -8673,15 +8673,15 @@ test_attribute_string_encodings(void H5_ATTR_UNUSED *params)
goto error;
}
if ((dset_id2 = H5Dcreate(container_group, ATTRIBUTE_STRING_ENCODINGS_DSET_NAME2, type_id2, space_id,
H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
if ((dset_id2 = H5Dcreate2(container_group, ATTRIBUTE_STRING_ENCODINGS_DSET_NAME2, type_id2, space_id,
H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
H5_FAILED();
printf(" couldn't create dataset with UTF-8 string\n");
goto error;
}
if ((attr_id2 = H5Acreate(dset_id2, ATTRIBUTE_STRING_ENCODINGS_ATTR_NAME2, type_id2, space_id,
H5P_DEFAULT, H5P_DEFAULT)) < 0) {
if ((attr_id2 = H5Acreate2(dset_id2, ATTRIBUTE_STRING_ENCODINGS_ATTR_NAME2, type_id2, space_id,
H5P_DEFAULT, H5P_DEFAULT)) < 0) {
H5_FAILED();
printf(" couldn't create attribute with ascii string\n");
goto error;

View File

@ -2385,9 +2385,9 @@ test_create_dataset_creation_properties(void H5_ATTR_UNUSED *params)
PART_ERROR(DCPL_fill_value_test);
}
if ((dset_id =
H5Dcreate(group_id, DATASET_FILL_VALUE_TEST_DSET_NAME1, DATASET_FILL_VALUE_TEST_INT_TYPE,
fspace_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) {
if ((dset_id = H5Dcreate2(group_id, DATASET_FILL_VALUE_TEST_DSET_NAME1,
DATASET_FILL_VALUE_TEST_INT_TYPE, fspace_id, H5P_DEFAULT, dcpl_id,
H5P_DEFAULT)) < 0) {
H5_FAILED();
printf(" couldn't create dataset with integer fill value");
PART_ERROR(DCPL_fill_value_test);
@ -8218,8 +8218,8 @@ test_dataset_string_encodings(void H5_ATTR_UNUSED *params)
goto error;
}
if ((dset_id1 = H5Dcreate(container_group, DATASET_STRING_ENCODINGS_DSET_NAME1, type_id1, space_id,
H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
if ((dset_id1 = H5Dcreate2(container_group, DATASET_STRING_ENCODINGS_DSET_NAME1, type_id1, space_id,
H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
H5_FAILED();
printf(" couldn't create dataset with ascii string\n");
goto error;
@ -8243,8 +8243,8 @@ test_dataset_string_encodings(void H5_ATTR_UNUSED *params)
goto error;
}
if ((dset_id2 = H5Dcreate(container_group, DATASET_STRING_ENCODINGS_DSET_NAME2, type_id2, space_id,
H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
if ((dset_id2 = H5Dcreate2(container_group, DATASET_STRING_ENCODINGS_DSET_NAME2, type_id2, space_id,
H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
H5_FAILED();
printf(" couldn't create dataset with UTF-8 string\n");
goto error;

View File

@ -897,6 +897,12 @@ test_create_hard_link_invalid_params(void H5_ATTR_UNUSED *params)
PART_ERROR(H5Lcreate_hard_across_files);
}
if (H5Fclose(ext_file_id) < 0) {
H5_FAILED();
printf(" couldn't close external file '%s'\n", ext_link_filename);
PART_ERROR(H5Lcreate_hard_across_files);
}
if (remove_test_file(NULL, ext_link_filename) < 0) {
H5_FAILED();
printf(" failed to delete external file '%s'\n", ext_link_filename);
@ -934,8 +940,6 @@ test_create_hard_link_invalid_params(void H5_ATTR_UNUSED *params)
TESTING_2("test cleanup");
if (H5Fclose(ext_file_id) < 0)
TEST_ERROR;
if (H5Gclose(group_id) < 0)
TEST_ERROR;
if (H5Gclose(container_group) < 0)

View File

@ -5638,8 +5638,8 @@ test_object_visit(void H5_ATTR_UNUSED *params)
i = 0;
if (H5Ovisit_by_name(attr_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, object_visit_simple_callback,
&i, H5O_INFO_ALL, H5P_DEFAULT) < 0) {
if (H5Ovisit_by_name3(attr_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, object_visit_simple_callback,
&i, H5O_INFO_ALL, H5P_DEFAULT) < 0) {
H5_FAILED();
printf(" H5Ovisit_by_name on an attribute failed!\n");
PART_ERROR(H5Ovisit_by_name_attr);