diff options
author | jhendersonHDF <jhenderson@hdfgroup.org> | 2023-05-02 19:52:39 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-02 19:52:39 (GMT) |
commit | f8a1b3ceec485829ccdd3034ef2be68029f1a66e (patch) | |
tree | 5563ca3059b8cbda43f7f1e0ffedf7985f71a4bc /test/h5test.h | |
parent | 41fd8e66a9f837a1adf36a0253e29440d82ff522 (diff) | |
download | hdf5-f8a1b3ceec485829ccdd3034ef2be68029f1a66e.zip hdf5-f8a1b3ceec485829ccdd3034ef2be68029f1a66e.tar.gz hdf5-f8a1b3ceec485829ccdd3034ef2be68029f1a66e.tar.bz2 |
Add initial version of HDF5 API tests (#2877)
Diffstat (limited to 'test/h5test.h')
-rw-r--r-- | test/h5test.h | 72 |
1 files changed, 71 insertions, 1 deletions
diff --git a/test/h5test.h b/test/h5test.h index ea7ab4d..b2c2cda 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -106,21 +106,25 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */ do { \ HDprintf("Testing %-62s", WHAT); \ HDfflush(stdout); \ + n_tests_run_g++; \ } while (0) #define TESTING_2(WHAT) \ do { \ HDprintf(" Testing %-60s", WHAT); \ HDfflush(stdout); \ + n_tests_run_g++; \ } while (0) #define PASSED() \ do { \ HDputs(" PASSED"); \ HDfflush(stdout); \ + n_tests_passed_g++; \ } while (0) #define H5_FAILED() \ do { \ HDputs("*FAILED*"); \ HDfflush(stdout); \ + n_tests_failed_g++; \ } while (0) #define H5_WARNING() \ do { \ @@ -131,6 +135,7 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */ do { \ HDputs(" -SKIP-"); \ HDfflush(stdout); \ + n_tests_skipped_g++; \ } while (0) #define PUTS_ERROR(s) \ do { \ @@ -164,6 +169,66 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */ goto error; \ } while (0) +/* + * Testing macros used for multi-part tests. + */ +#define TESTING_MULTIPART(WHAT) \ + do { \ + HDprintf("Testing %-62s", WHAT); \ + HDputs(""); \ + HDfflush(stdout); \ + } while (0) + +/* + * Begin and end an entire section of multi-part tests. By placing all the + * parts of a test between these macros, skipping to the 'error' cleanup + * section of a test is deferred until all parts have finished. + */ +#define BEGIN_MULTIPART \ + { \ + int part_nerrors = 0; + +#define END_MULTIPART \ + if (part_nerrors > 0) \ + goto error; \ + } + +/* + * Begin, end and handle errors within a single part of a multi-part test. + * The PART_END macro creates a goto label based on the given "part name". + * When a failure occurs in the current part, the PART_ERROR macro uses + * this label to skip to the next part of the multi-part test. The PART_ERROR + * macro also increments the error count so that the END_MULTIPART macro + * knows to skip to the test's 'error' label once all test parts have finished. + */ +#define PART_BEGIN(part_name) { +#define PART_END(part_name) \ + } \ + part_##part_name##_end: +#define PART_ERROR(part_name) \ + do { \ + n_tests_failed_g++; \ + part_nerrors++; \ + goto part_##part_name##_end; \ + } while (0) +#define PART_TEST_ERROR(part_name) \ + do { \ + H5_FAILED(); \ + AT(); \ + part_nerrors++; \ + goto part_##part_name##_end; \ + } while (0) + +/* + * Simply skips to the goto label for this test part and moves on to the + * next test part. Useful for when a test part needs to be skipped for + * some reason or is currently unimplemented and empty. + */ +#define PART_EMPTY(part_name) \ + do { \ + goto part_##part_name##_end; \ + } while (0) + /* Number of seconds to wait before killing a test (requires alarm(2)) */ #define H5_ALARM_SEC 1200 /* default is 20 minutes */ @@ -285,7 +350,12 @@ H5TEST_DLL char *getenv_all(MPI_Comm comm, int root, const char *name); #endif /* Extern global variables */ -H5TEST_DLLVAR int TestVerbosity; +H5TEST_DLLVAR int TestVerbosity; +H5TEST_DLLVAR size_t n_tests_run_g; +H5TEST_DLLVAR size_t n_tests_passed_g; +H5TEST_DLLVAR size_t n_tests_failed_g; +H5TEST_DLLVAR size_t n_tests_skipped_g; +H5TEST_DLLVAR uint64_t vol_cap_flags_g; H5TEST_DLL void h5_send_message(const char *file, const char *arg1, const char *arg2); H5TEST_DLL herr_t h5_wait_message(const char *file); |