summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2001-09-26 05:37:15 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2001-09-26 05:37:15 (GMT)
commit2612814874e843aedcba5848a6818b42d735365f (patch)
tree0f2cf41683dc18bbebf1235d158f2dca178d7358
parented663577a5394d34a0cfbe5cd5443af1f7957dc5 (diff)
downloadhdf5-2612814874e843aedcba5848a6818b42d735365f.zip
hdf5-2612814874e843aedcba5848a6818b42d735365f.tar.gz
hdf5-2612814874e843aedcba5848a6818b42d735365f.tar.bz2
[svn-r4474] Purpose:
New feature. Description: Added a test to verify the correctness of information provided by configure in H5config.h. Some information, such as SIZEOF some types can be hardcoded by config/<machine>. This test verified the information is indeed correct. Currenly, only size of C language types are verified. Platforms tested: Eirene, regular, arabica.
-rw-r--r--test/Makefile.in10
-rw-r--r--test/tconfig.c183
-rw-r--r--test/testhdf5.c1
-rw-r--r--test/testhdf5.h2
4 files changed, 191 insertions, 5 deletions
diff --git a/test/Makefile.in b/test/Makefile.in
index d07d708..15fdb4b 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -58,8 +58,8 @@ CLEAN=$(TIMINGS)
TEST_SRC=big.c bittests.c cmpd_dset.c dsets.c dtypes.c extend.c \
external.c fillval.c flush1.c flush2.c gheap.c h5test.c hyperslab.c \
- istore.c lheap.c links.c mount.c mtime.c ohdr.c \
- stab.c tarray.c tattr.c testhdf5.c testmeta.c tfile.c tgenprop.c th5s.c \
+ istore.c lheap.c links.c mount.c mtime.c ohdr.c stab.c tarray.c \
+ tattr.c tconfig.c testhdf5.c testmeta.c tfile.c tgenprop.c th5s.c \
titerate.c tmeta.c trefer.c tselect.c ttime.c ttbbt.c tvltypes.c tvlstr.c \
unlink.c enum.c ttsafe.c ttsafe_dcreate.c ttsafe_error.c ttsafe_cancel.c \
ttsafe_acreate.c gass_write.c gass_read.c gass_append.c dpss_read.c \
@@ -83,9 +83,9 @@ timings _timings: $(TIMINGS)
## How to build the tests... They all depend on the test and hdf5 libraries.
$(TEST_PROGS): $(LIB) $(LIBHDF5)
-TESTHDF5_OBJ=testhdf5.lo tarray.lo tattr.lo tfile.lo tgenprop.lo th5s.lo \
- titerate.lo tmeta.lo ttime.lo trefer.lo tselect.lo ttbbt.lo tvltypes.lo \
- tvlstr.lo
+TESTHDF5_OBJ=testhdf5.lo tarray.lo tattr.lo tconfig.lo tfile.lo tgenprop.lo \
+ th5s.lo titerate.lo tmeta.lo ttime.lo trefer.lo tselect.lo ttbbt.lo \
+ tvltypes.lo tvlstr.lo
TTS_OBJ=ttsafe.lo ttsafe_dcreate.lo ttsafe_error.lo ttsafe_cancel.lo \
ttsafe_acreate.lo
diff --git a/test/tconfig.c b/test/tconfig.c
new file mode 100644
index 0000000..256fed4
--- /dev/null
+++ b/test/tconfig.c
@@ -0,0 +1,183 @@
+/****************************************************************************
+ * NCSA HDF *
+ * Scientic Data Team *
+ * National Center for Supercomputing Applications *
+ * University of Illinois at Urbana-Champaign *
+ * 605 E. Springfield, Champaign IL 61820 *
+ * *
+ * For conditions of distribution and use, see the accompanying *
+ * COPYING file. *
+ * *
+ ****************************************************************************/
+
+/* $Id$ */
+
+/***********************************************************
+*
+* Test program: tconfig
+*
+* Test the definitions in the H5config.h as much as possible
+*
+*************************************************************/
+
+#include "hdf5.h"
+#include "H5private.h"
+#include "testhdf5.h"
+
+/* macros definitions */
+/* verify C type sizes */
+#define vrfy_ctype(ctype, ctype_macro) \
+ if (sizeof(ctype) != ctype_macro){ \
+ print_func("Error verfying %s expected: %d, got: %d\n", \
+ #ctype_macro, ctype_macro, sizeof(ctype)); \
+ num_errs++; \
+ }
+
+/* local routine prototypes */
+void test_config_ctypes(void);
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_configure
+ *
+ * Purpose: Main configure definitions testing routine
+ *
+ * Return: none (error is fed back via global variable num_errs)
+ *
+ * Programmer: Albert Cheng
+ * September 25, 2001
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+test_configure(void)
+{
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing configure definitions\n"));
+ test_config_ctypes();
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: cleanup_configure
+ *
+ * Purpose: Cleanup temporary test files
+ *
+ * Return: none
+ *
+ * Programmer: Albert Cheng
+ * September 25, 2001
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+cleanup_configure(void)
+{
+ /* no file to clean */
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_config_ctypes
+ *
+ * Purpose: test C language data type sizes
+ *
+ * Return: none (error is fed back via global variable num_errs)
+ *
+ * Programmer: Albert Cheng
+ * September 25, 2001
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+test_config_ctypes(void)
+{
+ /* standard basic types */
+ vrfy_ctype(char, SIZEOF_CHAR);
+ vrfy_ctype(int, SIZEOF_INT);
+ vrfy_ctype(short, SIZEOF_SHORT);
+ vrfy_ctype(long, SIZEOF_LONG);
+ vrfy_ctype(float, SIZEOF_FLOAT);
+ vrfy_ctype(double, SIZEOF_DOUBLE);
+
+ /* non-standard basic types */
+#if SIZEOF_LONG_LONG > 0
+ vrfy_ctype(long long, SIZEOF_LONG_LONG);
+#endif
+
+#if SIZEOF_LONG_DOUBLE > 0
+ vrfy_ctype(long double, SIZEOF_LONG_DOUBLE);
+#endif
+
+#if SIZEOF_UINT8_T > 0
+ vrfy_ctype(uint8_t, SIZEOF_UINT8_T);
+#endif
+
+#if SIZEOF_UINT16_T > 0
+ vrfy_ctype(uint16_t, SIZEOF_UINT16_T);
+#endif
+
+#if SIZEOF_UINT32_T > 0
+ vrfy_ctype(uint32_t, SIZEOF_UINT32_T);
+#endif
+
+#if SIZEOF_UINT64_T > 0
+ vrfy_ctype(uint64_t, SIZEOF_UINT64_T);
+#endif
+
+#if SIZEOF_UINT_FAST8_T > 0
+ vrfy_ctype(uint_fast8_t, SIZEOF_UINT_FAST8_T);
+#endif
+
+#if SIZEOF_UINT_FAST16_T > 0
+ vrfy_ctype(uint_fast16_t, SIZEOF_UINT_FAST16_T);
+#endif
+
+#if SIZEOF_UINT_FAST32_T > 0
+ vrfy_ctype(uint_fast32_t, SIZEOF_UINT_FAST32_T);
+#endif
+
+#if SIZEOF_UINT_FAST64_T > 0
+ vrfy_ctype(uint_fast64_t, SIZEOF_UINT_FAST64_T);
+#endif
+
+#if SIZEOF_UINT_LEAST8_T > 0
+ vrfy_ctype(uint_least8_t, SIZEOF_UINT_LEAST8_T);
+#endif
+
+#if SIZEOF_UINT_LEAST16_T > 0
+ vrfy_ctype(uint_least16_t, SIZEOF_UINT_LEAST16_T);
+#endif
+
+#if SIZEOF_UINT_LEAST32_T > 0
+ vrfy_ctype(uint_least32_t, SIZEOF_UINT_LEAST32_T);
+#endif
+
+#if SIZEOF_UINT_LEAST64_T > 0
+ vrfy_ctype(uint_least64_t, SIZEOF_UINT_LEAST64_T);
+#endif
+
+ /* pseudo standard basic types */
+#if SIZEOF___INT64 > 0
+ vrfy_ctype(__int64, SIZEOF___INT64);
+#endif
+
+#if SIZEOF_OFF_T > 0
+ vrfy_ctype(off_t, SIZEOF_OFF_T);
+#endif
+
+#if SIZEOF_SIZE_T > 0
+ vrfy_ctype(size_t, SIZEOF_SIZE_T);
+#endif
+
+#if SIZEOF_SSIZE_T > 0
+ vrfy_ctype(ssize_t, SIZEOF_SSIZE_T);
+#endif
+
+}
diff --git a/test/testhdf5.c b/test/testhdf5.c
index b7cd79f..798c3ee 100644
--- a/test/testhdf5.c
+++ b/test/testhdf5.c
@@ -156,6 +156,7 @@ main(int argc, char *argv[])
H5Eset_auto (NULL, NULL);
/* Tests are generally arranged from least to most complexity... */
+ InitTest("configure", test_configure, cleanup_configure, "Configure definitions");
InitTest("metadata", test_metadata, cleanup_metadata, "Encode/decode metadata code");
InitTest("tbbt", test_tbbt, NULL, "Threaded, Balanced, Binary Trees");
InitTest("file", test_file, cleanup_file, "Low-Level File I/O");
diff --git a/test/testhdf5.h b/test/testhdf5.h
index d60c229..ff79e75 100644
--- a/test/testhdf5.h
+++ b/test/testhdf5.h
@@ -134,6 +134,7 @@ void test_vlstrings(void);
void test_iterate(void);
void test_array(void);
void test_genprop(void);
+void test_configure(void);
/* Prototypes for the cleanup routines */
void cleanup_metadata(void);
@@ -148,5 +149,6 @@ void cleanup_vlstrings(void);
void cleanup_iterate(void);
void cleanup_array(void);
void cleanup_genprop(void);
+void cleanup_configure(void);
#endif /* HDF5cleanup_H */