Skip to content

Commit

Permalink
WIP: Fix unseekable file test on Cygwin
Browse files Browse the repository at this point in the history
  • Loading branch information
mattjala committed Sep 3, 2024
1 parent a08e534 commit 5f55b31
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cyg-ninja-sh-ompi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ jobs:
-D BUILD_SHARED_LIBS:BOOL=OFF \
-D CTEST_DROP_SITE_INIT:STRING="my.cdash.org" \
..
ctest -D Experimental
ctest -D Experimental --output-on-failure -VV
shell: C:\cygwin\bin\bash.exe -eo pipefail -o igncr '{0}'
3 changes: 3 additions & 0 deletions config/cmake/H5pubconf.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
/* Define if using MinGW */
#cmakedefine H5_HAVE_MINGW @H5_HAVE_MINGW@

/* Define if using Cygwin */
#cmakedefine H5_HAVE_CYGWIN @CYGWIN@

/* Define if on the Windows platform and using the Win32 API */
#cmakedefine H5_HAVE_WIN32_API @H5_HAVE_WIN32_API@

Expand Down
27 changes: 20 additions & 7 deletions test/tfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -8110,32 +8110,45 @@ test_min_dset_ohdr(void)
static void
test_unseekable_file(void)
{
hid_t file_id = H5I_INVALID_HID;

/* Output message about test being performed */
MESSAGE(5, ("Testing creating/opening an unseekable file\n"));
MESSAGE(0, ("Testing creating/opening an unseekable file\n"));
#ifdef H5_HAVE_WIN32_API
MESSAGE(0, (" Have win32 API"));
#else
MESSAGE(0, (" Don't have win32 API"));
#endif

#ifdef H5_HAVE_CYGWIN
MESSAGE(0, (" Have CYGWIN"));
#endif

#ifdef __CYGWIN__
MESSAGE(0, (" Have __CYGWIN__"));
#endif

/* Flush message in case this test segfaults */
fflush(stdout);

/* Creation */
#ifdef H5_HAVE_WIN32_API
#if (defined(H5_HAVE_WIN32_API) && !defined(H5_HAVE_CYGWIN))
H5Fcreate("NUL", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
#else
H5Fcreate("/dev/null", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
#endif

/* Should fail without segfault */
/* TODO - Does not properly fail on all systems */
/* VERIFY(file_id, H5I_INVALID_HID, "H5Fcreate"); */
VERIFY(file_id, H5I_INVALID_HID, "H5Fcreate");

/* Opening */
#ifdef H5_HAVE_WIN32_API
#if (defined(H5_HAVE_WIN32_API) && !defined(H5_HAVE_CYGWIN))
H5Fopen("NUL", H5F_ACC_RDWR, H5P_DEFAULT);
#else
H5Fopen("/dev/null", H5F_ACC_RDWR, H5P_DEFAULT);
#endif

/* TODO - Does not properly fail on all systems */
/* VERIFY(file_id, H5I_INVALID_HID, "H5Fopen"); */
VERIFY(file_id, H5I_INVALID_HID, "H5Fopen");
}
/****************************************************************
**
Expand Down

0 comments on commit 5f55b31

Please sign in to comment.