Skip to content

Move h5repacktst file generation to h5repackgentest #5564

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 9 commits into
base: develop
Choose a base branch
from

Conversation

mattjala
Copy link
Contributor

@mattjala mattjala commented Jun 3, 2025

  • For consistency with other tools tests, move h5repacktst file generation into h5repackgentest

This is motivated primarily by the need to be able to generate the h5repacktst files for h5repack VOL tests.

Depends on #5622

@mattjala mattjala added the Priority - 2. Medium It would be nice to have this in the next release label Jun 3, 2025
@mattjala mattjala added the Component - Tools Command-line tools like h5dump, includes high-level tools label Jun 3, 2025
@mattjala mattjala added the Component - Testing Code in test or testpar directories, GitHub workflows label Jun 3, 2025
@github-project-automation github-project-automation bot moved this to To be triaged in HDF5 - TRIAGE & TRACK Jun 3, 2025
*/
int
make_h5repack_testfiles(void)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These ~5,000 lines are just copied from h5repacktst.c and don't need to be closely inspected


#define MAX_NAME_SIZE 256
#define PAGE_SIZE_DEFAULT 4096
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

h5repacktst originally used FS_PAGESIZE_DEF from h5repack.h. To avoid using h5repack internal symbols, we define a different symbol here with the same value.

int verify_userblock(const char *filename);

/* fill value test */
#define H5REPACK_FNAME0 "h5repack_fill.h5"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These symbols are shared between h5repackgentest.c and h5repacktst.c

@mattjala mattjala marked this pull request as draft June 6, 2025 14:31
@mattjala
Copy link
Contributor Author

mattjala commented Jun 6, 2025

Marked as draft until I fix build issues on Windows

@mattjala mattjala force-pushed the h5repacktst_no_gen branch from da59399 to 22f9b77 Compare June 6, 2025 19:21
@mattjala mattjala marked this pull request as ready for review June 6, 2025 19:21
@nbagha1 nbagha1 added this to the Release 2.0.0 milestone Jun 10, 2025
@nbagha1 nbagha1 moved this from To be triaged to In progress in HDF5 - TRIAGE & TRACK Jun 10, 2025
@mattjala mattjala requested a review from Copilot June 11, 2025 16:26
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR centralizes the generation of h5repacktst files into the h5repackgentest generator, and updates CMake to only build dependent tests when generators are enabled.

  • Declare and implement make_h5repack_testfiles in h5repackgentest.h and call it from the generic test driver
  • Add filename macros for all repack test cases in h5repackgentest.h
  • Guard VFD-based and h5repack tests in CMake on HDF5_BUILD_GENERATORS and link the new generator library

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tools/test/h5repack/h5repackgentest.h Add make_h5repack_testfiles declaration and new test filename macros
tools/test/h5repack/CMakeVFDTests.cmake Wrap VFD tests in an if(HDF5_BUILD_GENERATORS) guard
tools/test/h5repack/CMakeLists.txt Conditionally add and link h5repackgentest under generators flag
tools/test/h5gentest.c Invoke make_h5repack_testfiles() in gen_h5repack_files
tools/test/CMakeLists.txt Link generator tests against ${HDF5_TEST_LIB_TARGET} under generators flag
Comments suppressed due to low confidence (1)

tools/test/h5repack/h5repackgentest.h:23

  • [nitpick] The function name make_h5repack_testfiles is inconsistent with the existing generate_* prefix. Consider renaming it to generate_h5repack_testfiles for consistency.
int make_h5repack_testfiles(void);

bmribler
bmribler previously approved these changes Jun 12, 2025
vchoi-hdfgroup
vchoi-hdfgroup previously approved these changes Jun 17, 2025
@mattjala mattjala dismissed stale reviews from vchoi-hdfgroup and bmribler via 566e70b June 17, 2025 18:04
@mattjala mattjala force-pushed the h5repacktst_no_gen branch from 83db2a9 to 566e70b Compare June 17, 2025 18:04
add_executable (h5repacktest ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/h5repacktst.c)
target_include_directories (h5repacktest
PRIVATE "${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR};${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_TEST_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
)
if (BUILD_STATIC_LIBS)
Copy link
Collaborator

@jhendersonHDF jhendersonHDF Jun 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is an issue where we need to determine the full purpose of HDF5_BUILD_STATIC_TOOLS and align between it and BUILD_STATIC_LIBS. Since this is a regular test program, it should probably be using BUILD_STATIC_LIBS as before rather than HDF5_BUILD_STATIC_TOOLS. But, when it comes time to link against the tools library we need to check HDF5_BUILD_STATIC_TOOLS to link against the correct one (though we should probably solve this higher up and just give lower level CMake code a single target to link against unconditionally).

TARGET_C_PROPERTIES (h5repacktest STATIC)
target_link_libraries (h5repacktest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
target_link_libraries (h5repacktest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} h5repackgentest)
Copy link
Collaborator

@jhendersonHDF jhendersonHDF Jun 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the tool gentest object libraries are currently only built when HDF5_BUILD_GENERATORS is ON, this linking step fails when it's OFF. I'm guessing the reason it passes in most of the workflows is because they use the cacheinit file which sets that ON by default. I would generally like to avoid the requirement of HDF5_BUILD_GENERATORS=ON in cases where we don't need it, but this PR seems like it will need that, even for regular non-VOL testing. Maybe we need to decide if the HDF5_BUILD_GENERATORS option is still useful or if we should just always build the generators? Or maybe we should always build the generator libraries but only build the generator binaries when HDF5_BUILD_GENERATORS=ON.

Copy link
Collaborator

@jhendersonHDF jhendersonHDF left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CMake logic needs re-worked when it comes to the HDF5_BUILD_GENERATORS option, as these changes will currently fail to link when it's OFF. CI isn't catching this, likely due to the cacheinit file.

@mattjala
Copy link
Contributor Author

mattjala commented Jun 20, 2025

It would be nice to remove h5repacktst entirely since it's superseded by the h5repack CMake tests, but the VFD tests for h5repack still use the script. h5repacktst can still be removed, but it will require some substantial modification to the h5repack tests not dissimilar to the changes needed to set up VOL testing. For now, I think we should leave the script in - reworking h5repack VFD testing should be considered separately.

Marking this as draft since it depends on #5622

@mattjala mattjala marked this pull request as draft June 20, 2025 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component - Testing Code in test or testpar directories, GitHub workflows Component - Tools Command-line tools like h5dump, includes high-level tools Priority - 2. Medium It would be nice to have this in the next release
Projects
Status: In progress
Development

Successfully merging this pull request may close these issues.

5 participants