Skip to content
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

Minor refactoring of testframe.c testing framework #4930

Merged

Conversation

jhendersonHDF
Copy link
Collaborator

Added setup and cleanup callback parameters to TestInit() to perform setup and cleanup tasks once for whole test program

Removed TestCleanup() function since its functionality is covered by PerformTests()

Added check of the HDF5_NOCLEANUP environment variable in GetTestCleanup()

@jhendersonHDF jhendersonHDF added Merge - To 1.14 Priority - 3. Low 🔽 Code cleanup, small feature change requests, etc. Component - Testing Code in test or testpar directories, GitHub workflows Type - Task Actions that don't fit into any other type category labels Oct 4, 2024
@jhendersonHDF
Copy link
Collaborator Author

A few minor follow-on changes from comments in #4891

PerformTests(void)
{
for (unsigned Loop = 0; Loop < TestCount; Loop++) {
int old_num_errs = TestNumErrs_g;

if (TestArray[Loop].TestSkipFlag) {
if (TestFrameworkProcessID_g == 0)
MESSAGE(2, ("Skipping -- %s (%s) \n", TestArray[Loop].Description, TestArray[Loop].Name));
MESSAGE(2, ("Skipping -- %s (%s) \n", TestArray[Loop].Description, TestArray[Loop].Name));
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The MESSAGE macro includes the check for TestFrameworkProcessID_g of 0

* Perform test cleanup
*/
void
TestCleanup(void)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

TestCleanup() was only used in a few places and is covered entirely by PerformTests() now

@@ -180,15 +197,16 @@ extern "C" {
*
*/
H5TEST_DLL herr_t TestInit(const char *ProgName, void (*TestPrivateUsage)(FILE *stream),
int (*TestPrivateParser)(int argc, char *argv[]), int TestProcessID);
int (*TestPrivateParser)(int argc, char *argv[]), herr_t (*TestSetupFunc)(void),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added a run-once setup and cleanup callback for the whole test program. The setup callback is called as part of TestInit() to initialize state as soon as possible and the cleanup callback is called by TestShutdown() to keep the state around as long as possible (for test post-processing or similar).

@jhendersonHDF jhendersonHDF force-pushed the feature/test_framework_refactor branch from d3a27ff to cfb0ae9 Compare October 4, 2024 21:01
Added setup and cleanup callback parameters to TestInit() to perform
setup and cleanup tasks once for whole test program

Removed TestCleanup() function since its functionality is covered by
PerformTests()

Added check of the HDF5_NOCLEANUP environment variable in
GetTestCleanup()
@lrknox lrknox merged commit 302ba0a into HDFGroup:develop Oct 7, 2024
60 checks passed
lrknox pushed a commit to lrknox/hdf5 that referenced this pull request Oct 9, 2024
Added setup and cleanup callback parameters to TestInit() to perform
setup and cleanup tasks once for whole test program

Removed TestCleanup() function since its functionality is covered by
PerformTests()

Added check of the HDF5_NOCLEANUP environment variable in
GetTestCleanup()
lrknox pushed a commit that referenced this pull request Oct 10, 2024
Added setup and cleanup callback parameters to TestInit() to perform
setup and cleanup tasks once for whole test program

Removed TestCleanup() function since its functionality is covered by
PerformTests()

Added check of the HDF5_NOCLEANUP environment variable in
GetTestCleanup()
lrknox pushed a commit to lrknox/hdf5 that referenced this pull request Oct 10, 2024
Added setup and cleanup callback parameters to TestInit() to perform
setup and cleanup tasks once for whole test program

Removed TestCleanup() function since its functionality is covered by
PerformTests()

Added check of the HDF5_NOCLEANUP environment variable in
GetTestCleanup()
lrknox pushed a commit that referenced this pull request Oct 11, 2024
Added setup and cleanup callback parameters to TestInit() to perform
setup and cleanup tasks once for whole test program

Removed TestCleanup() function since its functionality is covered by
PerformTests()

Added check of the HDF5_NOCLEANUP environment variable in
GetTestCleanup()
@jhendersonHDF jhendersonHDF deleted the feature/test_framework_refactor branch October 30, 2024 20:49
jhendersonHDF added a commit to LifeboatLLC/hdf5_lifeboat that referenced this pull request Dec 24, 2024
Added setup and cleanup callback parameters to TestInit() to perform
setup and cleanup tasks once for whole test program

Removed TestCleanup() function since its functionality is covered by
PerformTests()

Added check of the HDF5_NOCLEANUP environment variable in
GetTestCleanup()
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 Priority - 3. Low 🔽 Code cleanup, small feature change requests, etc. Type - Task Actions that don't fit into any other type category
Projects
Status: Needs Merged
Development

Successfully merging this pull request may close these issues.

6 participants