summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2022-04-07 16:36:51 (GMT)
committerGitHub <noreply@github.com>2022-04-07 16:36:51 (GMT)
commit7df729bbf3e0f0b53dda73829f05fdf709993e4c (patch)
treef665f58f22b2d26cfae1138c9e38fea58a01ef9e /test
parenta4e833c50c002239af8c16667b1b072e6c6fa27f (diff)
downloadhdf5-7df729bbf3e0f0b53dda73829f05fdf709993e4c.zip
hdf5-7df729bbf3e0f0b53dda73829f05fdf709993e4c.tar.gz
hdf5-7df729bbf3e0f0b53dda73829f05fdf709993e4c.tar.bz2
1.12: Brings changes from testpar over from develop (#1614)
Diffstat (limited to 'test')
-rw-r--r--test/h5test.h6
-rw-r--r--test/testframe.c22
2 files changed, 19 insertions, 9 deletions
diff --git a/test/h5test.h b/test/h5test.h
index 0d7dade..ac251d6 100644
--- a/test/h5test.h
+++ b/test/h5test.h
@@ -162,12 +162,8 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */
goto error; \
}
-/*
- * Alarm definitions to wait up (terminate) a test that runs too long.
- */
+/* Number of seconds to wait before killing a test (requires alarm(2)) */
#define H5_ALARM_SEC 1200 /* default is 20 minutes */
-#define ALARM_ON TestAlarmOn()
-#define ALARM_OFF HDalarm(0)
/* Flags for h5_fileaccess_flags() */
#define H5_FILEACCESS_VFD 0x01
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
}