summaryrefslogtreecommitdiffstats
path: root/test/testframe.c
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2021-06-29 04:59:25 (GMT)
committerGitHub <noreply@github.com>2021-06-29 04:59:25 (GMT)
commit4ff544f9977da3bd54eac03cc124961eea7c4daf (patch)
treed23a3d50fbeb2c1eca882db4d48726173f25097c /test/testframe.c
parent734d317da9c759799c92ff47e05e3be7e3e969a9 (diff)
downloadhdf5-4ff544f9977da3bd54eac03cc124961eea7c4daf.zip
hdf5-4ff544f9977da3bd54eac03cc124961eea7c4daf.tar.gz
hdf5-4ff544f9977da3bd54eac03cc124961eea7c4daf.tar.bz2
Cleans up POSIX/C bits in H5private.h (#804)
* Cleans up POSIX/C bits in H5private.h * Assume difftime exists (C89) * Reorg AC_CHECK_HEADERS so headers are in alphabetical order * Split off networking-related AC_CHECK_HEADERS * Remove unused UNAME_CYGWIN from configure.ac * Remove checks for unused sys/timeb.h * Tidying pass over H5private.h HD prefix macros * Tidy H5win32defs.h * Add HD prefix to various scanf calls * Committing clang-format changes * Fixes to the alarm(2) code used in the tests to make Windows happy Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'test/testframe.c')
-rw-r--r--test/testframe.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/test/testframe.c b/test/testframe.c
index f805997..d3f0211 100644
--- a/test/testframe.c
+++ b/test/testframe.c
@@ -320,9 +320,9 @@ PerformTests(void)
MESSAGE(5, ("===============================================\n"));
Test[Loop].NumErrors = num_errs;
Test_parameters = Test[Loop].Parameters;
- ALARM_ON;
+ TestAlarmOn();
Test[Loop].Call();
- ALARM_OFF;
+ TestAlarmOff();
Test[Loop].NumErrors = num_errs - Test[Loop].NumErrors;
MESSAGE(5, ("===============================================\n"));
MESSAGE(5, ("There were %d errors detected.\n\n", (int)Test[Loop].NumErrors));
@@ -620,12 +620,15 @@ SetTest(const char *testname, int action)
}
}
-/*
- * Enable alarm on test execution, configurable by environment variable
+/* Enable a test timer that will kill long-running tests, the time is configurable
+ * via an environment variable.
+ *
+ * Only useful on POSIX systems where alarm(2) is present.
*/
void
TestAlarmOn(void)
{
+#ifdef H5_HAVE_ALARM
char * env_val = HDgetenv("HDF5_ALARM_SECONDS"); /* Alarm environment */
unsigned long alarm_sec = H5_ALARM_SEC; /* Number of seconds before alarm goes off */
@@ -635,4 +638,15 @@ TestAlarmOn(void)
/* Set the number of seconds before alarm goes off */
HDalarm((unsigned)alarm_sec);
+#endif
+}
+
+/* Disable the test timer */
+void
+TestAlarmOff(void)
+{
+#ifdef H5_HAVE_ALARM
+ /* Set the number of seconds to zero */
+ HDalarm(0);
+#endif
}