summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2021-03-17 19:23:07 (GMT)
committerGitHub <noreply@github.com>2021-03-17 19:23:07 (GMT)
commitd0f807527f9aed62643254afb69e1889eac3390e (patch)
tree62ec9a04916e482be6492c835b2b13b86dbb967a /test
parent00a4e41ea4cb09bd4476565cfc550ea715435a91 (diff)
downloadhdf5-d0f807527f9aed62643254afb69e1889eac3390e.zip
hdf5-d0f807527f9aed62643254afb69e1889eac3390e.tar.gz
hdf5-d0f807527f9aed62643254afb69e1889eac3390e.tar.bz2
Suppresses the tcheck_version test's abort dialog on Windows (#477)
* Suppresses the tcheck_version test's abort dialog on Windows Windows raises a modal abort/retry/ignore dialog box when CRT calls abort(). This change installs a report hook that suppresses the dialog so that the CMake tests don't time out waiting for a nonexistent user to click a dialog box. * Committing clang-format changes * Removes __cdecl from callback Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'test')
-rw-r--r--test/tcheck_version.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/tcheck_version.c b/test/tcheck_version.c
index 49c86c2..bfc8daf 100644
--- a/test/tcheck_version.c
+++ b/test/tcheck_version.c
@@ -29,6 +29,10 @@
#include "h5test.h"
+#ifdef H5_HAVE_WIN32_API
+#include <crtdbg.h>
+#endif
+
#define progname "tcheck_version"
/* prototypes */
@@ -108,12 +112,31 @@ abort_intercept(int H5_ATTR_UNUSED sig)
HDexit(6);
}
+#ifdef H5_HAVE_WIN32_API
+/* Turns off the modal dialog that is raised when the Windows CRT calls abort().
+ *
+ * Returning TRUE here lets Windows know that we've handled the abort() and that there
+ * is no need to alert the user with a modal dialog box.
+ */
+int
+handle_crt_abort(int reportType, char *message, int *returnValue)
+{
+ return TRUE;
+}
+#endif
+
int
main(int ac, char **av)
{
+#ifdef H5_HAVE_WIN32_API
+ (void)_CrtSetReportHook2(_CRT_RPTHOOK_INSTALL, handle_crt_abort);
+#endif
parse(ac, av);
HDsignal(SIGABRT, &abort_intercept);
H5check_version(major, minor, release);
HDsignal(SIGABRT, SIG_DFL);
+#ifdef H5_HAVE_WIN32_API
+ (void)_CrtSetReportHook2(_CRT_RPTHOOK_REMOVE, handle_crt_abort);
+#endif
return 0;
}