From 14ed93e749d1b12acc9a43ba41911a8475366f60 Mon Sep 17 00:00:00 2001 From: Glenn Song <43005495+glennsong09@users.noreply.github.com> Date: Wed, 14 Feb 2024 07:37:18 -0600 Subject: [PATCH 1/8] Update install texts (#4010) * Update INSTALL_CMake.txt as necessary * Update remaining docs that use HDF5_USE_GNU_DIRS * Update options in HDFMacros in HDF5Examples --- HDF5Examples/config/cmake/HDFMacros.cmake | 8 ++++---- config/cmake/HDF5ExampleCache.cmake | 2 +- config/cmake/HDF5PluginCache.cmake | 2 +- config/cmake/HDFMacros.cmake | 8 ++++---- release_docs/{INSTALL => INSTALL_Auto.txt} | 8 -------- release_docs/INSTALL_CMake.txt | 22 ++++++++++++---------- 6 files changed, 22 insertions(+), 28 deletions(-) rename release_docs/{INSTALL => INSTALL_Auto.txt} (98%) diff --git a/HDF5Examples/config/cmake/HDFMacros.cmake b/HDF5Examples/config/cmake/HDFMacros.cmake index 66a25aab83f..59efbfb3ca4 100644 --- a/HDF5Examples/config/cmake/HDFMacros.cmake +++ b/HDF5Examples/config/cmake/HDFMacros.cmake @@ -90,7 +90,7 @@ macro (HDFTEST_COPY_FILE src dest target) endmacro () macro (HDF_DIR_PATHS package_prefix) - option (H5EX_USE_GNU_DIRS "TRUE to use GNU Coding Standard install directory variables, FALSE to use historical settings" FALSE) + option (H5EX_USE_GNU_DIRS "ON to use GNU Coding Standard install directory variables, OFF to use historical settings" OFF) if (H5EX_USE_GNU_DIRS) include(GNUInstallDirs) if (NOT ${package_prefix}_INSTALL_BIN_DIR) @@ -121,7 +121,7 @@ macro (HDF_DIR_PATHS package_prefix) endif () if (APPLE) - option (${package_prefix}_BUILD_FRAMEWORKS "TRUE to build as frameworks libraries, FALSE to build according to BUILD_SHARED_LIBS" FALSE) + option (${package_prefix}_BUILD_FRAMEWORKS "ON to build as frameworks libraries, OFF to build according to BUILD_SHARED_LIBS" OFF) endif () if (NOT ${package_prefix}_INSTALL_BIN_DIR) @@ -170,10 +170,10 @@ macro (HDF_DIR_PATHS package_prefix) message(STATUS "Final: ${${package_prefix}_INSTALL_DOC_DIR}") # Always use full RPATH, i.e. don't skip the full RPATH for the build tree - set (CMAKE_SKIP_BUILD_RPATH FALSE) + set (CMAKE_SKIP_BUILD_RPATH OFF) # when building, don't use the install RPATH already # (but later on when installing) - set (CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE) + set (CMAKE_INSTALL_RPATH_USE_LINK_PATH OFF) # add the automatically determined parts of the RPATH # which point to directories outside the build tree to the install RPATH set (CMAKE_BUILD_WITH_INSTALL_RPATH ON) diff --git a/config/cmake/HDF5ExampleCache.cmake b/config/cmake/HDF5ExampleCache.cmake index 6ac9cc06e40..7c3bf138e4f 100644 --- a/config/cmake/HDF5ExampleCache.cmake +++ b/config/cmake/HDF5ExampleCache.cmake @@ -14,7 +14,7 @@ set (HDF_BUILD_CPP_LIB ${HDF5_BUILD_CPP_LIB} CACHE BOOL "Build HDF5 C++ Library" set (HDF_BUILD_HL_LIB ${HDF5_BUILD_HL_LIB} CACHE BOOL "Build HIGH Level examples" FORCE) set (HDF_ENABLE_THREADSAFE ${HDF5_ENABLE_THREADSAFE} CACHE BOOL "Enable examples thread-safety" FORCE) set (HDF_ENABLE_PARALLEL ${HDF5_ENABLE_PARALLEL} CACHE BOOL "Enable examples parallel build (requires MPI)" FORCE) -set (H5EX_USE_GNU_DIRS ${HDF5_USE_GNU_DIRS} CACHE BOOL "TRUE to use GNU Coding Standard install directory variables, FALSE to use historical settings" FORCE) +set (H5EX_USE_GNU_DIRS ${HDF5_USE_GNU_DIRS} CACHE BOOL "ON to use GNU Coding Standard install directory variables, OFF to use historical settings" FORCE) #preset HDF5 cache vars to this projects libraries instead of searching set (H5EX_HDF5_HEADER "H5pubconf.h" CACHE STRING "Name of HDF5 header" FORCE) diff --git a/config/cmake/HDF5PluginCache.cmake b/config/cmake/HDF5PluginCache.cmake index d299d9fd1a0..7cdaf02624e 100644 --- a/config/cmake/HDF5PluginCache.cmake +++ b/config/cmake/HDF5PluginCache.cmake @@ -39,4 +39,4 @@ set (H5PL_TGZ_NAME "${PLUGIN_TGZ_NAME}" CACHE STRING "Use plugins from compresse set (PL_PACKAGE_NAME "${PLUGIN_PACKAGE_NAME}" CACHE STRING "Name of plugins package" FORCE) set (H5PL_CPACK_ENABLE OFF CACHE BOOL "Enable CPack include and components" FORCE) -set (H5PL_USE_GNU_DIRS ${HDF5_USE_GNU_DIRS} CACHE BOOL "TRUE to use GNU Coding Standard install directory variables" FORCE) +set (H5PL_USE_GNU_DIRS ${HDF5_USE_GNU_DIRS} CACHE BOOL "ON to use GNU Coding Standard install directory variables, OFF to use historical settings" FORCE) diff --git a/config/cmake/HDFMacros.cmake b/config/cmake/HDFMacros.cmake index 30c16e6800f..64e77c012d3 100644 --- a/config/cmake/HDFMacros.cmake +++ b/config/cmake/HDFMacros.cmake @@ -369,7 +369,7 @@ macro (HDFTEST_COPY_FILE src dest target) endmacro () macro (HDF_DIR_PATHS package_prefix) - option (HDF5_USE_GNU_DIRS "TRUE to use GNU Coding Standard install directory variables, FALSE to use historical settings" FALSE) + option (HDF5_USE_GNU_DIRS "ON to use GNU Coding Standard install directory variables, OFF to use historical settings" OFF) if (HDF5_USE_GNU_DIRS) include(GNUInstallDirs) if (NOT ${package_prefix}_INSTALL_BIN_DIR) @@ -400,7 +400,7 @@ macro (HDF_DIR_PATHS package_prefix) endif () if (APPLE) - option (${package_prefix}_BUILD_FRAMEWORKS "TRUE to build as frameworks libraries, FALSE to build according to BUILD_SHARED_LIBS" FALSE) + option (${package_prefix}_BUILD_FRAMEWORKS "ON to build as frameworks libraries, OFF to build according to BUILD_SHARED_LIBS" OFF) endif () if (NOT ${package_prefix}_INSTALL_BIN_DIR) @@ -449,10 +449,10 @@ macro (HDF_DIR_PATHS package_prefix) message(STATUS "Final: ${${package_prefix}_INSTALL_DOC_DIR}") # Always use full RPATH, i.e. don't skip the full RPATH for the build tree - set (CMAKE_SKIP_BUILD_RPATH FALSE) + set (CMAKE_SKIP_BUILD_RPATH OFF) # when building, don't use the install RPATH already # (but later on when installing) - set (CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE) + set (CMAKE_INSTALL_RPATH_USE_LINK_PATH OFF) # add the automatically determined parts of the RPATH # which point to directories outside the build tree to the install RPATH set (CMAKE_BUILD_WITH_INSTALL_RPATH ON) diff --git a/release_docs/INSTALL b/release_docs/INSTALL_Auto.txt similarity index 98% rename from release_docs/INSTALL rename to release_docs/INSTALL_Auto.txt index 369e2700a56..7f617e31d4c 100644 --- a/release_docs/INSTALL +++ b/release_docs/INSTALL_Auto.txt @@ -15,7 +15,6 @@ CONTENTS 2. Quick installation 2.1. Windows - 2.2. RedStorm (Cray XT3) 3. HDF5 dependencies 3.1. Zlib @@ -84,13 +83,6 @@ CONTENTS Users of Microsoft Windows should see the INSTALL_Windows files for detailed instructions. -2.2. RedStorm (Cray XT3) - Users of the Red Storm machine, after reading this file, should read - the Red Storm section in the INSTALL_parallel file for specific - instructions for the Red Storm machine. The same instructions would - probably work for other Cray XT3 systems, but they have not been - verified. - 3. HDF5 dependencies 3.1. Zlib diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index 6adba9f4f5b..7bfae045567 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -788,13 +788,14 @@ if (WINDOWS) DISABLE_PDB_FILES "Do not install PDB files" OFF ---------------- HDF5 Build Options --------------------- -HDF5_BUILD_CPP_LIB "Build HDF5 C++ Library" OFF -HDF5_BUILD_EXAMPLES "Build HDF5 Library Examples" ON -HDF5_BUILD_FORTRAN "Build FORTRAN support" OFF -HDF5_BUILD_JAVA "Build JAVA support" OFF -HDF5_BUILD_HL_LIB "Build HIGH Level HDF5 Library" ON -HDF5_BUILD_TOOLS "Build HDF5 Tools" ON -HDF5_BUILD_HL_GIF_TOOLS "Build HIGH Level HDF5 GIF Tools" OFF +HDF5_BUILD_CPP_LIB "Build HDF5 C++ Library" OFF +HDF5_BUILD_EXAMPLES "Build HDF5 Library Examples" ON +HDF5_BUILD_FORTRAN "Build FORTRAN support" OFF +HDF5_BUILD_JAVA "Build JAVA support" OFF +HDF5_BUILD_HL_LIB "Build HIGH Level HDF5 Library" ON +HDF5_BUILD_TOOLS "Build HDF5 Tools" ON +HDF5_BUILD_HL_GIF_TOOLS "Build HIGH Level HDF5 GIF Tools" OFF +HDF5_BUILD_PARALLEL_TOOLS "Build Parallel HDF5 Tools" OFF ---------------- HDF5 Folder Build Options --------------------- Defaults relative to $ @@ -809,8 +810,8 @@ else () HDF5_INSTALL_DATA_DIR "share" HDF5_INSTALL_DOC_DIR "HDF5_INSTALL_DATA_DIR" -HDF5_USE_GNU_DIRS "TRUE to use GNU Coding Standard install directory variables, - FALSE to use historical settings" FALSE +HDF5_USE_GNU_DIRS "ON to use GNU Coding Standard install directory variables, + OFF to use historical settings" OFF Defaults as defined by the `GNU Coding Standards` HDF5_INSTALL_BIN_DIR "bin" HDF5_INSTALL_LIB_DIR "lib" @@ -839,6 +840,7 @@ HDF5_ENABLE_EMBEDDED_LIBINFO "embed library info into executables" HDF5_ENABLE_PREADWRITE "Use pread/pwrite in sec2/log/core VFDs in place of read/write (when available)" ON HDF5_ENABLE_TRACE "Enable API tracing capability" OFF HDF5_ENABLE_USING_MEMCHECKER "Indicate that a memory checker is used" OFF +HDF5_ENABLE_MAP_API "Build the map API" OFF HDF5_GENERATE_HEADERS "Rebuild Generated Files" ON HDF5_BUILD_GENERATORS "Build Test Generators" OFF @@ -904,7 +906,7 @@ if (BUILD_TESTING) ---------------- External Library Options --------------------- HDF5_ALLOW_EXTERNAL_SUPPORT "Allow External Library Building (NO GIT TGZ)" "NO" HDF5_ENABLE_PLUGIN_SUPPORT "Enable PLUGIN Filters" OFF -HDF5_ENABLE_SZIP_SUPPORT "Use SZip Filter" ON +HDF5_ENABLE_SZIP_SUPPORT "Use SZip Filter" OFF HDF5_ENABLE_Z_LIB_SUPPORT "Enable Zlib Filters" ON ZLIB_USE_EXTERNAL "Use External Library Building for ZLIB" OFF From 1414693350c1f972bfffb6dc9ec4b01cf92ee738 Mon Sep 17 00:00:00 2001 From: "H. Joe Lee" Date: Wed, 14 Feb 2024 07:38:21 -0600 Subject: [PATCH 2/8] Add C in project line for CMake to fix #4012. (#4014) --- HDF5Examples/C/CMakeLists.txt | 2 +- HDF5Examples/C/H5PAR/CMakeLists.txt | 2 +- HDF5Examples/C/Perf/CMakeLists.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/HDF5Examples/C/CMakeLists.txt b/HDF5Examples/C/CMakeLists.txt index 4ac8574724a..12882cfa5fa 100644 --- a/HDF5Examples/C/CMakeLists.txt +++ b/HDF5Examples/C/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required (VERSION 3.12) -project (HDF5Examples_C) +project (HDF5Examples_C C) #----------------------------------------------------------------------------- # Build the C Examples diff --git a/HDF5Examples/C/H5PAR/CMakeLists.txt b/HDF5Examples/C/H5PAR/CMakeLists.txt index 6e569b4dfea..9016220d2a8 100644 --- a/HDF5Examples/C/H5PAR/CMakeLists.txt +++ b/HDF5Examples/C/H5PAR/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required (VERSION 3.12) -PROJECT (H5PAR_C) +project (H5PAR_C C) #----------------------------------------------------------------------------- # Define Sources diff --git a/HDF5Examples/C/Perf/CMakeLists.txt b/HDF5Examples/C/Perf/CMakeLists.txt index e41def213e5..66f93273629 100644 --- a/HDF5Examples/C/Perf/CMakeLists.txt +++ b/HDF5Examples/C/Perf/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required (VERSION 3.12) -PROJECT (HDF5Examples_C_PERFORM) +project (HDF5Examples_C_PERFORM C) #----------------------------------------------------------------------------- # Define Sources From 9dc82da3dfa30055679e533c6a93e250ff696319 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Wed, 14 Feb 2024 09:56:26 -0600 Subject: [PATCH 3/8] separate out individual checks for string removal (#4015) --- config/cmake/runTest.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/cmake/runTest.cmake b/config/cmake/runTest.cmake index 7fb9d3ca335..0cfb9a3062b 100644 --- a/config/cmake/runTest.cmake +++ b/config/cmake/runTest.cmake @@ -137,6 +137,10 @@ file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) string (FIND TEST_STREAM "_pmi_alps" TEST_FIND_RESULT) if (TEST_FIND_RESULT GREATER -1) string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) +endif () +string (FIND TEST_STREAM "ulimit -s" TEST_FIND_RESULT) +if (TEST_FIND_RESULT GREATER -1) string (REGEX REPLACE "^.*ulimit -s.*\n" "" TEST_STREAM "${TEST_STREAM}") file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) endif () From 4023fbcfbba166400abda5da8b704b84d2ccd684 Mon Sep 17 00:00:00 2001 From: mattjala <124107509+mattjala@users.noreply.github.com> Date: Wed, 14 Feb 2024 11:15:01 -0600 Subject: [PATCH 4/8] Add compound subset ops on attributes to API tests (#4005) * Add partial compound io on attributes to API tests --- test/API/H5_api_attribute_test.c | 265 +++++++++++++++++++++++++++++++ test/API/H5_api_attribute_test.h | 4 + 2 files changed, 269 insertions(+) diff --git a/test/API/H5_api_attribute_test.c b/test/API/H5_api_attribute_test.c index 02eddd0da27..fd56be82989 100644 --- a/test/API/H5_api_attribute_test.c +++ b/test/API/H5_api_attribute_test.c @@ -51,6 +51,7 @@ static int test_attribute_iterate_datatype(void); static int test_attribute_iterate_index_saving(void); static int test_attribute_iterate_invalid_params(void); static int test_attribute_iterate_0_attributes(void); +static int test_attribute_compound_subset(void); static int test_attribute_string_encodings(void); static int test_delete_attribute(void); static int test_delete_attribute_invalid_params(void); @@ -100,6 +101,7 @@ static int (*attribute_tests[])(void) = {test_create_attribute_on_root, test_attribute_iterate_index_saving, test_attribute_iterate_invalid_params, test_attribute_iterate_0_attributes, + test_attribute_compound_subset, test_attribute_string_encodings, test_delete_attribute, test_delete_attribute_invalid_params, @@ -8335,6 +8337,269 @@ test_attribute_iterate_0_attributes(void) return 1; } +/* A compound type for test_attribute_compound_subset */ +typedef struct attribute_compound_io_t { + int a; + int b; +} attribute_compound_io_t; + +/* + * A test to ensure that data is read back correctly from a attribute after it has + * been written, using subsets of compound datatypes + */ +static int +test_attribute_compound_subset(void) +{ + hsize_t dims[1] = {ATTRIBUTE_COMPOUND_IO_ATTR_DIMS}; + size_t i; + hid_t file_id = H5I_INVALID_HID; + hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; + hid_t attr_id = H5I_INVALID_HID; + hid_t space_id = H5I_INVALID_HID; + hid_t full_type_id = H5I_INVALID_HID; + hid_t a_type_id = H5I_INVALID_HID; + hid_t b_type_id = H5I_INVALID_HID; + attribute_compound_io_t wbuf[ATTRIBUTE_COMPOUND_IO_ATTR_DIMS]; + attribute_compound_io_t rbuf[ATTRIBUTE_COMPOUND_IO_ATTR_DIMS]; + attribute_compound_io_t fbuf[ATTRIBUTE_COMPOUND_IO_ATTR_DIMS]; + attribute_compound_io_t erbuf[ATTRIBUTE_COMPOUND_IO_ATTR_DIMS]; + + TESTING_MULTIPART( + "verification of attribute data using H5Awrite then H5Aread with compound type subsets"); + + /* Make sure the connector supports the API functions being tested */ + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_ATTR_BASIC)) { + SKIPPED(); + printf( + " API functions for basic file, group, or attribute aren't supported with this connector\n"); + return 0; + } + + TESTING_2("test setup"); + + if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { + H5_FAILED(); + printf(" couldn't open file '%s'\n", H5_api_test_filename); + goto error; + } + + if ((container_group = H5Gopen2(file_id, ATTRIBUTE_TEST_GROUP_NAME, H5P_DEFAULT)) < 0) { + H5_FAILED(); + printf(" couldn't open container group '%s'\n", ATTRIBUTE_TEST_GROUP_NAME); + goto error; + } + + if ((group_id = H5Gcreate2(container_group, ATTRIBUTE_COMPOUND_IO_TEST_GROUP_NAME, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT)) < 0) { + H5_FAILED(); + printf(" couldn't create container sub-group '%s'\n", ATTRIBUTE_COMPOUND_IO_TEST_GROUP_NAME); + goto error; + } + + if ((space_id = H5Screate_simple(1, dims, NULL)) < 0) + TEST_ERROR; + + if ((full_type_id = H5Tcreate(H5T_COMPOUND, sizeof(attribute_compound_io_t))) < 0) + TEST_ERROR; + if (H5Tinsert(full_type_id, "a", HOFFSET(attribute_compound_io_t, a), H5T_NATIVE_INT) < 0) + TEST_ERROR; + if (H5Tinsert(full_type_id, "b", HOFFSET(attribute_compound_io_t, b), H5T_NATIVE_INT) < 0) + TEST_ERROR; + + if ((a_type_id = H5Tcreate(H5T_COMPOUND, sizeof(attribute_compound_io_t))) < 0) + TEST_ERROR; + if (H5Tinsert(a_type_id, "a", HOFFSET(attribute_compound_io_t, a), H5T_NATIVE_INT) < 0) + TEST_ERROR; + + if ((b_type_id = H5Tcreate(H5T_COMPOUND, sizeof(attribute_compound_io_t))) < 0) + TEST_ERROR; + if (H5Tinsert(b_type_id, "b", HOFFSET(attribute_compound_io_t, b), H5T_NATIVE_INT) < 0) + TEST_ERROR; + + if ((attr_id = H5Acreate2(group_id, ATTRIBUTE_COMPOUND_IO_TEST_ATTR_NAME, full_type_id, space_id, + H5P_DEFAULT, H5P_DEFAULT)) < 0) { + H5_FAILED(); + printf(" couldn't create attribute '%s'\n", ATTRIBUTE_COMPOUND_IO_TEST_ATTR_NAME); + goto error; + } + + PASSED(); + + BEGIN_MULTIPART + { + PART_BEGIN(write_full_read_full) + { + TESTING_2("H5Awrite then H5Aread with all compound members"); + + /* Initialize wbuf */ + for (i = 0; i < ATTRIBUTE_COMPOUND_IO_ATTR_DIMS; i++) { + wbuf[i].a = (int)(2 * i); + wbuf[i].b = (int)(2 * i + 1); + } + + /* Write data */ + if (H5Awrite(attr_id, full_type_id, wbuf) < 0) + PART_TEST_ERROR(write_full_read_full); + + /* Update fbuf to match file state */ + for (i = 0; i < ATTRIBUTE_COMPOUND_IO_ATTR_DIMS; i++) { + fbuf[i].a = wbuf[i].a; + fbuf[i].b = wbuf[i].b; + } + + /* Initialize rbuf to -1 */ + for (i = 0; i < ATTRIBUTE_COMPOUND_IO_ATTR_DIMS; i++) { + rbuf[i].a = -1; + rbuf[i].b = -1; + } + + /* Set erbuf (simply match file state since we're reading the whole + * thing) */ + for (i = 0; i < ATTRIBUTE_COMPOUND_IO_ATTR_DIMS; i++) { + erbuf[i].a = fbuf[i].a; + erbuf[i].b = fbuf[i].b; + } + + /* Read data */ + if (H5Aread(attr_id, full_type_id, rbuf) < 0) + PART_TEST_ERROR(write_full_read_full); + + /* Verify data */ + for (i = 0; i < ATTRIBUTE_COMPOUND_IO_ATTR_DIMS; i++) { + if (rbuf[i].a != erbuf[i].a) + PART_TEST_ERROR(write_full_read_full); + if (rbuf[i].b != erbuf[i].b) + PART_TEST_ERROR(write_full_read_full); + } + + PASSED(); + } + PART_END(write_full_read_full); + + PART_BEGIN(read_a) + { + TESTING_2("H5Aread with compound member a"); + + /* Initialize rbuf to -1 */ + for (i = 0; i < ATTRIBUTE_COMPOUND_IO_ATTR_DIMS; i++) { + rbuf[i].a = -1; + rbuf[i].b = -1; + } + + /* Set erbuf (element a comes from the file, element b in untouched) + */ + for (i = 0; i < ATTRIBUTE_COMPOUND_IO_ATTR_DIMS; i++) { + erbuf[i].a = fbuf[i].a; + erbuf[i].b = rbuf[i].b; + } + + /* Read data */ + if (H5Aread(attr_id, a_type_id, rbuf) < 0) + PART_TEST_ERROR(read_a); + + /* Verify data */ + for (i = 0; i < ATTRIBUTE_COMPOUND_IO_ATTR_DIMS; i++) { + if (rbuf[i].a != erbuf[i].a) + PART_TEST_ERROR(read_a); + if (rbuf[i].b != erbuf[i].b) + PART_TEST_ERROR(read_a); + } + + PASSED(); + } + PART_END(read_a); + + PART_BEGIN(write_b_read_full) + { + TESTING_2("H5Awrite with compound member b then H5Aread with all compound members"); + + /* Initialize wbuf */ + for (i = 0; i < ATTRIBUTE_COMPOUND_IO_ATTR_DIMS; i++) { + wbuf[i].a = (int)(2 * ATTRIBUTE_COMPOUND_IO_ATTR_DIMS + 2 * i); + wbuf[i].b = (int)(2 * ATTRIBUTE_COMPOUND_IO_ATTR_DIMS + 2 * i + 1); + } + + /* Write data */ + if (H5Awrite(attr_id, b_type_id, wbuf) < 0) + PART_TEST_ERROR(write_b_read_full); + + /* Update fbuf to match file state - only element b was updated */ + for (i = 0; i < ATTRIBUTE_COMPOUND_IO_ATTR_DIMS; i++) { + fbuf[i].b = wbuf[i].b; + } + + /* Initialize rbuf to -1 */ + for (i = 0; i < ATTRIBUTE_COMPOUND_IO_ATTR_DIMS; i++) { + rbuf[i].a = -1; + rbuf[i].b = -1; + } + + /* Set erbuf (simply match file state since we're reading the whole + * thing) */ + for (i = 0; i < ATTRIBUTE_COMPOUND_IO_ATTR_DIMS; i++) { + erbuf[i].a = fbuf[i].a; + erbuf[i].b = fbuf[i].b; + } + + /* Read data */ + if (H5Aread(attr_id, full_type_id, rbuf) < 0) + PART_TEST_ERROR(write_b_read_full); + + /* Verify data */ + for (i = 0; i < ATTRIBUTE_COMPOUND_IO_ATTR_DIMS; i++) { + if (rbuf[i].a != erbuf[i].a) + PART_TEST_ERROR(write_b_read_full); + if (rbuf[i].b != erbuf[i].b) + PART_TEST_ERROR(write_b_read_full); + } + + PASSED(); + } + PART_END(write_b_read_full); + } + END_MULTIPART; + + TESTING_2("test cleanup"); + + if (H5Sclose(space_id) < 0) + TEST_ERROR; + if (H5Aclose(attr_id) < 0) + TEST_ERROR; + if (H5Gclose(group_id) < 0) + TEST_ERROR; + if (H5Gclose(container_group) < 0) + TEST_ERROR; + if (H5Fclose(file_id) < 0) + TEST_ERROR; + if (H5Tclose(full_type_id) < 0) + TEST_ERROR; + if (H5Tclose(a_type_id) < 0) + TEST_ERROR; + if (H5Tclose(b_type_id) < 0) + TEST_ERROR; + + PASSED(); + + return 0; + +error: + H5E_BEGIN_TRY + { + H5Sclose(space_id); + H5Aclose(attr_id); + H5Gclose(group_id); + H5Gclose(container_group); + H5Fclose(file_id); + H5Tclose(full_type_id); + H5Tclose(a_type_id); + H5Tclose(b_type_id); + } + H5E_END_TRY; + + return 1; +} + /* * A test to check that attributes preserve data * correctness for strings with ASCII or UTF-8 char sets diff --git a/test/API/H5_api_attribute_test.h b/test/API/H5_api_attribute_test.h index 4b4d3ef8a15..7b455dcaa1a 100644 --- a/test/API/H5_api_attribute_test.h +++ b/test/API/H5_api_attribute_test.h @@ -156,6 +156,10 @@ int H5_api_attribute_test(void); #define ATTRIBUTE_ITERATE_TEST_0_ATTRIBUTES_SUBGROUP_NAME "attribute_iterate_test_0_attributes" #define ATTRIBUTE_ITERATE_TEST_0_ATTRIBUTES_DSET_NAME "attribute_iterate_dset" +#define ATTRIBUTE_COMPOUND_IO_ATTR_DIMS 10 +#define ATTRIBUTE_COMPOUND_IO_TEST_GROUP_NAME "attribute_compound_io_test_group" +#define ATTRIBUTE_COMPOUND_IO_TEST_ATTR_NAME "attribute_compound_io_test_attr" + #define ATTRIBUTE_STRING_ENCODINGS_RANK 1 #define ATTRIBUTE_STRING_ENCODINGS_EXTENT 1 #define ATTRIBUTE_STRING_ENCODINGS_DSET_NAME1 "encoding_dset1" From 410c18b59f8389f113c806917af69378d77ef506 Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Thu, 15 Feb 2024 10:19:52 -0600 Subject: [PATCH 5/8] included best practices of using coll. metadata APIs (#4018) --- HDF5Examples/C/H5PAR/ph5_dataset.c | 18 ++++++++++++++++++ HDF5Examples/C/H5PAR/ph5_file_create.c | 18 ++++++++++++++++++ HDF5Examples/C/H5PAR/ph5_filtered_writes.c | 18 ++++++++++++++---- .../C/H5PAR/ph5_filtered_writes_no_sel.c | 18 ++++++++++++++---- HDF5Examples/C/H5PAR/ph5_hyperslab_by_chunk.c | 18 ++++++++++++++++++ HDF5Examples/C/H5PAR/ph5_hyperslab_by_col.c | 18 ++++++++++++++++++ .../C/H5PAR/ph5_hyperslab_by_pattern.c | 18 ++++++++++++++++++ HDF5Examples/C/H5PAR/ph5_hyperslab_by_row.c | 18 ++++++++++++++++++ HDF5Examples/C/H5PAR/ph5example.c | 18 ++++++++++++++++++ 9 files changed, 154 insertions(+), 8 deletions(-) diff --git a/HDF5Examples/C/H5PAR/ph5_dataset.c b/HDF5Examples/C/H5PAR/ph5_dataset.c index 9b8e8a833b3..0c25fcc6103 100644 --- a/HDF5Examples/C/H5PAR/ph5_dataset.c +++ b/HDF5Examples/C/H5PAR/ph5_dataset.c @@ -53,6 +53,24 @@ main(int argc, char **argv) plist_id = H5Pcreate(H5P_FILE_ACCESS); H5Pset_fapl_mpio(plist_id, comm, info); + /* + * OPTIONAL: It is generally recommended to set collective + * metadata reads on FAPL to perform metadata reads + * collectively, which usually allows datasets + * to perform better at scale, although it is not + * strictly necessary. + */ + H5Pset_all_coll_metadata_ops(plist_id, true); + + /* + * OPTIONAL: It is generally recommended to set collective + * metadata writes on FAPL to perform metadata writes + * collectively, which usually allows datasets + * to perform better at scale, although it is not + * strictly necessary. + */ + H5Pset_coll_metadata_write(plist_id, true); + /* * Create a new file collectively and release property list identifier. */ diff --git a/HDF5Examples/C/H5PAR/ph5_file_create.c b/HDF5Examples/C/H5PAR/ph5_file_create.c index a3bd0a8d026..10938f29b1a 100644 --- a/HDF5Examples/C/H5PAR/ph5_file_create.c +++ b/HDF5Examples/C/H5PAR/ph5_file_create.c @@ -36,6 +36,24 @@ main(int argc, char **argv) plist_id = H5Pcreate(H5P_FILE_ACCESS); H5Pset_fapl_mpio(plist_id, comm, info); + /* + * OPTIONAL: It is generally recommended to set collective + * metadata reads on FAPL to perform metadata reads + * collectively, which usually allows datasets + * to perform better at scale, although it is not + * strictly necessary. + */ + H5Pset_all_coll_metadata_ops(plist_id, true); + + /* + * OPTIONAL: It is generally recommended to set collective + * metadata writes on FAPL to perform metadata writes + * collectively, which usually allows datasets + * to perform better at scale, although it is not + * strictly necessary. + */ + H5Pset_coll_metadata_write(plist_id, true); + /* * Create a new file collectively. */ diff --git a/HDF5Examples/C/H5PAR/ph5_filtered_writes.c b/HDF5Examples/C/H5PAR/ph5_filtered_writes.c index 104704a238a..34ed2fbb0cf 100644 --- a/HDF5Examples/C/H5PAR/ph5_filtered_writes.c +++ b/HDF5Examples/C/H5PAR/ph5_filtered_writes.c @@ -377,13 +377,23 @@ main(int argc, char **argv) H5Pset_fapl_mpio(fapl_id, comm, info); /* - * OPTIONAL: Set collective metadata reads on FAPL to allow - * parallel writes to filtered datasets to perform - * better at scale. While not strictly necessary, - * this is generally recommended. + * OPTIONAL: It is generally recommended to set collective + * metadata reads on FAPL to perform metadata reads + * collectively, which usually allows filtered datasets + * to perform better at scale, although it is not + * strictly necessary. */ H5Pset_all_coll_metadata_ops(fapl_id, true); + /* + * OPTIONAL: It is generally recommended to set collective + * metadata writes on FAPL to perform metadata writes + * collectively, which usually allows filtered datasets + * to perform better at scale, although it is not + * strictly necessary. + */ + H5Pset_coll_metadata_write(fapl_id, true); + /* * OPTIONAL: Set the latest file format version for HDF5 in * order to gain access to different dataset chunk diff --git a/HDF5Examples/C/H5PAR/ph5_filtered_writes_no_sel.c b/HDF5Examples/C/H5PAR/ph5_filtered_writes_no_sel.c index a4d9e169c36..d4f171ff1f8 100644 --- a/HDF5Examples/C/H5PAR/ph5_filtered_writes_no_sel.c +++ b/HDF5Examples/C/H5PAR/ph5_filtered_writes_no_sel.c @@ -271,13 +271,23 @@ main(int argc, char **argv) H5Pset_fapl_mpio(fapl_id, comm, info); /* - * OPTIONAL: Set collective metadata reads on FAPL to allow - * parallel writes to filtered datasets to perform - * better at scale. While not strictly necessary, - * this is generally recommended. + * OPTIONAL: It is generally recommended to set collective + * metadata reads on FAPL to perform metadata reads + * collectively, which usually allows filtered datasets + * to perform better at scale, although it is not + * strictly necessary. */ H5Pset_all_coll_metadata_ops(fapl_id, true); + /* + * OPTIONAL: It is generally recommended to set collective + * metadata writes on FAPL to perform metadata writes + * collectively, which usually allows filtered datasets + * to perform better at scale, although it is not + * strictly necessary. + */ + H5Pset_coll_metadata_write(fapl_id, true); + /* * OPTIONAL: Set the latest file format version for HDF5 in * order to gain access to different dataset chunk diff --git a/HDF5Examples/C/H5PAR/ph5_hyperslab_by_chunk.c b/HDF5Examples/C/H5PAR/ph5_hyperslab_by_chunk.c index a255b96e0e3..e00a0ef663b 100644 --- a/HDF5Examples/C/H5PAR/ph5_hyperslab_by_chunk.c +++ b/HDF5Examples/C/H5PAR/ph5_hyperslab_by_chunk.c @@ -64,6 +64,24 @@ main(int argc, char **argv) plist_id = H5Pcreate(H5P_FILE_ACCESS); H5Pset_fapl_mpio(plist_id, comm, info); + /* + * OPTIONAL: It is generally recommended to set collective + * metadata reads on FAPL to perform metadata reads + * collectively, which usually allows datasets + * to perform better at scale, although it is not + * strictly necessary. + */ + H5Pset_all_coll_metadata_ops(plist_id, true); + + /* + * OPTIONAL: It is generally recommended to set collective + * metadata writes on FAPL to perform metadata writes + * collectively, which usually allows datasets + * to perform better at scale, although it is not + * strictly necessary. + */ + H5Pset_coll_metadata_write(plist_id, true); + /* * Create a new file collectively and release property list identifier. */ diff --git a/HDF5Examples/C/H5PAR/ph5_hyperslab_by_col.c b/HDF5Examples/C/H5PAR/ph5_hyperslab_by_col.c index b397fcff3bf..49e5ce30799 100644 --- a/HDF5Examples/C/H5PAR/ph5_hyperslab_by_col.c +++ b/HDF5Examples/C/H5PAR/ph5_hyperslab_by_col.c @@ -59,6 +59,24 @@ main(int argc, char **argv) plist_id = H5Pcreate(H5P_FILE_ACCESS); H5Pset_fapl_mpio(plist_id, comm, info); + /* + * OPTIONAL: It is generally recommended to set collective + * metadata reads on FAPL to perform metadata reads + * collectively, which usually allows datasets + * to perform better at scale, although it is not + * strictly necessary. + */ + H5Pset_all_coll_metadata_ops(plist_id, true); + + /* + * OPTIONAL: It is generally recommended to set collective + * metadata writes on FAPL to perform metadata writes + * collectively, which usually allows datasets + * to perform better at scale, although it is not + * strictly necessary. + */ + H5Pset_coll_metadata_write(plist_id, true); + /* * Create a new file collectively and release property list identifier. */ diff --git a/HDF5Examples/C/H5PAR/ph5_hyperslab_by_pattern.c b/HDF5Examples/C/H5PAR/ph5_hyperslab_by_pattern.c index 77f3bef27c7..bec3a2f806a 100644 --- a/HDF5Examples/C/H5PAR/ph5_hyperslab_by_pattern.c +++ b/HDF5Examples/C/H5PAR/ph5_hyperslab_by_pattern.c @@ -64,6 +64,24 @@ main(int argc, char **argv) plist_id = H5Pcreate(H5P_FILE_ACCESS); H5Pset_fapl_mpio(plist_id, comm, info); + /* + * OPTIONAL: It is generally recommended to set collective + * metadata reads on FAPL to perform metadata reads + * collectively, which usually allows datasets + * to perform better at scale, although it is not + * strictly necessary. + */ + H5Pset_all_coll_metadata_ops(plist_id, true); + + /* + * OPTIONAL: It is generally recommended to set collective + * metadata writes on FAPL to perform metadata writes + * collectively, which usually allows datasets + * to perform better at scale, although it is not + * strictly necessary. + */ + H5Pset_coll_metadata_write(plist_id, true); + /* * Create a new file collectively and release property list identifier. */ diff --git a/HDF5Examples/C/H5PAR/ph5_hyperslab_by_row.c b/HDF5Examples/C/H5PAR/ph5_hyperslab_by_row.c index 503578676d4..1c08a32d69e 100644 --- a/HDF5Examples/C/H5PAR/ph5_hyperslab_by_row.c +++ b/HDF5Examples/C/H5PAR/ph5_hyperslab_by_row.c @@ -48,6 +48,24 @@ main(int argc, char **argv) plist_id = H5Pcreate(H5P_FILE_ACCESS); H5Pset_fapl_mpio(plist_id, comm, info); + /* + * OPTIONAL: It is generally recommended to set collective + * metadata reads on FAPL to perform metadata reads + * collectively, which usually allows datasets + * to perform better at scale, although it is not + * strictly necessary. + */ + H5Pset_all_coll_metadata_ops(plist_id, true); + + /* + * OPTIONAL: It is generally recommended to set collective + * metadata writes on FAPL to perform metadata writes + * collectively, which usually allows datasets + * to perform better at scale, although it is not + * strictly necessary. + */ + H5Pset_coll_metadata_write(plist_id, true); + /* * Create a new file collectively and release property list identifier. */ diff --git a/HDF5Examples/C/H5PAR/ph5example.c b/HDF5Examples/C/H5PAR/ph5example.c index 5ec2cdc2841..37d5d68ed72 100644 --- a/HDF5Examples/C/H5PAR/ph5example.c +++ b/HDF5Examples/C/H5PAR/ph5example.c @@ -269,6 +269,24 @@ phdf5writeInd(char *filename) assert(ret != FAIL); MESG("H5Pset_fapl_mpio succeed"); + /* + * OPTIONAL: It is generally recommended to set collective + * metadata reads on FAPL to perform metadata reads + * collectively, which usually allows datasets + * to perform better at scale, although it is not + * strictly necessary. + */ + H5Pset_all_coll_metadata_ops(acc_tpl1, true); + + /* + * OPTIONAL: It is generally recommended to set collective + * metadata writes on FAPL to perform metadata writes + * collectively, which usually allows datasets + * to perform better at scale, although it is not + * strictly necessary. + */ + H5Pset_coll_metadata_write(acc_tpl1, true); + /* create the file collectively */ fid1 = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, acc_tpl1); assert(fid1 != FAIL); From 7392a102d8ab67c369d2f6208bd4b23711e6ea44 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Thu, 15 Feb 2024 15:32:01 -0600 Subject: [PATCH 6/8] Delete old snapshot binaries after new snapshots are created (#4020) --- .github/workflows/daily-build.yml | 31 +++++++++++++++ .github/workflows/release.yml | 1 - .github/workflows/remove-files.yml | 60 ++++++++++++++++++++++++++++++ 3 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/remove-files.yml diff --git a/.github/workflows/daily-build.yml b/.github/workflows/daily-build.yml index a3f965bc66c..37f2f065cee 100644 --- a/.github/workflows/daily-build.yml +++ b/.github/workflows/daily-build.yml @@ -12,6 +12,26 @@ permissions: # A workflow run is made up of one or more jobs that can run sequentially or # in parallel. jobs: + get-old-names: + runs-on: ubuntu-latest + outputs: + hdf5-name: ${{ steps.gethdf5base.outputs.HDF5_NAME_BASE }} + + steps: + - uses: actions/checkout@v4.1.1 + + - name: Get hdf5 release base name + uses: dsaltares/fetch-gh-release-asset@master + with: + version: 'tags/snapshot' + file: 'last-file.txt' + + - name: Read base-name file + id: gethdf5base + run: echo "HDF5_NAME_BASE=$(cat last-file.txt)" >> $GITHUB_OUTPUT + + - run: echo "hdf5 base name is ${{ steps.gethdf5base.outputs.HDF5_NAME_BASE }}." + call-workflow-tarball: uses: ./.github/workflows/tarball.yml with: @@ -51,3 +71,14 @@ jobs: use_environ: snapshots if: ${{ needs.call-workflow-tarball.outputs.has_changes == 'true' }} + call-workflow-remove: + needs: [get-old-names, call-workflow-tarball, call-workflow-ctest, call-workflow-abi, call-workflow-release] + permissions: + contents: write # In order to allow file deletion + uses: ./.github/workflows/remove-files.yml + with: + file_base: ${{ needs.get-old-names.outputs.hdf5-name }} + use_tag: snapshot + use_environ: snapshots + if: ${{ needs.call-workflow-tarball.outputs.has_changes == 'true' }} + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 68565b6cc23..9b97417f07d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -96,7 +96,6 @@ jobs: use_environ: release call-workflow-release: - #needs: [call-workflow-tarball, call-workflow-ctest] needs: [log-the-inputs, create-files-ctest, call-workflow-ctest, call-workflow-abi] permissions: contents: write # In order to allow tag creation diff --git a/.github/workflows/remove-files.yml b/.github/workflows/remove-files.yml new file mode 100644 index 00000000000..1d72362d0b7 --- /dev/null +++ b/.github/workflows/remove-files.yml @@ -0,0 +1,60 @@ +name: hdf5 dev remove-files + +# Controls when the action will run. Triggers the workflow on a schedule +on: + workflow_call: + inputs: + use_tag: + description: 'Release version tag' + type: string + required: false + default: snapshot + use_environ: + description: 'Environment to locate files' + type: string + required: true + default: snapshots + file_base: + description: "The common base name of the source tarballs" + required: true + type: string + +# Minimal permissions to be inherited by any job that doesn't declare its own permissions +permissions: + contents: read + +# Previous workflows must pass to get here so tag the commit that created the files +jobs: + PreRelease-delfiles: + runs-on: ubuntu-latest + environment: ${{ inputs.use_environ }} + permissions: + contents: write + steps: + - name: Get file base name + id: get-file-base + run: | + FILE_NAME_BASE=$(echo "${{ inputs.file_base }}") + echo "FILE_BASE=$FILE_NAME_BASE" >> $GITHUB_OUTPUT + + - name: PreRelease delete from tag + id: delete_prerelease + if: ${{ (inputs.use_environ == 'snapshots') }} + uses: mknejp/delete-release-assets@v1 + with: + token: ${{ github.token }} + tag: "${{ inputs.use_tag }}" + assets: | + ${{ steps.get-file-base.outputs.FILE_BASE }}-hdf5_compat_report.html + ${{ steps.get-file-base.outputs.FILE_BASE }}-hdf5_hl_compat_report.html + ${{ steps.get-file-base.outputs.FILE_BASE }}-hdf5_cpp_compat_report.html + ${{ steps.get-file-base.outputs.FILE_BASE }}-java_compat_report.html + ${{ steps.get-file-base.outputs.FILE_BASE }}.doxygen.zip + ${{ steps.get-file-base.outputs.FILE_BASE }}.tar.gz + ${{ steps.get-file-base.outputs.FILE_BASE }}.zip + ${{ steps.get-file-base.outputs.FILE_BASE }}-osx12.tar.gz + ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_gcc.tar.gz + ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_gcc_s3.tar.gz + ${{ steps.get-file-base.outputs.FILE_BASE }}-win-vs2022_cl.zip + ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_intel.tar.gz + ${{ steps.get-file-base.outputs.FILE_BASE }}-win-vs2022_intel.zip From bdddf43f1a6801e5d7c02d0d8556ee1e80047f77 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Thu, 15 Feb 2024 17:49:32 -0600 Subject: [PATCH 7/8] Correct String FIND for runTest and grepTest (#4022) --- HDF5Examples/config/cmake/grepTest.cmake | 17 ++++++++++++----- HDF5Examples/config/cmake/runTest.cmake | 19 +++++++++++++------ config/cmake/HDF5UseFortran.cmake | 2 +- config/cmake/grepTest.cmake | 17 ++++++++++++----- config/cmake/runTest.cmake | 24 +++++++++++++----------- 5 files changed, 51 insertions(+), 28 deletions(-) diff --git a/HDF5Examples/config/cmake/grepTest.cmake b/HDF5Examples/config/cmake/grepTest.cmake index 2ec83872a55..4031a1bde03 100644 --- a/HDF5Examples/config/cmake/grepTest.cmake +++ b/HDF5Examples/config/cmake/grepTest.cmake @@ -70,11 +70,18 @@ message (STATUS "COMMAND Result: ${TEST_RESULT}") message (STATUS "COMMAND Error: ${TEST_ERROR}") # remove special output -file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) -string (FIND TEST_STREAM "_pmi_alps" TEST_FIND_RESULT) -if (TEST_FIND_RESULT GREATER -1) - string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) +if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}") + file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + string (FIND "${TEST_STREAM}" "_pmi_alps" TEST_FIND_RESULT) + if (TEST_FIND_RESULT GREATER -1) + string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") + endif () + string (FIND "${TEST_STREAM}" "ulimit -s" TEST_FIND_RESULT) + if (TEST_FIND_RESULT GREATER -1) + string (REGEX REPLACE "^.*ulimit -s[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") + endif () endif () # if the TEST_ERRREF exists grep the error output with the error reference diff --git a/HDF5Examples/config/cmake/runTest.cmake b/HDF5Examples/config/cmake/runTest.cmake index d21765a8e36..3507c3482d5 100644 --- a/HDF5Examples/config/cmake/runTest.cmake +++ b/HDF5Examples/config/cmake/runTest.cmake @@ -133,11 +133,18 @@ endif () message (STATUS "COMMAND Error: ${TEST_ERROR}") # remove special output -file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) -string (FIND TEST_STREAM "_pmi_alps" TEST_FIND_RESULT) -if (TEST_FIND_RESULT GREATER -1) - string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) +if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}") + file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + string (FIND "${TEST_STREAM}" "_pmi_alps" TEST_FIND_RESULT) + if (TEST_FIND_RESULT GREATER -1) + string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") + endif () + string (FIND "${TEST_STREAM}" "ulimit -s" TEST_FIND_RESULT) + if (TEST_FIND_RESULT GREATER -1) + string (REGEX REPLACE "^.*ulimit -s[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") + endif () endif () # remove special error output @@ -148,7 +155,7 @@ else () # the error stack remains in the .err file file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) endif () -string (FIND TEST_STREAM "no version information available" TEST_FIND_RESULT) +string (FIND "${TEST_STREAM}" "no version information available" TEST_FIND_RESULT) if (TEST_FIND_RESULT GREATER -1) string (REGEX REPLACE "^.*no version information available[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") # write back the changes to the original files diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake index 3e058adbf83..7f125f1c6c5 100644 --- a/config/cmake/HDF5UseFortran.cmake +++ b/config/cmake/HDF5UseFortran.cmake @@ -345,7 +345,7 @@ string (REGEX REPLACE "}" "" OUT_VAR2 ${OUT_VAR2}) set (${HDF_PREFIX}_H5CONFIG_F_RKIND_SIZEOF "INTEGER, DIMENSION(1:num_rkinds) :: rkind_sizeof = (/${OUT_VAR2}/)") # Setting definition if there is a 16 byte fortran integer -string (FIND ${PAC_FC_ALL_INTEGER_KINDS_SIZEOF} "16" pos) +string (FIND "${PAC_FC_ALL_INTEGER_KINDS_SIZEOF}" "16" pos) if (${pos} EQUAL -1) set (${HDF_PREFIX}_HAVE_Fortran_INTEGER_SIZEOF_16 0) else () diff --git a/config/cmake/grepTest.cmake b/config/cmake/grepTest.cmake index 2ec83872a55..4031a1bde03 100644 --- a/config/cmake/grepTest.cmake +++ b/config/cmake/grepTest.cmake @@ -70,11 +70,18 @@ message (STATUS "COMMAND Result: ${TEST_RESULT}") message (STATUS "COMMAND Error: ${TEST_ERROR}") # remove special output -file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) -string (FIND TEST_STREAM "_pmi_alps" TEST_FIND_RESULT) -if (TEST_FIND_RESULT GREATER -1) - string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) +if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}") + file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + string (FIND "${TEST_STREAM}" "_pmi_alps" TEST_FIND_RESULT) + if (TEST_FIND_RESULT GREATER -1) + string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") + endif () + string (FIND "${TEST_STREAM}" "ulimit -s" TEST_FIND_RESULT) + if (TEST_FIND_RESULT GREATER -1) + string (REGEX REPLACE "^.*ulimit -s[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") + endif () endif () # if the TEST_ERRREF exists grep the error output with the error reference diff --git a/config/cmake/runTest.cmake b/config/cmake/runTest.cmake index 0cfb9a3062b..4257c442c6a 100644 --- a/config/cmake/runTest.cmake +++ b/config/cmake/runTest.cmake @@ -133,16 +133,18 @@ endif () message (STATUS "COMMAND Error: ${TEST_ERROR}") # remove special output -file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) -string (FIND TEST_STREAM "_pmi_alps" TEST_FIND_RESULT) -if (TEST_FIND_RESULT GREATER -1) - string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) -endif () -string (FIND TEST_STREAM "ulimit -s" TEST_FIND_RESULT) -if (TEST_FIND_RESULT GREATER -1) - string (REGEX REPLACE "^.*ulimit -s.*\n" "" TEST_STREAM "${TEST_STREAM}") - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) +if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}") + file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + string (FIND "${TEST_STREAM}" "_pmi_alps" TEST_FIND_RESULT) + if (TEST_FIND_RESULT GREATER -1) + string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) + endif () + string (FIND "${TEST_STREAM}" "ulimit -s" TEST_FIND_RESULT) + if (TEST_FIND_RESULT GREATER -1) + string (REGEX REPLACE "^.*ulimit -s[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) + endif () endif () # remove special error output @@ -153,7 +155,7 @@ else () # the error stack remains in the .err file file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) endif () -string (FIND TEST_STREAM "no version information available" TEST_FIND_RESULT) +string (FIND "${TEST_STREAM}" "no version information available" TEST_FIND_RESULT) if (TEST_FIND_RESULT GREATER -1) string (REGEX REPLACE "^.*no version information available[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") # write back the changes to the original files From 02a57328f743342a7e26d47da4aac445ee248782 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Fri, 16 Feb 2024 11:14:22 -0600 Subject: [PATCH 8/8] Grep for error messages instead of comparing files (#4024) --- tools/test/h5copy/CMakeTests.cmake | 8 ++++---- tools/test/h5ls/CMakeTests.cmake | 13 +++++++------ tools/test/misc/CMakeTestsClear.cmake | 19 ++++++++++--------- 3 files changed, 21 insertions(+), 19 deletions(-) diff --git a/tools/test/h5copy/CMakeTests.cmake b/tools/test/h5copy/CMakeTests.cmake index b4daa87c8ed..15d66d13c29 100644 --- a/tools/test/h5copy/CMakeTests.cmake +++ b/tools/test/h5copy/CMakeTests.cmake @@ -253,7 +253,7 @@ # Similar to ADD_H5_TEST macro. Compare to outputs from source & target # files instead of checking with h5ls. # - macro (ADD_H5_CMP_TEST testname resultcode infile vparam sparam srcname dparam dstname) + macro (ADD_H5_CMP_TEST testname resultcode result_errcheck infile vparam sparam srcname dparam dstname) # Remove any output file left over from previous test run add_test ( NAME H5COPY-CMP-${testname}-clear-objects @@ -276,9 +276,9 @@ -D "TEST_OUTPUT=./testfiles/${testname}.out.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=./testfiles/${testname}.out" - -D "TEST_ERRREF=./testfiles/${testname}.err" + -D "TEST_ERRREF=${result_errcheck}" -D "TEST_MASK=true" - -P "${HDF_RESOURCES_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/grepTest.cmake" ) endif () set_tests_properties (H5COPY-CMP-${testname} PROPERTIES DEPENDS H5COPY-CMP-${testname}-clear-objects) @@ -598,7 +598,7 @@ #----------------------------------------------------------------- # "Test copying object into group which doesn't exist, without -p" # - ADD_H5_CMP_TEST (h5copy_misc1 1 ${HDF_FILE1}.h5 -v -s /simple -d /g1/g2/simple) + ADD_H5_CMP_TEST (h5copy_misc1 1 "h5copy error" ${HDF_FILE1}.h5 -v -s /simple -d /g1/g2/simple) #------------------------------------------- # "Test copying objects to the same file " diff --git a/tools/test/h5ls/CMakeTests.cmake b/tools/test/h5ls/CMakeTests.cmake index 629f3241ed8..2d932b22937 100644 --- a/tools/test/h5ls/CMakeTests.cmake +++ b/tools/test/h5ls/CMakeTests.cmake @@ -174,7 +174,7 @@ endif () endmacro () - macro (ADD_H5_ERR_TEST resultfile resultcode) + macro (ADD_H5_ERR_TEST resultfile resultcode result_errcheck) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5LS-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) @@ -193,8 +193,9 @@ -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.ls" - -D "TEST_ERRREF=${resultfile}.err" - -P "${HDF_RESOURCES_DIR}/runTest.cmake" + -D "TEST_ERRREF=${result_errcheck}" + -D "TEST_SKIP_COMPARE=true" + -P "${HDF_RESOURCES_DIR}/grepTest.cmake" ) endif () set_tests_properties (H5LS-${resultfile} PROPERTIES @@ -264,7 +265,7 @@ # test for displaying groups # The following combination of arguments is expected to return an error message # and return value 1 - ADD_H5_ERR_TEST (tgroup-1 1 -w80 -r -g tgroup.h5) + ADD_H5_ERR_TEST (tgroup-1 1 "option not compatible" -w80 -r -g tgroup.h5) ADD_H5_TEST (tgroup-2 0 -w80 -g tgroup.h5/g1) # test for files with groups that have long comments @@ -305,7 +306,7 @@ # tests for no-dangling-links # if this option is given on dangling link, h5ls should return exit code 1 # when used alone , expect to print out help and return exit code 1 - ADD_H5_ERR_TEST (textlinksrc-nodangle-1 1 -w80 --no-dangling-links textlinksrc.h5) + ADD_H5_ERR_TEST (textlinksrc-nodangle-1 1 "no-dangling-links must be used" -w80 --no-dangling-links textlinksrc.h5) # external dangling link - expected exit code 1 ADD_H5_TEST (textlinksrc-nodangle-2 1 -w80 --follow-symlinks --no-dangling-links textlinksrc.h5) # soft dangling link - expected exit code 1 @@ -367,7 +368,7 @@ endif () # test for non-existing file - ADD_H5_ERR_TEST (nosuchfile 1 nosuchfile.h5) + ADD_H5_ERR_TEST (nosuchfile 1 "unable to open file" nosuchfile.h5) # test for variable length data types in verbose mode if (H5_WORDS_BIGENDIAN) diff --git a/tools/test/misc/CMakeTestsClear.cmake b/tools/test/misc/CMakeTestsClear.cmake index cfe237d6017..aead4c5b8b1 100644 --- a/tools/test/misc/CMakeTestsClear.cmake +++ b/tools/test/misc/CMakeTestsClear.cmake @@ -112,7 +112,7 @@ endif () endmacro () - macro (ADD_H5_ERR_CMP testname resultfile resultcode) + macro (ADD_H5_ERR_CMP testname resultfile resultcode result_errcheck) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5CLEAR_CMP-${testname} @@ -124,8 +124,9 @@ -D "TEST_OUTPUT=${testname}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.mty" - -D "TEST_ERRREF=${resultfile}.err" - -P "${HDF_RESOURCES_DIR}/runTest.cmake" + -D "TEST_ERRREF=${result_errcheck}" + -D "TEST_SKIP_COMPARE=true" + -P "${HDF_RESOURCES_DIR}/grepTest.cmake" ) if ("H5CLEAR_CMP-${testname}" MATCHES "${HDF5_DISABLE_TESTS_REGEX}") set_tests_properties (H5CLEAR_CMP-${testname} PROPERTIES DISABLED true) @@ -443,11 +444,11 @@ ADD_H5_CMP (h5clr_usage_junk h5clear_usage 1 "" junk.h5) ADD_H5_CMP (h5clr_usage_none h5clear_usage 1 "" orig_h5clear_sec2_v3.h5) ADD_H5_CMP (h5clr_missing_file_m h5clear_missing_file 1 "-m") - ADD_H5_ERR_CMP (h5clr_open_fail_s h5clear_open_fail 1 "-s" junk.h5) + ADD_H5_ERR_CMP (h5clr_open_fail_s h5clear_open_fail 1 "h5clear error" "-s" junk.h5) ADD_H5_CMP (h5clr_missing_file_ms h5clear_missing_file 1 "-m" "-s") - ADD_H5_ERR_CMP (h5clr_open_fail_ms h5clear_open_fail 1 "-m" "-s" junk.h5) - ADD_H5_ERR_CMP (h5clr_no_mdc_image_m h5clear_no_mdc_image 0 "-m" orig_h5clear_sec2_v2.h5) - ADD_H5_ERR_CMP (h5clr_no_mdc_image_ms h5clear_no_mdc_image 0 "-s" "-m" orig_h5clear_sec2_v0.h5) + ADD_H5_ERR_CMP (h5clr_open_fail_ms h5clear_open_fail 1 "h5clear error" "-m" "-s" junk.h5) + ADD_H5_ERR_CMP (h5clr_no_mdc_image_m h5clear_no_mdc_image 0 "h5clear warning" "-m" orig_h5clear_sec2_v2.h5) + ADD_H5_ERR_CMP (h5clr_no_mdc_image_ms h5clear_no_mdc_image 0 "h5clear warning" "-s" "-m" orig_h5clear_sec2_v0.h5) # # # @@ -478,8 +479,8 @@ # # # h5clear_mdc_image.h5 already has cache image removed earlier, verify the expected warning from h5clear: - ADD_H5_ERR_CMP (h5clr_mdc_image_m h5clear_no_mdc_image 0 "-m" mod_h5clear_mdc_image.h5) - ADD_H5_ERR_CMP (h5clr_mdc_image_sm h5clear_no_mdc_image 0 "-s" "-m" mod_h5clear_mdc_image2.h5) + ADD_H5_ERR_CMP (h5clr_mdc_image_m h5clear_no_mdc_image 0 "h5clear warning" "-m" mod_h5clear_mdc_image.h5) + ADD_H5_ERR_CMP (h5clr_mdc_image_sm h5clear_no_mdc_image 0 "h5clear warning" "-s" "-m" mod_h5clear_mdc_image2.h5) # # #