summaryrefslogtreecommitdiffstats
path: root/test/h5test.h
diff options
context:
space:
mode:
Diffstat (limited to 'test/h5test.h')
-rw-r--r--test/h5test.h68
1 files changed, 65 insertions, 3 deletions
diff --git a/test/h5test.h b/test/h5test.h
index 23991ad..93cdf96 100644
--- a/test/h5test.h
+++ b/test/h5test.h
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Friday, November 20, 1998
*
* Purpose: Test support stuff.
@@ -103,7 +103,7 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */
*/
#define TESTING(WHAT) {HDprintf("Testing %-62s",WHAT); HDfflush(stdout);}
#define TESTING_2(WHAT) {HDprintf(" Testing %-60s",WHAT); HDfflush(stdout);}
-#define PASSED() {HDputs(" PASSED");HDfflush(stdout);}
+#define PASSED() do {HDputs(" PASSED");HDfflush(stdout);} while (0)
#define H5_FAILED() {HDputs("*FAILED*");HDfflush(stdout);}
#define H5_WARNING() {HDputs("*WARNING*");HDfflush(stdout);}
#define SKIPPED() {HDputs(" -SKIP-");HDfflush(stdout);}
@@ -124,6 +124,65 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */
/* Flags for h5_fileaccess_flags() */
#define H5_FILEACCESS_VFD 0x01
+/* Macros to create and fill 2D arrays with a single heap allocation.
+ * These can be used to replace large stack and global arrays which raise
+ * warnings.
+ *
+ * The macros make a single heap allocation large enough to hold all the
+ * pointers and the data elements. The first part of the allocation holds
+ * the pointers, and the second part holds the data as a contiguous block
+ * in row-major order.
+ *
+ * To pass the data block to calls like H5Dread(), pass a pointer to the
+ * first array element as the data pointer (e.g., array[0] in a 2D array).
+ *
+ * The fill macro just fills the array with an increasing count value.
+ *
+ * Usage:
+ *
+ * int **array;
+ *
+ * H5TEST_ALLOCATE_2D_ARRAY(array, int, 5, 10);
+ *
+ * H5TEST_FILL_2D_ARRAY(array, int, 5, 10);
+ *
+ * (do stuff)
+ *
+ * HDfree(array);
+ */
+#define H5TEST_ALLOCATE_2D_ARRAY(ARR, TYPE, DIMS_I, DIMS_J) \
+do { \
+ /* Prefix with h5taa to avoid shadow warnings */ \
+ size_t h5taa_pointers_size = 0; \
+ size_t h5taa_data_size = 0; \
+ int h5taa_i; \
+ \
+ h5taa_pointers_size = (DIMS_I) * sizeof(TYPE *); \
+ h5taa_data_size = (DIMS_I) * (DIMS_J) * sizeof(TYPE); \
+ \
+ ARR = (TYPE **)HDmalloc(h5taa_pointers_size + h5taa_data_size); \
+ \
+ ARR[0] = (TYPE *)(ARR + (DIMS_I)); \
+ \
+ for (h5taa_i = 1; h5taa_i < (DIMS_I); h5taa_i++) \
+ ARR[h5taa_i] = ARR[h5taa_i-1] + (DIMS_J); \
+} while(0)
+
+#define H5TEST_FILL_2D_ARRAY(ARR, TYPE, DIMS_I, DIMS_J) \
+do { \
+ /* Prefix with h5tfa to avoid shadow warnings */ \
+ int h5tfa_i = 0; \
+ int h5tfa_j = 0; \
+ TYPE h5tfa_count = 0; \
+ \
+ for (h5tfa_i = 0; h5tfa_i < (DIMS_I); h5tfa_i++) \
+ for (h5tfa_j = 0; h5tfa_j < (DIMS_J); h5tfa_j++) { \
+ ARR[h5tfa_i][h5tfa_j] = h5tfa_count; \
+ h5tfa_count++; \
+ } \
+} while(0)
+
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -146,7 +205,10 @@ H5TEST_DLL int print_func(const char *format, ...);
H5TEST_DLL int h5_make_local_copy(const char *origfilename, const char *local_copy_name);
H5TEST_DLL herr_t h5_verify_cached_stabs(const char *base_name[], hid_t fapl);
H5TEST_DLL H5FD_class_t *h5_get_dummy_vfd_class(void);
-H5TEST_DLL char *h5_get_version_string(H5F_libver_t libver);
+H5TEST_DLL const char *h5_get_version_string(H5F_libver_t libver);
+H5TEST_DLL int h5_compare_file_bytes(char *fname1, char *fname2);
+H5TEST_DLL int h5_duplicate_file_by_bytes(const char *orig, const char *dest);
+H5TEST_DLL herr_t h5_check_if_file_locking_enabled(hbool_t *are_enabled);
/* Functions that will replace components of a FAPL */
H5TEST_DLL herr_t h5_get_vfd_fapl(hid_t fapl_id);