From 021d36afd9279be34ed41cbadb44632e6bd5b83f Mon Sep 17 00:00:00 2001 From: mattjala <124107509+mattjala@users.noreply.github.com> Date: Mon, 26 Aug 2024 13:29:13 -0500 Subject: [PATCH] Remove early test exit (#4757) * Don't skip file tests * Remove test with invalid flag for H5Fopen * Verify that create/open of unseekable file fails * Remove failure verification --- test/tfile.c | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/test/tfile.c b/test/tfile.c index f93051e6aff..721b8d2b656 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -8103,45 +8103,38 @@ test_min_dset_ohdr(void) /**************************************************************** ** ** test_unseekable_file(): -** Test that attempting to open an unseekable file fails gracefully +** Test that attempting to create/open an unseekable file fails gracefully ** without a segfault (see hdf5#1498) ****************************************************************/ static void test_unseekable_file(void) { - hid_t file_id = H5I_INVALID_HID; /* File ID */ - /* Output message about test being performed */ MESSAGE(5, ("Testing creating/opening an unseekable file\n")); - /* Creation */ -#ifdef H5_HAVE_WIN32_API - file_id = H5Fcreate("NUL", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); -#else - file_id = H5Fcreate("/dev/null", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); -#endif - - H5Fclose(file_id); + /* Flush message in case this test segfaults */ + fflush(stdout); - /* Open, truncate */ + /* Creation */ #ifdef H5_HAVE_WIN32_API - file_id = H5Fopen("NUL", H5F_ACC_TRUNC, H5P_DEFAULT); + H5Fcreate("NUL", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); #else - file_id = H5Fopen("/dev/null", H5F_ACC_TRUNC, H5P_DEFAULT); + H5Fcreate("/dev/null", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); #endif - H5Fclose(file_id); + /* Should fail without segfault */ + /* TODO - Does not properly fail on all systems */ + /* VERIFY(file_id, H5I_INVALID_HID, "H5Fcreate"); */ - /* Open, RDWR */ + /* Opening */ #ifdef H5_HAVE_WIN32_API - file_id = H5Fopen("NUL", H5F_ACC_RDWR, H5P_DEFAULT); + H5Fopen("NUL", H5F_ACC_RDWR, H5P_DEFAULT); #else - file_id = H5Fopen("/dev/null", H5F_ACC_RDWR, H5P_DEFAULT); + H5Fopen("/dev/null", H5F_ACC_RDWR, H5P_DEFAULT); #endif - H5Fclose(file_id); - - exit(EXIT_SUCCESS); + /* TODO - Does not properly fail on all systems */ + /* VERIFY(file_id, H5I_INVALID_HID, "H5Fopen"); */ } /**************************************************************** **