diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2023-03-20 20:00:06 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-20 20:00:06 (GMT) |
commit | b766e5f96f26805e8c92e718a05f42d073912711 (patch) | |
tree | 0b7c992bc24581608d308428e25b0f93e86bdd61 /test | |
parent | 1ffaa38174b0f784b7ed6a471f40bf0e749ceac3 (diff) | |
download | hdf5-b766e5f96f26805e8c92e718a05f42d073912711.zip hdf5-b766e5f96f26805e8c92e718a05f42d073912711.tar.gz hdf5-b766e5f96f26805e8c92e718a05f42d073912711.tar.bz2 |
Normalize platform-independence code w/ develop (#2615)
* Normalize platform-independence code w/ develop
* Use C99 types and functions in lieu of C89 work-arounds
* Align key files with develop
- H5public.h
- H5private.h
- H5system.c
- H5win32defs.h
* Minor fixes elsewhere to support changes in above files
* Incidentally brings Fortran mod directory settings file change over
This does NOT change the configure/build files. Those will still do the
checks needed for the C89 work-around cruft until the perf and perform
code gets cleaned up.
* Add C++98 fixes
* Explicitly set -std=c++98 in Autotools
* Do not include cstdlib in H5public.h (requires C++11)
* Remove redundant stdbool.h include
* Fix alarm issues on Windows
* Bring parallel alarm() changes from develop
Diffstat (limited to 'test')
-rw-r--r-- | test/h5test.h | 6 | ||||
-rw-r--r-- | test/testframe.c | 22 | ||||
-rw-r--r-- | test/testhdf5.h | 4 |
3 files changed, 21 insertions, 11 deletions
diff --git a/test/h5test.h b/test/h5test.h index 099d3c0..e472885 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -161,12 +161,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 bc7ba0d..9bcccd1 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; - 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)); @@ -632,12 +632,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 */ @@ -647,4 +650,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 } diff --git a/test/testhdf5.h b/test/testhdf5.h index 67b38e0..8abe890 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__, (ret)); \ + __FILE__, ((const void *)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__, (ret)); \ + __FILE__, ((const void *)ret)); \ } \ if (ret) { \ TestErrPrintf("*** UNEXPECTED RETURN from %s is not NULL line %4d in %s\n", (where), \ |