Skip to content

Commit

Permalink
moved file cleanup to tests proper
Browse files Browse the repository at this point in the history
  • Loading branch information
brtnfld committed Jul 1, 2024
1 parent 32e16d5 commit bf3681b
Showing 1 changed file with 12 additions and 20 deletions.
32 changes: 12 additions & 20 deletions test/API/H5_api_object_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -4196,6 +4196,7 @@ test_object_copy_between_files(void)
hid_t attr_space_id = H5I_INVALID_HID;
hid_t space_id = H5I_INVALID_HID;
hid_t ocpypl_id = H5I_INVALID_HID;
char filename[H5_API_TEST_FILENAME_MAX_LENGTH];

TESTING_MULTIPART("object copying between files");

Expand Down Expand Up @@ -4749,6 +4750,10 @@ test_object_copy_between_files(void)
TEST_ERROR;
if (H5Fclose(file_id) < 0)
TEST_ERROR;
snprintf(filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix,
OBJECT_COPY_BETWEEN_FILES_TEST_FILE_NAME);
if (H5Fdelete(filename, H5P_DEFAULT) < 0)
TEST_ERROR;

PASSED();

Expand Down Expand Up @@ -5067,6 +5072,7 @@ test_object_visit(void)
hssize_t num_elems = 0;
size_t elem_size = 0;
char visit_filename[H5_API_TEST_FILENAME_MAX_LENGTH];
char filename[H5_API_TEST_FILENAME_MAX_LENGTH];

TESTING_MULTIPART("object visiting");

Expand Down Expand Up @@ -5708,6 +5714,12 @@ test_object_visit(void)
TEST_ERROR;
if (H5Fclose(file_id2) < 0)
TEST_ERROR;
snprintf(filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix,
OBJECT_VISIT_TEST_FILE_NAME);
if (H5Fdelete(filename, H5P_DEFAULT) < 0)
TEST_ERROR;
if (H5Fdelete(visit_filename, H5P_DEFAULT) < 0)
TEST_ERROR;

PASSED();

Expand Down Expand Up @@ -7363,23 +7375,6 @@ object_visit_noop_callback(hid_t o_id, const char *name, const H5O_info2_t *obje
return 0;
}

/*
* Cleanup temporary test files
*/
static void
cleanup_files(void)
{
char filename[H5_API_TEST_FILENAME_MAX_LENGTH];

snprintf(filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix,
OBJECT_COPY_BETWEEN_FILES_TEST_FILE_NAME);
H5Fdelete(filename, H5P_DEFAULT);

snprintf(filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix,
OBJECT_VISIT_TEST_FILE_NAME);
H5Fdelete(filename, H5P_DEFAULT);
}

int
H5_api_object_test(void)
{
Expand All @@ -7398,8 +7393,5 @@ H5_api_object_test(void)

printf("\n");

printf("Cleaning up testing files\n");
cleanup_files();

return nerrors;
}

0 comments on commit bf3681b

Please sign in to comment.