summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLarry Knox <lrknox@hdfgroup.org>2023-03-24 23:42:46 (GMT)
committerGitHub <noreply@github.com>2023-03-24 23:42:46 (GMT)
commit43e4e64d886e9072a6075c6369e84c0e273fa44f (patch)
treea65896c37e5af4919e8cb169c2b40c44ad07017e /test
parent3fa338013907494ccfe93b8e22d89185a39067ff (diff)
downloadhdf5-43e4e64d886e9072a6075c6369e84c0e273fa44f.zip
hdf5-43e4e64d886e9072a6075c6369e84c0e273fa44f.tar.gz
hdf5-43e4e64d886e9072a6075c6369e84c0e273fa44f.tar.bz2
1 10 revert 2615 (#2629)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'test')
-rw-r--r--test/h5test.h6
-rw-r--r--test/testframe.c22
-rw-r--r--test/testhdf5.h4
3 files changed, 11 insertions, 21 deletions
diff --git a/test/h5test.h b/test/h5test.h
index e472885..099d3c0 100644
--- a/test/h5test.h
+++ b/test/h5test.h
@@ -161,8 +161,12 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */
goto error; \
}
-/* Number of seconds to wait before killing a test (requires alarm(2)) */
+/*
+ * Alarm definitions to wait up (terminate) a test that runs too long.
+ */
#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 9bcccd1..bc7ba0d 100644
--- a/test/testframe.c
+++ b/test/testframe.c
@@ -319,9 +319,9 @@ PerformTests(void)
MESSAGE(5, ("===============================================\n"));
Test[Loop].NumErrors = num_errs;
Test_parameters = Test[Loop].Parameters;
- TestAlarmOn();
+ ALARM_ON;
Test[Loop].Call();
- TestAlarmOff();
+ ALARM_OFF;
Test[Loop].NumErrors = num_errs - Test[Loop].NumErrors;
MESSAGE(5, ("===============================================\n"));
MESSAGE(5, ("There were %d errors detected.\n\n", (int)Test[Loop].NumErrors));
@@ -632,15 +632,12 @@ SetTest(const char *testname, int action)
}
}
-/* 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.
+/*
+ * Enable alarm on test execution, configurable by environment variable
*/
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 */
@@ -650,15 +647,4 @@ 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
}
diff --git a/test/testhdf5.h b/test/testhdf5.h
index 8abe890..67b38e0 100644
--- a/test/testhdf5.h
+++ b/test/testhdf5.h
@@ -55,7 +55,7 @@
{ \
if (VERBOSE_HI) { \
print_func(" Call to routine: %15s at line %4d in %s returned %p\n", (where), (int)__LINE__, \
- __FILE__, ((const void *)ret)); \
+ __FILE__, (ret)); \
} \
if (!(ret)) { \
TestErrPrintf("*** UNEXPECTED RETURN from %s is NULL line %4d in %s\n", (where), (int)__LINE__, \
@@ -69,7 +69,7 @@
{ \
if (VERBOSE_HI) { \
print_func(" Call to routine: %15s at line %4d in %s returned %p\n", (where), (int)__LINE__, \
- __FILE__, ((const void *)ret)); \
+ __FILE__, (ret)); \
} \
if (ret) { \
TestErrPrintf("*** UNEXPECTED RETURN from %s is not NULL line %4d in %s\n", (where), \