summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2012-10-29 18:59:05 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2012-10-29 18:59:05 (GMT)
commit0cf58a4755eb6f3e7be64b0f05f2bb8ef6f7ad0d (patch)
tree7f5576b9ed8e414606093b6872ced10dd0f5bf0e /test
parent78b07da7aea98598a74bce25335b9435aa29cdb9 (diff)
downloadhdf5-0cf58a4755eb6f3e7be64b0f05f2bb8ef6f7ad0d.zip
hdf5-0cf58a4755eb6f3e7be64b0f05f2bb8ef6f7ad0d.tar.gz
hdf5-0cf58a4755eb6f3e7be64b0f05f2bb8ef6f7ad0d.tar.bz2
[svn-r22987] ported revisions from 22742 to 22986 from the trunk
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt49
-rw-r--r--test/Makefile.am6
-rw-r--r--test/Makefile.in48
-rw-r--r--test/enc_dec_plist.c480
-rw-r--r--test/enc_dec_plist_with_endianess.c160
-rw-r--r--test/enum.c102
-rw-r--r--test/file_image.c17
-rw-r--r--test/gen_plist.c435
-rw-r--r--test/h5test.c20
-rw-r--r--test/h5test.h3
-rw-r--r--test/links.c87
-rw-r--r--test/mount.c75
-rw-r--r--test/testfiles/plist_files/acpl_bebin0 -> 23 bytes
-rw-r--r--test/testfiles/plist_files/acpl_lebin0 -> 23 bytes
-rw-r--r--test/testfiles/plist_files/dapl_bebin0 -> 136 bytes
-rw-r--r--test/testfiles/plist_files/dapl_lebin0 -> 136 bytes
-rw-r--r--test/testfiles/plist_files/dcpl_bebin0 -> 221 bytes
-rw-r--r--test/testfiles/plist_files/dcpl_lebin0 -> 221 bytes
-rw-r--r--test/testfiles/plist_files/dxpl_bebin0 -> 229 bytes
-rw-r--r--test/testfiles/plist_files/dxpl_lebin0 -> 229 bytes
-rw-r--r--test/testfiles/plist_files/fapl_bebin0 -> 1402 bytes
-rw-r--r--test/testfiles/plist_files/fapl_lebin0 -> 1402 bytes
-rw-r--r--test/testfiles/plist_files/fcpl_bebin0 -> 413 bytes
-rw-r--r--test/testfiles/plist_files/fcpl_lebin0 -> 413 bytes
-rw-r--r--test/testfiles/plist_files/gcpl_bebin0 -> 113 bytes
-rw-r--r--test/testfiles/plist_files/gcpl_lebin0 -> 113 bytes
-rw-r--r--test/testfiles/plist_files/lapl_bebin0 -> 1502 bytes
-rw-r--r--test/testfiles/plist_files/lapl_lebin0 -> 1502 bytes
-rw-r--r--test/testfiles/plist_files/lcpl_bebin0 -> 47 bytes
-rw-r--r--test/testfiles/plist_files/lcpl_lebin0 -> 47 bytes
-rw-r--r--test/testfiles/plist_files/ocpl_bebin0 -> 86 bytes
-rw-r--r--test/testfiles/plist_files/ocpl_lebin0 -> 86 bytes
-rw-r--r--test/testfiles/plist_files/ocpypl_bebin0 -> 56 bytes
-rw-r--r--test/testfiles/plist_files/ocpypl_lebin0 -> 56 bytes
-rw-r--r--test/testfiles/plist_files/strcpl_bebin0 -> 23 bytes
-rw-r--r--test/testfiles/plist_files/strcpl_lebin0 -> 23 bytes
-rw-r--r--test/testframe.c6
-rw-r--r--test/testhdf5.h12
-rw-r--r--test/tgenprop.c122
39 files changed, 1465 insertions, 157 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index a6ff10b..5551fa3 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -2,6 +2,11 @@ cmake_minimum_required (VERSION 2.8.6)
PROJECT (HDF5_TEST)
#-----------------------------------------------------------------------------
+# Apply Definitions to compiler in this directory and below
+#-----------------------------------------------------------------------------
+ADD_DEFINITIONS (${HDF5_EXTRA_C_FLAGS})
+
+#-----------------------------------------------------------------------------
# Define Sources
#-----------------------------------------------------------------------------
SET (TEST_LIB_SRCS
@@ -73,6 +78,47 @@ FOREACH (ref_file ${HDF5_REFERENCE_FILES})
ENDFOREACH (ref_file ${HDF5_REFERENCE_FILES})
# --------------------------------------------------------------------
+# Copy test files from test/testfiles/plist_files dir to test dir
+# --------------------------------------------------------------------
+SET (HDF5_REFERENCE_PLIST_FILES
+ acpl_be
+ acpl_le
+ dapl_be
+ dapl_le
+ dcpl_be
+ dcpl_le
+ dxpl_be
+ dxpl_le
+ fapl_be
+ fapl_le
+ fcpl_be
+ fcpl_le
+ gcpl_be
+ gcpl_le
+ lapl_be
+ lapl_le
+ lcpl_be
+ lcpl_le
+ ocpl_be
+ ocpl_le
+ ocpypl_be
+ ocpypl_le
+ strcpl_be
+ strcpl_le
+)
+
+FOREACH (plistfile ${HDF5_REFERENCE_PLIST_FILES})
+ SET (dest "${PROJECT_BINARY_DIR}/${plistfile}")
+ #MESSAGE (STATUS " Copying ${plistfile} to ${dset}")
+ ADD_CUSTOM_COMMAND (
+ TARGET ${HDF5_TEST_LIB_TARGET}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/${plistfile} ${dest}
+ )
+ENDFOREACH (plistfile ${HDF5_REFERENCE_PLIST_FILES})
+
+# --------------------------------------------------------------------
#-- Copy all the HDF5 files from the test directory into the source directory
# --------------------------------------------------------------------
SET (HDF5_REFERENCE_TEST_FILES
@@ -309,6 +355,8 @@ SET (H5_TESTS
testmeta
#links_env
file_image
+ enc_dec_plist
+ enc_dec_plist_with_endianess
)
FOREACH (test ${H5_TESTS})
@@ -633,6 +681,7 @@ IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
gen_specmetaread
gen_sizes_lheap
gen_file_image
+ gen_plist
)
FOREACH (gen ${H5_GENERATORS})
diff --git a/test/Makefile.am b/test/Makefile.am
index 0197e99..64088b8 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -39,8 +39,8 @@ SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) links_env$(EXEEXT)
TEST_PROG= testhdf5 lheap ohdr stab gheap cache cache_api cache_tagging \
pool accum hyperslab istore bittests dt_arith \
dtypes dsets cmpd_dset filter_fail extend external efc objcopy links unlink \
- big mtime fillval mount flush1 flush2 app_ref enum \
- set_extent ttsafe dectris_tst \
+ big mtime fillval mount flush1 flush2 app_ref enum dectris_tst \
+ set_extent ttsafe enc_dec_plist enc_dec_plist_with_endianess\
getname vfd ntypes dangle dtransform reserved cross_read \
freespace mf farray earray btree2 fheap file_image
@@ -63,7 +63,7 @@ check_PROGRAMS=$(TEST_PROG) error_test err_compat tcheck_version testmeta links_
BUILD_ALL_PROGS=gen_bad_ohdr gen_bogus gen_cross gen_deflate gen_filters gen_new_array \
gen_new_fill gen_new_group gen_new_mtime gen_new_super gen_noencoder \
gen_nullspace gen_udlinks space_overflow gen_filespace gen_specmetaread \
- gen_sizes_lheap gen_file_image
+ gen_sizes_lheap gen_file_image gen_plist
if BUILD_ALL_CONDITIONAL
noinst_PROGRAMS=$(BUILD_ALL_PROGS)
diff --git a/test/Makefile.in b/test/Makefile.in
index 30bfc59..09b4f93 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -107,8 +107,9 @@ am__EXEEXT_1 = testhdf5$(EXEEXT) lheap$(EXEEXT) ohdr$(EXEEXT) \
external$(EXEEXT) efc$(EXEEXT) objcopy$(EXEEXT) links$(EXEEXT) \
unlink$(EXEEXT) big$(EXEEXT) mtime$(EXEEXT) fillval$(EXEEXT) \
mount$(EXEEXT) flush1$(EXEEXT) flush2$(EXEEXT) \
- app_ref$(EXEEXT) enum$(EXEEXT) set_extent$(EXEEXT) \
- ttsafe$(EXEEXT) dectris_tst$(EXEEXT) getname$(EXEEXT) \
+ app_ref$(EXEEXT) enum$(EXEEXT) dectris_tst$(EXEEXT) \
+ set_extent$(EXEEXT) ttsafe$(EXEEXT) enc_dec_plist$(EXEEXT) \
+ enc_dec_plist_with_endianess$(EXEEXT) getname$(EXEEXT) \
vfd$(EXEEXT) ntypes$(EXEEXT) dangle$(EXEEXT) \
dtransform$(EXEEXT) reserved$(EXEEXT) cross_read$(EXEEXT) \
freespace$(EXEEXT) mf$(EXEEXT) farray$(EXEEXT) earray$(EXEEXT) \
@@ -121,7 +122,7 @@ am__EXEEXT_2 = gen_bad_ohdr$(EXEEXT) gen_bogus$(EXEEXT) \
gen_nullspace$(EXEEXT) gen_udlinks$(EXEEXT) \
space_overflow$(EXEEXT) gen_filespace$(EXEEXT) \
gen_specmetaread$(EXEEXT) gen_sizes_lheap$(EXEEXT) \
- gen_file_image$(EXEEXT)
+ gen_file_image$(EXEEXT) gen_plist$(EXEEXT)
PROGRAMS = $(noinst_PROGRAMS)
accum_SOURCES = accum.c
accum_OBJECTS = accum.$(OBJEXT)
@@ -195,6 +196,15 @@ efc_SOURCES = efc.c
efc_OBJECTS = efc.$(OBJEXT)
efc_LDADD = $(LDADD)
efc_DEPENDENCIES = libh5test.la $(LIBHDF5)
+enc_dec_plist_SOURCES = enc_dec_plist.c
+enc_dec_plist_OBJECTS = enc_dec_plist.$(OBJEXT)
+enc_dec_plist_LDADD = $(LDADD)
+enc_dec_plist_DEPENDENCIES = libh5test.la $(LIBHDF5)
+enc_dec_plist_with_endianess_SOURCES = enc_dec_plist_with_endianess.c
+enc_dec_plist_with_endianess_OBJECTS = \
+ enc_dec_plist_with_endianess.$(OBJEXT)
+enc_dec_plist_with_endianess_LDADD = $(LDADD)
+enc_dec_plist_with_endianess_DEPENDENCIES = libh5test.la $(LIBHDF5)
enum_SOURCES = enum.c
enum_OBJECTS = enum.$(OBJEXT)
enum_LDADD = $(LDADD)
@@ -303,6 +313,10 @@ gen_nullspace_SOURCES = gen_nullspace.c
gen_nullspace_OBJECTS = gen_nullspace.$(OBJEXT)
gen_nullspace_LDADD = $(LDADD)
gen_nullspace_DEPENDENCIES = libh5test.la $(LIBHDF5)
+gen_plist_SOURCES = gen_plist.c
+gen_plist_OBJECTS = gen_plist.$(OBJEXT)
+gen_plist_LDADD = $(LDADD)
+gen_plist_DEPENDENCIES = libh5test.la $(LIBHDF5)
gen_sizes_lheap_SOURCES = gen_sizes_lheap.c
gen_sizes_lheap_OBJECTS = gen_sizes_lheap.$(OBJEXT)
gen_sizes_lheap_LDADD = $(LDADD)
@@ -458,13 +472,14 @@ am__v_CCLD_1 =
SOURCES = $(libh5test_la_SOURCES) accum.c app_ref.c big.c bittests.c \
btree2.c cache.c cache_api.c cache_tagging.c cmpd_dset.c \
cross_read.c dangle.c dectris_tst.c dsets.c dt_arith.c \
- dtransform.c dtypes.c earray.c efc.c enum.c err_compat.c \
+ dtransform.c dtypes.c earray.c efc.c enc_dec_plist.c \
+ enc_dec_plist_with_endianess.c enum.c err_compat.c \
error_test.c extend.c external.c farray.c fheap.c file_image.c \
fillval.c filter_fail.c flush1.c flush2.c freespace.c \
gen_bad_ohdr.c gen_bogus.c gen_cross.c gen_deflate.c \
gen_file_image.c gen_filespace.c gen_filters.c gen_new_array.c \
gen_new_fill.c gen_new_group.c gen_new_mtime.c gen_new_super.c \
- gen_noencoder.c gen_nullspace.c gen_sizes_lheap.c \
+ gen_noencoder.c gen_nullspace.c gen_plist.c gen_sizes_lheap.c \
gen_specmetaread.c gen_udlinks.c getname.c gheap.c hyperslab.c \
istore.c lheap.c links.c links_env.c mf.c mount.c mtime.c \
ntypes.c objcopy.c ohdr.c pool.c reserved.c set_extent.c \
@@ -473,13 +488,14 @@ SOURCES = $(libh5test_la_SOURCES) accum.c app_ref.c big.c bittests.c \
DIST_SOURCES = $(libh5test_la_SOURCES) accum.c app_ref.c big.c \
bittests.c btree2.c cache.c cache_api.c cache_tagging.c \
cmpd_dset.c cross_read.c dangle.c dectris_tst.c dsets.c \
- dt_arith.c dtransform.c dtypes.c earray.c efc.c enum.c \
+ dt_arith.c dtransform.c dtypes.c earray.c efc.c \
+ enc_dec_plist.c enc_dec_plist_with_endianess.c enum.c \
err_compat.c error_test.c extend.c external.c farray.c fheap.c \
file_image.c fillval.c filter_fail.c flush1.c flush2.c \
freespace.c gen_bad_ohdr.c gen_bogus.c gen_cross.c \
gen_deflate.c gen_file_image.c gen_filespace.c gen_filters.c \
gen_new_array.c gen_new_fill.c gen_new_group.c gen_new_mtime.c \
- gen_new_super.c gen_noencoder.c gen_nullspace.c \
+ gen_new_super.c gen_noencoder.c gen_nullspace.c gen_plist.c \
gen_sizes_lheap.c gen_specmetaread.c gen_udlinks.c getname.c \
gheap.c hyperslab.c istore.c lheap.c links.c links_env.c mf.c \
mount.c mtime.c ntypes.c objcopy.c ohdr.c pool.c reserved.c \
@@ -825,8 +841,8 @@ SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) links_env$(EXEEXT)
TEST_PROG = testhdf5 lheap ohdr stab gheap cache cache_api cache_tagging \
pool accum hyperslab istore bittests dt_arith \
dtypes dsets cmpd_dset filter_fail extend external efc objcopy links unlink \
- big mtime fillval mount flush1 flush2 app_ref enum \
- set_extent ttsafe dectris_tst \
+ big mtime fillval mount flush1 flush2 app_ref enum dectris_tst \
+ set_extent ttsafe enc_dec_plist enc_dec_plist_with_endianess\
getname vfd ntypes dangle dtransform reserved cross_read \
freespace mf farray earray btree2 fheap file_image
@@ -841,7 +857,7 @@ TEST_PROG = testhdf5 lheap ohdr stab gheap cache cache_api cache_tagging \
BUILD_ALL_PROGS = gen_bad_ohdr gen_bogus gen_cross gen_deflate gen_filters gen_new_array \
gen_new_fill gen_new_group gen_new_mtime gen_new_super gen_noencoder \
gen_nullspace gen_udlinks space_overflow gen_filespace gen_specmetaread \
- gen_sizes_lheap gen_file_image
+ gen_sizes_lheap gen_file_image gen_plist
# The libh5test library provides common support code for the tests.
@@ -1017,6 +1033,12 @@ earray$(EXEEXT): $(earray_OBJECTS) $(earray_DEPENDENCIES) $(EXTRA_earray_DEPENDE
efc$(EXEEXT): $(efc_OBJECTS) $(efc_DEPENDENCIES) $(EXTRA_efc_DEPENDENCIES)
@rm -f efc$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(efc_OBJECTS) $(efc_LDADD) $(LIBS)
+enc_dec_plist$(EXEEXT): $(enc_dec_plist_OBJECTS) $(enc_dec_plist_DEPENDENCIES) $(EXTRA_enc_dec_plist_DEPENDENCIES)
+ @rm -f enc_dec_plist$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(enc_dec_plist_OBJECTS) $(enc_dec_plist_LDADD) $(LIBS)
+enc_dec_plist_with_endianess$(EXEEXT): $(enc_dec_plist_with_endianess_OBJECTS) $(enc_dec_plist_with_endianess_DEPENDENCIES) $(EXTRA_enc_dec_plist_with_endianess_DEPENDENCIES)
+ @rm -f enc_dec_plist_with_endianess$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(enc_dec_plist_with_endianess_OBJECTS) $(enc_dec_plist_with_endianess_LDADD) $(LIBS)
enum$(EXEEXT): $(enum_OBJECTS) $(enum_DEPENDENCIES) $(EXTRA_enum_DEPENDENCIES)
@rm -f enum$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(enum_OBJECTS) $(enum_LDADD) $(LIBS)
@@ -1098,6 +1120,9 @@ gen_noencoder$(EXEEXT): $(gen_noencoder_OBJECTS) $(gen_noencoder_DEPENDENCIES) $
gen_nullspace$(EXEEXT): $(gen_nullspace_OBJECTS) $(gen_nullspace_DEPENDENCIES) $(EXTRA_gen_nullspace_DEPENDENCIES)
@rm -f gen_nullspace$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(gen_nullspace_OBJECTS) $(gen_nullspace_LDADD) $(LIBS)
+gen_plist$(EXEEXT): $(gen_plist_OBJECTS) $(gen_plist_DEPENDENCIES) $(EXTRA_gen_plist_DEPENDENCIES)
+ @rm -f gen_plist$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(gen_plist_OBJECTS) $(gen_plist_LDADD) $(LIBS)
gen_sizes_lheap$(EXEEXT): $(gen_sizes_lheap_OBJECTS) $(gen_sizes_lheap_DEPENDENCIES) $(EXTRA_gen_sizes_lheap_DEPENDENCIES)
@rm -f gen_sizes_lheap$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(gen_sizes_lheap_OBJECTS) $(gen_sizes_lheap_LDADD) $(LIBS)
@@ -1205,6 +1230,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dtypes.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earray.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/efc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/enc_dec_plist.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/enc_dec_plist_with_endianess.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/enum.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/err_compat.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error_test.Po@am__quote@
@@ -1232,6 +1259,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gen_new_super.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gen_noencoder.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gen_nullspace.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gen_plist.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gen_sizes_lheap.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gen_specmetaread.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gen_udlinks.Po@am__quote@
diff --git a/test/enc_dec_plist.c b/test/enc_dec_plist.c
new file mode 100644
index 0000000..26bfb84
--- /dev/null
+++ b/test/enc_dec_plist.c
@@ -0,0 +1,480 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Serial tests for encoding/decoding plists
+ */
+
+#include "h5test.h"
+#include "H5Pprivate.h"
+
+static int
+test_encode_decode(hid_t orig_pl)
+{
+ hid_t pl = (-1); /* Decoded property list */
+ void *temp_buf = NULL; /* Pointer to encoding buffer */
+ size_t temp_size = 0; /* Size of encoding buffer */
+
+ /* first call to encode returns only the size of the buffer needed */
+ if(H5Pencode(orig_pl, NULL, &temp_size) < 0)
+ STACK_ERROR
+
+ if(NULL == (temp_buf = (void *)HDmalloc(temp_size)))
+ TEST_ERROR
+
+ if(H5Pencode(orig_pl, temp_buf, &temp_size) < 0)
+ STACK_ERROR
+
+ if((pl = H5Pdecode(temp_buf)) < 0)
+ STACK_ERROR
+
+ if(!H5Pequal(orig_pl, pl))
+ PUTS_ERROR("encoding-decoding cycle failed\n")
+
+ if((H5Pclose(pl)) < 0)
+ STACK_ERROR
+
+ HDfree(temp_buf);
+
+ /* Success */
+ return(0);
+
+error:
+ if(pl > 0)
+ H5Pclose(pl);
+ if(temp_buf)
+ HDfree(temp_buf);
+
+ return(-1);
+} /* end test_encode_decode() */
+
+int
+main(void)
+{
+ hid_t dcpl; /* dataset create prop. list */
+ hid_t dapl; /* dataset access prop. list */
+ hid_t dxpl; /* dataset xfer prop. list */
+ hid_t gcpl; /* group create prop. list */
+ hid_t ocpypl; /* object copy prop. list */
+ hid_t ocpl; /* object create prop. list */
+ hid_t lcpl; /* link create prop. list */
+ hid_t lapl; /* link access prop. list */
+ hid_t fapl; /* file access prop. list */
+ hid_t fcpl; /* file create prop. list */
+ hid_t strcpl; /* string create prop. list */
+ hid_t acpl; /* attribute create prop. list */
+
+ hsize_t chunk_size[2] = {16384, 4}; /* chunk size */
+ double fill = 2.7f; /* Fill value */
+ hsize_t max_size[1]; /* data space maximum size */
+ size_t nslots = 521 * 2;
+ size_t nbytes = 1048576 * 10;
+ double w0 = 0.5f;
+ unsigned max_compact;
+ unsigned min_dense;
+ const char* c_to_f = "x+32";
+ H5AC_cache_config_t my_cache_config = {
+ H5AC__CURR_CACHE_CONFIG_VERSION,
+ TRUE,
+ FALSE,
+ FALSE,
+ "temp",
+ TRUE,
+ FALSE,
+ ( 2 * 2048 * 1024),
+ 0.3f,
+ (64 * 1024 * 1024),
+ (4 * 1024 * 1024),
+ 60000,
+ H5C_incr__threshold,
+ 0.8f,
+ 3.0f,
+ TRUE,
+ (8 * 1024 * 1024),
+ H5C_flash_incr__add_space,
+ 2.0f,
+ 0.25f,
+ H5C_decr__age_out_with_threshold,
+ 0.997f,
+ 0.8f,
+ TRUE,
+ (3 * 1024 * 1024),
+ 3,
+ FALSE,
+ 0.2f,
+ (256 * 2048),
+ H5AC__DEFAULT_METADATA_WRITE_STRATEGY};
+
+ if(VERBOSE_MED)
+ printf("Encode/Decode DCPLs\n");
+
+ /******* ENCODE/DECODE DCPLS *****/
+ TESTING("DCPL Encoding/Decoding");
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+
+ if((H5Pset_chunk(dcpl, 2, &chunk_size)) < 0)
+ FAIL_STACK_ERROR
+
+ if((H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE)) < 0)
+ FAIL_STACK_ERROR
+
+ if((H5Pset_fill_value(dcpl, H5T_NATIVE_DOUBLE, &fill)) < 0)
+ FAIL_STACK_ERROR
+
+ max_size[0] = 100;
+ if((H5Pset_external(dcpl, "ext1.data", (off_t)0,
+ (hsize_t)(max_size[0] * sizeof(int)/4))) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_external(dcpl, "ext2.data", (off_t)0,
+ (hsize_t)(max_size[0] * sizeof(int)/4))) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_external(dcpl, "ext3.data", (off_t)0,
+ (hsize_t)(max_size[0] * sizeof(int)/4))) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_external(dcpl, "ext4.data", (off_t)0,
+ (hsize_t)(max_size[0] * sizeof(int)/4))) < 0)
+ FAIL_STACK_ERROR
+
+ /* Test encoding & decoding property list */
+ if(test_encode_decode(dcpl) < 0)
+ FAIL_PUTS_ERROR("DCPL encoding/decoding failed\n")
+
+ /* release resource */
+ if((H5Pclose(dcpl)) < 0)
+ FAIL_STACK_ERROR
+
+ PASSED();
+
+
+ /******* ENCODE/DECODE DAPLS *****/
+ TESTING("DAPL Encoding/Decoding");
+ if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ FAIL_STACK_ERROR
+
+ if((H5Pset_chunk_cache(dapl, nslots, nbytes, w0)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Test encoding & decoding property list */
+ if(test_encode_decode(dapl) < 0)
+ FAIL_PUTS_ERROR("DAPL encoding/decoding failed\n")
+
+ /* release resource */
+ if((H5Pclose(dapl)) < 0)
+ FAIL_STACK_ERROR
+
+ PASSED();
+
+
+ /******* ENCODE/DECODE OCPLS *****/
+ TESTING("OCPL Encoding/Decoding");
+ if((ocpl = H5Pcreate(H5P_OBJECT_CREATE)) < 0)
+ FAIL_STACK_ERROR
+
+ if((H5Pset_attr_creation_order(ocpl, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED))) < 0)
+ FAIL_STACK_ERROR
+
+ if((H5Pset_attr_phase_change (ocpl, 110, 105)) < 0)
+ FAIL_STACK_ERROR
+
+ if((H5Pset_filter (ocpl, H5Z_FILTER_FLETCHER32, 0, (size_t)0, NULL)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Test encoding & decoding property list */
+ if(test_encode_decode(ocpl) < 0)
+ FAIL_PUTS_ERROR("OCPL encoding/decoding failed\n")
+
+ /* release resource */
+ if((H5Pclose(ocpl)) < 0)
+ FAIL_STACK_ERROR
+
+ PASSED();
+
+
+ /******* ENCODE/DECODE DXPLS *****/
+ TESTING("DXPL Encoding/Decoding");
+ if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_btree_ratios(dxpl, 0.2f, 0.6f, 0.2f)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_hyper_vector_size(dxpl, 5)) < 0)
+ FAIL_STACK_ERROR
+#ifdef H5_HAVE_PARALLEL
+ if((H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_COLLECTIVE)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_dxpl_mpio_collective_opt(dxpl, H5FD_MPIO_INDIVIDUAL_IO)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_dxpl_mpio_chunk_opt(dxpl, H5FD_MPIO_CHUNK_MULTI_IO)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_dxpl_mpio_chunk_opt_ratio(dxpl, 30)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_dxpl_mpio_chunk_opt_num(dxpl, 40)) < 0)
+ FAIL_STACK_ERROR
+#endif/* H5_HAVE_PARALLEL */
+ if((H5Pset_edc_check(dxpl, H5Z_DISABLE_EDC)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_data_transform(dxpl, c_to_f)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Test encoding & decoding property list */
+ if(test_encode_decode(dxpl) < 0)
+ FAIL_PUTS_ERROR("DXPL encoding/decoding failed\n")
+
+ /* release resource */
+ if((H5Pclose(dxpl)) < 0)
+ FAIL_STACK_ERROR
+
+ PASSED();
+
+
+ /******* ENCODE/DECODE GCPLS *****/
+ TESTING("GCPL Encoding/Decoding");
+ if((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ FAIL_STACK_ERROR
+
+ if((H5Pset_local_heap_size_hint(gcpl, 256)) < 0)
+ FAIL_STACK_ERROR
+
+ if((H5Pset_link_phase_change(gcpl, 2, 2)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Query the group creation properties */
+ if((H5Pget_link_phase_change(gcpl, &max_compact, &min_dense)) < 0)
+ FAIL_STACK_ERROR
+
+ if((H5Pset_est_link_info(gcpl, 3, 9)) < 0)
+ FAIL_STACK_ERROR
+
+ if((H5Pset_link_creation_order(gcpl, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED))) < 0)
+ FAIL_STACK_ERROR
+
+ /* Test encoding & decoding property list */
+ if(test_encode_decode(gcpl) < 0)
+ FAIL_PUTS_ERROR("GCPL encoding/decoding failed\n")
+
+ /* release resource */
+ if((H5Pclose(gcpl)) < 0)
+ FAIL_STACK_ERROR
+
+ PASSED();
+
+
+ /******* ENCODE/DECODE LCPLS *****/
+ TESTING("LCPL Encoding/Decoding");
+ if((lcpl = H5Pcreate(H5P_LINK_CREATE)) < 0)
+ FAIL_STACK_ERROR
+
+ if((H5Pset_create_intermediate_group(lcpl, TRUE)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Test encoding & decoding property list */
+ if(test_encode_decode(lcpl) < 0)
+ FAIL_PUTS_ERROR("LCPL encoding/decoding failed\n")
+
+ /* release resource */
+ if((H5Pclose(lcpl)) < 0)
+ FAIL_STACK_ERROR
+
+ PASSED();
+
+
+ /******* ENCODE/DECODE LAPLS *****/
+ TESTING("LAPL Encoding/Decoding");
+ if((lapl = H5Pcreate(H5P_LINK_ACCESS)) < 0)
+ FAIL_STACK_ERROR
+
+ if((H5Pset_nlinks(lapl, (size_t)134)) < 0)
+ FAIL_STACK_ERROR
+
+ if((H5Pset_elink_acc_flags(lapl, H5F_ACC_RDONLY)) < 0)
+ FAIL_STACK_ERROR
+
+ if((H5Pset_elink_prefix(lapl, "/tmpasodiasod")) < 0)
+ FAIL_STACK_ERROR
+
+ /* Create FAPL for the elink FAPL */
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_alignment(fapl, 2, 1024)) < 0)
+ FAIL_STACK_ERROR
+
+ if((H5Pset_elink_fapl(lapl, fapl)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Close the elink's FAPL */
+ if((H5Pclose(fapl)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Test encoding & decoding property list */
+ if(test_encode_decode(lapl) < 0)
+ FAIL_PUTS_ERROR("LAPL encoding/decoding failed\n")
+
+ /* release resource */
+ if((H5Pclose(lapl)) < 0)
+ FAIL_STACK_ERROR
+
+ PASSED();
+
+
+ /******* ENCODE/DECODE OCPYPLS *****/
+ TESTING("OCPYPL Encoding/Decoding");
+ if((ocpypl = H5Pcreate(H5P_OBJECT_COPY)) < 0)
+ FAIL_STACK_ERROR
+
+ if((H5Pset_copy_object(ocpypl, H5O_COPY_EXPAND_EXT_LINK_FLAG)) < 0)
+ FAIL_STACK_ERROR
+
+ if((H5Padd_merge_committed_dtype_path(ocpypl, "foo")) < 0)
+ FAIL_STACK_ERROR
+ if((H5Padd_merge_committed_dtype_path(ocpypl, "bar")) < 0)
+ FAIL_STACK_ERROR
+
+ /* Test encoding & decoding property list */
+ if(test_encode_decode(ocpypl) < 0)
+ FAIL_PUTS_ERROR("OCPYPL encoding/decoding failed\n")
+
+ /* release resource */
+ if((H5Pclose(ocpypl)) < 0)
+ FAIL_STACK_ERROR
+
+ PASSED();
+
+
+ /******* ENCODE/DECODE FAPLS *****/
+ TESTING("FAPL Encoding/Decoding");
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ FAIL_STACK_ERROR
+
+ if((H5Pset_family_offset(fapl, 1024)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_meta_block_size(fapl, 2098452)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_sieve_buf_size(fapl, 1048576)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_alignment(fapl, 2, 1024)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_cache(fapl, 1024, 128, 10485760, 0.3f)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_elink_file_cache_size(fapl, 10485760)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_gc_references(fapl, 1)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_small_data_block_size(fapl, 2048)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_fclose_degree(fapl, H5F_CLOSE_WEAK)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_multi_type(fapl, H5FD_MEM_GHEAP)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_mdc_config(fapl, &my_cache_config)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Test encoding & decoding property list */
+ if(test_encode_decode(fapl) < 0)
+ FAIL_PUTS_ERROR("FAPL encoding/decoding failed\n")
+
+ /* release resource */
+ if((H5Pclose(fapl)) < 0)
+ FAIL_STACK_ERROR
+
+ PASSED();
+
+
+ /******* ENCODE/DECODE FCPLS *****/
+ TESTING("FCPL Encoding/Decoding");
+
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ FAIL_STACK_ERROR
+
+ if((H5Pset_userblock(fcpl, 1024) < 0))
+ FAIL_STACK_ERROR
+
+ if((H5Pset_istore_k(fcpl, 3) < 0))
+ FAIL_STACK_ERROR
+
+ if((H5Pset_sym_k(fcpl, 4, 5) < 0))
+ FAIL_STACK_ERROR
+
+ if((H5Pset_shared_mesg_nindexes(fcpl, 8) < 0))
+ FAIL_STACK_ERROR
+
+ if((H5Pset_shared_mesg_index(fcpl, 1, H5O_SHMESG_SDSPACE_FLAG, 32) < 0))
+ FAIL_STACK_ERROR
+
+ if((H5Pset_shared_mesg_phase_change(fcpl, 60, 20) < 0))
+ FAIL_STACK_ERROR
+
+ if((H5Pset_sizes(fcpl, 8, 4) < 0))
+ FAIL_STACK_ERROR
+
+ /* Test encoding & decoding property list */
+ if(test_encode_decode(fcpl) < 0)
+ FAIL_PUTS_ERROR("FCPL encoding/decoding failed\n")
+
+ /* release resource */
+ if((H5Pclose(fcpl)) < 0)
+ FAIL_STACK_ERROR
+
+ PASSED();
+
+
+ /******* ENCODE/DECODE STRCPLS *****/
+ TESTING("STRCPL Encoding/Decoding");
+
+ if((strcpl = H5Pcreate(H5P_STRING_CREATE)) < 0)
+ FAIL_STACK_ERROR
+
+ if((H5Pset_char_encoding(strcpl, H5T_CSET_UTF8) < 0))
+ FAIL_STACK_ERROR
+
+ /* Test encoding & decoding property list */
+ if(test_encode_decode(strcpl) < 0)
+ FAIL_PUTS_ERROR("STRCPL encoding/decoding failed\n")
+
+ /* release resource */
+ if((H5Pclose(strcpl)) < 0)
+ FAIL_STACK_ERROR
+
+ PASSED();
+
+
+ /******* ENCODE/DECODE ACPLS *****/
+ TESTING("ACPL Encoding/Decoding");
+
+ if((acpl = H5Pcreate(H5P_ATTRIBUTE_CREATE)) < 0)
+ FAIL_STACK_ERROR
+
+ if((H5Pset_char_encoding(acpl, H5T_CSET_UTF8) < 0))
+ FAIL_STACK_ERROR
+
+ /* Test encoding & decoding property list */
+ if(test_encode_decode(acpl) < 0)
+ FAIL_PUTS_ERROR("ACPL encoding/decoding failed\n")
+
+ /* release resource */
+ if((H5Pclose(acpl)) < 0)
+ FAIL_STACK_ERROR
+
+ PASSED();
+
+
+ return 0;
+
+error:
+ printf("***** Plist Encode/Decode tests FAILED! *****\n");
+ return 1;
+}
+
diff --git a/test/enc_dec_plist_with_endianess.c b/test/enc_dec_plist_with_endianess.c
new file mode 100644
index 0000000..4469604
--- /dev/null
+++ b/test/enc_dec_plist_with_endianess.c
@@ -0,0 +1,160 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Serial tests for encoding/decoding plists
+ */
+
+#include "h5test.h"
+#include "H5srcdir.h"
+
+static int test_plists(const char *filename1, const char *filename2);
+
+int
+main(void)
+{
+ if(VERBOSE_MED)
+ printf("Encode/Decode property list endianess\n");
+
+ /******* ENCODE/DECODE DCPLS *****/
+ TESTING("DCPL Encoding/Decoding");
+ if(test_plists("testfiles/plist_files/dcpl_le", "testfiles/plist_files/dcpl_be") < 0)
+ FAIL_STACK_ERROR
+ PASSED();
+
+ /******* ENCODE/DECODE DAPLS *****/
+ TESTING("DAPL Encoding/Decoding");
+ if(test_plists("testfiles/plist_files/dapl_le", "testfiles/plist_files/dapl_be") < 0)
+ FAIL_STACK_ERROR
+ PASSED();
+
+ /******* ENCODE/DECODE DXPLS *****/
+ TESTING("DXPL Encoding/Decoding");
+ if(test_plists("testfiles/plist_files/dxpl_le", "testfiles/plist_files/dxpl_be") < 0)
+ FAIL_STACK_ERROR
+ PASSED();
+
+ /******* ENCODE/DECODE GCPLS *****/
+ TESTING("GCPL Encoding/Decoding");
+ if(test_plists("testfiles/plist_files/gcpl_le", "testfiles/plist_files/gcpl_be") < 0)
+ FAIL_STACK_ERROR
+ PASSED();
+
+ /******* ENCODE/DECODE LCPLS *****/
+ TESTING("LCPL Encoding/Decoding");
+ if(test_plists("testfiles/plist_files/lcpl_le", "testfiles/plist_files/lcpl_be") < 0)
+ FAIL_STACK_ERROR
+ PASSED();
+
+ /******* ENCODE/DECODE LAPLS *****/
+ TESTING("LAPL Encoding/Decoding");
+ if(test_plists("testfiles/plist_files/lapl_le", "testfiles/plist_files/lapl_be") < 0)
+ FAIL_STACK_ERROR
+ PASSED();
+
+ /******* ENCODE/DECODE OCPLS *****/
+ TESTING("OCPL Encoding/Decoding");
+ if(test_plists("testfiles/plist_files/ocpl_le", "testfiles/plist_files/ocpl_be") < 0)
+ FAIL_STACK_ERROR
+ PASSED();
+
+ /******* ENCODE/DECODE OCPYPLS *****/
+ TESTING("OCPYPL Encoding/Decoding");
+ if(test_plists("testfiles/plist_files/ocpypl_le", "testfiles/plist_files/ocpypl_be") < 0)
+ FAIL_STACK_ERROR
+ PASSED();
+
+ /******* ENCODE/DECODE FCPLS *****/
+ TESTING("FCPL Encoding/Decoding");
+ if(test_plists("testfiles/plist_files/fcpl_le", "testfiles/plist_files/fcpl_be") < 0)
+ FAIL_STACK_ERROR
+ PASSED();
+
+ /******* ENCODE/DECODE FAPLS *****/
+ TESTING("FAPL Encoding/Decoding");
+ if(test_plists("testfiles/plist_files/fapl_le", "testfiles/plist_files/fapl_be") < 0)
+ FAIL_STACK_ERROR
+ PASSED();
+
+ /******* ENCODE/DECODE STRCPLS *****/
+ TESTING("STRCPL Encoding/Decoding");
+ if(test_plists("testfiles/plist_files/strcpl_le", "testfiles/plist_files/strcpl_be") < 0)
+ FAIL_STACK_ERROR
+ PASSED();
+
+ /******* ENCODE/DECODE ACPLS *****/
+ TESTING("ACPL Encoding/Decoding");
+ if(test_plists("testfiles/plist_files/acpl_le", "testfiles/plist_files/acpl_be") < 0)
+ FAIL_STACK_ERROR
+ PASSED();
+
+ return 0;
+
+error:
+ return 1;
+}
+
+static int
+test_plists(const char *filename1, const char *filename2)
+{
+ int fd_le, fd_be;
+ size_t size_le = 0, size_be = 0;
+ void *buf_le = NULL, *buf_be = NULL;
+ hid_t plist_le, plist_be; /* dataset create prop. list */
+ const char *testfile;
+
+ testfile = H5_get_srcdir_filename(filename1);
+ if((fd_le = HDopen(testfile, O_RDONLY, 0666)) < 0)
+ TEST_ERROR
+ size_le = HDlseek(fd_le, (HDoff_t)0, SEEK_END);
+ HDlseek(fd_le, (HDoff_t)0, SEEK_SET);
+ buf_le = (void *)HDmalloc(size_le);
+ if(HDread(fd_le, buf_le, size_le) < 0)
+ TEST_ERROR
+ HDclose(fd_le);
+
+ testfile = H5_get_srcdir_filename(filename2);
+ if((fd_be = HDopen(testfile, O_RDONLY, 0666)) < 0)
+ TEST_ERROR
+ size_be = HDlseek(fd_be, (HDoff_t)0, SEEK_END);
+ HDlseek(fd_be, (HDoff_t)0, SEEK_SET);
+ buf_be = (void *)HDmalloc(size_be);
+ if(HDread(fd_be, buf_be, size_be) < 0)
+ TEST_ERROR
+ HDclose(fd_be);
+
+ if((plist_le = H5Pdecode(buf_le)) < 0)
+ FAIL_STACK_ERROR
+ if((plist_be = H5Pdecode(buf_be)) < 0)
+ FAIL_STACK_ERROR
+
+ if(!H5Pequal(plist_le, plist_be))
+ FAIL_PUTS_ERROR("PLIST encoding/decoding comparison failed\n")
+
+ if((H5Pclose(plist_le)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pclose(plist_be)) < 0)
+ FAIL_STACK_ERROR
+
+ HDfree(buf_le);
+ HDfree(buf_be);
+
+ return 1;
+
+error:
+ printf("***** Plist Encode/Decode tests FAILED! *****\n");
+ return -1;
+}
+
diff --git a/test/enum.c b/test/enum.c
index 3684102..29b702d 100644
--- a/test/enum.c
+++ b/test/enum.c
@@ -109,9 +109,9 @@ test_named(hid_t file)
/*-------------------------------------------------------------------------
- * Function: test_noconv
+ * Function: test_conv
*
- * Purpose: Tests creation of datasets when no conversion is present.
+ * Purpose: Tests writing and read data
*
* Return: Success: 0
*
@@ -119,24 +119,32 @@ test_named(hid_t file)
*
* Programmer: Robb Matzke
* Monday, January 4, 1999
+ *
+ * Raymond Lu
+ * 12 October 2012
+ * I added tests for enum-integer and enum-float conversions
*-------------------------------------------------------------------------
*/
static int
-test_noconv(hid_t file)
+test_conv(hid_t file)
{
hid_t cwg=-1, type=-1, space=-1, dset=-1;
c_e1 val;
+ /* Some values are out of range for testing. The library should accept them */
static c_e1 data1[]={E1_RED, E1_GREEN, E1_BLUE, E1_GREEN, E1_WHITE,
E1_WHITE, E1_BLACK, E1_GREEN, E1_BLUE, E1_RED,
E1_RED, E1_BLUE, E1_GREEN, E1_BLACK, E1_WHITE,
- E1_RED, E1_WHITE, E1_GREEN, E1_GREEN, E1_BLUE};
+ E1_RED, E1_WHITE, (c_e1)0, (c_e1)-1, (c_e1)-2};
c_e1 data2[NELMTS(data1)];
+ short data_short[NELMTS(data1)];
+ int data_int[NELMTS(data1)];
+ double data_double[NELMTS(data1)];
hsize_t ds_size[1]={NELMTS(data1)};
size_t i;
- TESTING("no-conversion datasets");
+ TESTING("enumeration conversions");
- if((cwg = H5Gcreate2(file, "test_noconv", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if((cwg = H5Gcreate2(file, "test_conv", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
if((type = H5Tcreate(H5T_ENUM, sizeof(c_e1))) < 0) FAIL_STACK_ERROR
if(H5Tenum_insert(type, "RED", CPTR(val, E1_RED )) < 0) FAIL_STACK_ERROR
@@ -146,20 +154,96 @@ test_noconv(hid_t file)
if(H5Tenum_insert(type, "BLACK", CPTR(val, E1_BLACK)) < 0) FAIL_STACK_ERROR
if((space = H5Screate_simple(1, ds_size, NULL)) < 0) FAIL_STACK_ERROR
- if((dset = H5Dcreate2(cwg, "color_table", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+
+ /***************************************
+ * Dataset of enumeration type
+ ***************************************/
+ /* Create a dataset of enum type and write enum data to it */
+ if((dset = H5Dcreate2(cwg, "color_table1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
if(H5Dwrite(dset, type, space, space, H5P_DEFAULT, data1) < 0) FAIL_STACK_ERROR
+
+ /* Test reading back the data with no conversion */
if(H5Dread(dset, type, space, space, H5P_DEFAULT, data2) < 0) FAIL_STACK_ERROR
for(i = 0; i < (size_t)ds_size[0]; i++)
if(data1[i] != data2[i]) {
H5_FAILED();
- printf(" data1[%lu]=%d, data2[%lu]=%d (should be same)\n",
+ printf(" 1. data1[%lu]=%d, data2[%lu]=%d (should be same)\n",
(unsigned long)i, (int)(data1[i]),
(unsigned long)i, (int)(data2[i]));
goto error;
} /* end if */
+ /* Test converting the data to integer. Read enum data back as integer */
+ if(H5Dread(dset, H5T_NATIVE_SHORT, space, space, H5P_DEFAULT, data_short) < 0) FAIL_STACK_ERROR
+
+ for(i = 0; i < (size_t)ds_size[0]; i++)
+ if((short)data1[i] != data_short[i]) {
+ H5_FAILED();
+ printf(" 2. data1[%lu]=%d, data_short[%lu]=%d (should be same)\n",
+ (unsigned long)i, (int)(data1[i]),
+ (unsigned long)i, (int)(data_short[i]));
+ goto error;
+ } /* end if */
+
+ /* Test converting the data to floating number. Read enum data back as floating number */
+ if(H5Dread(dset, H5T_NATIVE_DOUBLE, space, space, H5P_DEFAULT, data_double) < 0) FAIL_STACK_ERROR
+
+ for(i = 0; i < (size_t)ds_size[0]; i++)
+ if((int)data1[i] != (int)data_double[i]) {
+ H5_FAILED();
+ printf(" 3. data1[%lu]=%d, data_double[%lu]=%d (should be same)\n",
+ (unsigned long)i, (int)(data1[i]),
+ (unsigned long)i, (int)(data_double[i]));
+ goto error;
+ } /* end if */
+
+ if(H5Dclose(dset) < 0) FAIL_STACK_ERROR
+
+ /***************************************
+ * Dataset of integer type
+ ***************************************/
+ /* Create a dataset of native integer and write enum data to it */
+ if((dset = H5Dcreate2(cwg, "color_table2", H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+
+ if(H5Dwrite(dset, type, space, space, H5P_DEFAULT, data1) < 0) FAIL_STACK_ERROR
+
+ /* Test reading back the data with no conversion */
+ if(H5Dread(dset, H5T_NATIVE_INT, space, space, H5P_DEFAULT, data_int) < 0) FAIL_STACK_ERROR
+
+ for(i = 0; i < (size_t)ds_size[0]; i++)
+ if((int)data1[i] != data_int[i]) {
+ H5_FAILED();
+ printf(" 4. data1[%lu]=%d, data_int[%lu]=%d (should be same)\n",
+ (unsigned long)i, (int)(data1[i]),
+ (unsigned long)i, (int)(data_int[i]));
+ goto error;
+ } /* end if */
+
if(H5Dclose(dset) < 0) FAIL_STACK_ERROR
+
+ /***************************************
+ * Dataset of double type
+ ***************************************/
+ /* Create a dataset of native double and write enum data to it */
+ if((dset = H5Dcreate2(cwg, "color_table3", H5T_NATIVE_DOUBLE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+
+ if(H5Dwrite(dset, type, space, space, H5P_DEFAULT, data1) < 0) FAIL_STACK_ERROR
+
+ /* Test reading back the data with no conversion */
+ if(H5Dread(dset, H5T_NATIVE_DOUBLE, space, space, H5P_DEFAULT, data_double) < 0) FAIL_STACK_ERROR
+
+ for(i = 0; i < (size_t)ds_size[0]; i++)
+ if((int)data1[i] != (int)data_double[i]) {
+ H5_FAILED();
+ printf(" 5. data1[%lu]=%d, data_double[%lu]=%d (should be same)\n",
+ (unsigned long)i, (int)(data1[i]),
+ (unsigned long)i, (int)(data_double[i]));
+ goto error;
+ } /* end if */
+
+ if(H5Dclose(dset) < 0) FAIL_STACK_ERROR
+
if(H5Sclose(space) < 0) FAIL_STACK_ERROR
if(H5Tclose(type) < 0) FAIL_STACK_ERROR
if(H5Gclose(cwg) < 0) FAIL_STACK_ERROR
@@ -572,7 +656,7 @@ main(void)
/* Tests */
nerrors += test_named(file);
- nerrors += test_noconv(file);
+ nerrors += test_conv(file);
nerrors += test_tr1(file);
nerrors += test_tr2(file);
nerrors += test_value_dsnt_exist();
diff --git a/test/file_image.c b/test/file_image.c
index 9d7a48c..c734db8 100644
--- a/test/file_image.c
+++ b/test/file_image.c
@@ -163,6 +163,7 @@ error:
return retval;
} /* end test_properties() */
+
/******************************************************************************
* Function: malloc_cb
*
@@ -185,6 +186,7 @@ malloc_cb(size_t size, H5FD_file_image_op_t op, void *udata)
return HDmalloc(size);
}
+
/******************************************************************************
* Function: memcpy_cb
*
@@ -207,6 +209,7 @@ memcpy_cb(void *dest, const void *src, size_t size, H5FD_file_image_op_t op, voi
return HDmemcpy(dest, src, size);
}
+
/******************************************************************************
* Function: realloc_cb
*
@@ -229,6 +232,7 @@ realloc_cb(void *ptr, size_t size, H5FD_file_image_op_t op, void *udata)
return HDrealloc(ptr,size);
}
+
/******************************************************************************
* Function: free_cb
*
@@ -250,6 +254,7 @@ free_cb(void *ptr, H5FD_file_image_op_t op, void *udata)
return(SUCCEED);
}
+
/******************************************************************************
* Function: udata_copy_cb
*
@@ -273,6 +278,7 @@ udata_copy_cb(void *udata)
return udata;
}
+
/******************************************************************************
* Function: udata_free_cb
*
@@ -296,6 +302,7 @@ udata_free_cb(void *udata)
return(SUCCEED);
}
+
/******************************************************************************
* Function: reset_udata
*
@@ -314,6 +321,7 @@ reset_udata(udata_t *u)
u->malloc_src = u->memcpy_src = u->realloc_src = u->free_src = H5FD_FILE_IMAGE_OP_NO_OP;
}
+
/******************************************************************************
* Function: test_callbacks
*
@@ -502,6 +510,7 @@ error:
return 1;
} /* test_callbacks() */
+
/******************************************************************************
* Function: test_core
*
@@ -647,6 +656,7 @@ error:
return 1;
} /* end test_core() */
+
/******************************************************************************
* Function: test_get_file_image
*
@@ -899,6 +909,7 @@ error:
return 1;
} /* end test_get_file_image() */
+
/******************************************************************************
* Function: test_get_file_image_error_rejection
*
@@ -1282,7 +1293,7 @@ main(void)
/* test H5Fget_file_image() with sec2 driver */
fapl = H5Pcreate(H5P_FILE_ACCESS);
- if(0 > H5Pset_fapl_sec2(fapl))
+ if(H5Pset_fapl_sec2(fapl) < 0)
errors++;
else
errors += test_get_file_image("H5Fget_file_image() with sec2 driver",
@@ -1290,7 +1301,7 @@ main(void)
/* test H5Fget_file_image() with stdio driver */
fapl = H5Pcreate(H5P_FILE_ACCESS);
- if(0 > H5Pset_fapl_stdio(fapl))
+ if(H5Pset_fapl_stdio(fapl) < 0)
errors++;
else
errors += test_get_file_image("H5Fget_file_image() with stdio driver",
@@ -1298,7 +1309,7 @@ main(void)
/* test H5Fget_file_image() with core driver */
fapl = H5Pcreate(H5P_FILE_ACCESS);
- if(0 > H5Pset_fapl_core(fapl, (size_t)(64 *1024), TRUE))
+ if(H5Pset_fapl_core(fapl, (size_t)(64 *1024), TRUE) < 0)
errors++;
else
errors += test_get_file_image("H5Fget_file_image() with core driver",
diff --git a/test/gen_plist.c b/test/gen_plist.c
new file mode 100644
index 0000000..b4da261
--- /dev/null
+++ b/test/gen_plist.c
@@ -0,0 +1,435 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * generate plist file
+ */
+
+#include <assert.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include "H5private.h"
+#include "hdf5.h"
+
+static int encode_plist(hid_t plist_id, int little_endian, const char *filename_le, const char *filename_be);
+
+int
+main(void)
+{
+ hid_t dcpl1; /* dataset create prop. list */
+ hid_t dapl1; /* dataset access prop. list */
+ hid_t dxpl1; /* dataset xfer prop. list */
+ hid_t gcpl1; /* group create prop. list */
+ hid_t ocpypl1; /* object copy prop. list */
+ hid_t ocpl1; /* object create prop. list */
+ hid_t lcpl1; /* link create prop. list */
+ hid_t lapl1; /* link access prop. list */
+ hid_t fapl1; /* file access prop. list */
+ hid_t fcpl1; /* file create prop. list */
+ hid_t strcpl1; /* string create prop. list */
+ hid_t acpl1; /* attribute create prop. list */
+
+ herr_t ret = 0;
+ hsize_t chunk_size = 16384; /* chunk size */
+ int fill = 2; /* Fill value */
+ hsize_t max_size[1]; /* data space maximum size */
+ size_t nslots = 521 * 2;
+ size_t nbytes = 1048576 * 10;
+ double w0 = 0.5f;
+ unsigned max_compact;
+ unsigned min_dense;
+ const char* c_to_f = "x+32";
+ int little_endian;
+ H5AC_cache_config_t my_cache_config = {
+ H5AC__CURR_CACHE_CONFIG_VERSION,
+ 1 /*TRUE*/,
+ 0 /*FALSE*/,
+ 0 /*FALSE*/,
+ "temp",
+ 1 /*TRUE*/,
+ 0 /*FALSE*/,
+ ( 2 * 2048 * 1024),
+ 0.3f,
+ (64 * 1024 * 1024),
+ (4 * 1024 * 1024),
+ 60000,
+ H5C_incr__threshold,
+ 0.8f,
+ 3.0f,
+ 1 /*TRUE*/,
+ (8 * 1024 * 1024),
+ H5C_flash_incr__add_space,
+ 2.0f,
+ 0.25f,
+ H5C_decr__age_out_with_threshold,
+ 0.997f,
+ 0.8f,
+ 1 /*TRUE*/,
+ (3 * 1024 * 1024),
+ 3,
+ 0 /*FALSE*/,
+ 0.2f,
+ (256 * 2048),
+ H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY};
+
+ /* check endianess */
+ {
+ short int word = 0x0001;
+ char *byte = (char *) &word;
+
+ if(byte[0] == 1)
+ /* little endian */
+ little_endian = 1;
+ else
+ /* big endian */
+ little_endian = 0;
+ }
+
+ /* Explicitly initialize the library, since we are including the private header file */
+ H5open();
+
+ /******* ENCODE/DECODE DCPLS *****/
+ if((dcpl1 = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ assert(dcpl1 > 0);
+
+ if((ret = H5Pset_chunk(dcpl1, 1, &chunk_size)) < 0)
+ assert(ret > 0);
+
+ if((ret = H5Pset_alloc_time(dcpl1, H5D_ALLOC_TIME_LATE)) < 0)
+ assert(ret > 0);
+
+ ret = H5Tconvert(H5T_NATIVE_INT, H5T_STD_I32BE, (size_t)1, &fill, NULL, H5P_DEFAULT);
+ assert(ret >= 0);
+ if((ret = H5Pset_fill_value(dcpl1, H5T_STD_I32BE, &fill)) < 0)
+ assert(ret > 0);
+
+ max_size[0] = 100;
+ if((ret = H5Pset_external(dcpl1, "ext1.data", (off_t)0,
+ (hsize_t)(max_size[0] * sizeof(int)/4))) < 0)
+ assert(ret > 0);
+ if((ret = H5Pset_external(dcpl1, "ext2.data", (off_t)0,
+ (hsize_t)(max_size[0] * sizeof(int)/4))) < 0)
+ assert(ret > 0);
+ if((ret = H5Pset_external(dcpl1, "ext3.data", (off_t)0,
+ (hsize_t)(max_size[0] * sizeof(int)/4))) < 0)
+ assert(ret > 0);
+ if((ret = H5Pset_external(dcpl1, "ext4.data", (off_t)0,
+ (hsize_t)(max_size[0] * sizeof(int)/4))) < 0)
+ assert(ret > 0);
+
+ if((ret = encode_plist(dcpl1, little_endian, "testfiles/plist_files/dcpl_le", "testfiles/plist_files/dcpl_be")) < 0)
+ assert(ret > 0);
+
+ /* release resource */
+ if((ret = H5Pclose(dcpl1)) < 0)
+ assert(ret > 0);
+
+
+ /******* ENCODE/DECODE DAPLS *****/
+ if((dapl1 = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ assert(dapl1 > 0);
+
+ if((ret = H5Pset_chunk_cache(dapl1, nslots, nbytes, w0)) < 0)
+ assert(ret > 0);
+
+ if((ret = encode_plist(dapl1, little_endian, "testfiles/plist_files/dapl_le", "testfiles/plist_files/dapl_be")) < 0)
+ assert(ret > 0);
+
+ /* release resource */
+ if((ret = H5Pclose(dapl1)) < 0)
+ assert(ret > 0);
+
+ /******* ENCODE/DECODE DXPLS *****/
+ if((dxpl1 = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ assert(dxpl1 > 0);
+ if((ret = H5Pset_btree_ratios(dxpl1, 0.2f, 0.6f, 0.2f)) < 0)
+ assert(ret > 0);
+ if((ret = H5Pset_hyper_vector_size(dxpl1, 5)) < 0)
+ assert(ret > 0);
+#ifdef H5_HAVE_PARALLEL
+ if((ret = H5Pset_dxpl_mpio(dxpl1, H5FD_MPIO_COLLECTIVE)) < 0)
+ assert(ret > 0);
+ if((ret = H5Pset_dxpl_mpio_collective_opt(dxpl1, H5FD_MPIO_INDIVIDUAL_IO)) < 0)
+ assert(ret > 0);
+ if((ret = H5Pset_dxpl_mpio_chunk_opt(dxpl1, H5FD_MPIO_CHUNK_MULTI_IO)) < 0)
+ assert(ret > 0);
+ if((ret = H5Pset_dxpl_mpio_chunk_opt_ratio(dxpl1, 30)) < 0)
+ assert(ret > 0);
+ if((ret = H5Pset_dxpl_mpio_chunk_opt_num(dxpl1, 40)) < 0)
+ assert(ret > 0);
+#endif/* H5_HAVE_PARALLEL */
+ if((ret = H5Pset_edc_check(dxpl1, H5Z_DISABLE_EDC)) < 0)
+ assert(ret > 0);
+ if((ret = H5Pset_data_transform(dxpl1, c_to_f)) < 0)
+ assert(ret > 0);
+
+ if((ret = encode_plist(dxpl1, little_endian, "testfiles/plist_files/dxpl_le", "testfiles/plist_files/dxpl_be")) < 0)
+ assert(ret > 0);
+
+ /* release resource */
+ if((ret = H5Pclose(dxpl1)) < 0)
+ assert(ret > 0);
+
+
+ /******* ENCODE/DECODE GCPLS *****/
+ if((gcpl1 = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ assert(gcpl1 > 0);
+
+ if((ret = H5Pset_local_heap_size_hint(gcpl1, 256)) < 0)
+ assert(ret > 0);
+
+ if((ret = H5Pset_link_phase_change(gcpl1, 2, 2)) < 0)
+ assert(ret > 0);
+
+ /* Query the group creation properties */
+ if((ret = H5Pget_link_phase_change(gcpl1, &max_compact, &min_dense)) < 0)
+ assert(ret > 0);
+
+ if((ret = H5Pset_est_link_info(gcpl1, 3, 9)) < 0)
+ assert(ret > 0);
+
+ if((ret = H5Pset_link_creation_order(gcpl1, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED))) < 0)
+ assert(ret > 0);
+
+ if((ret = encode_plist(gcpl1, little_endian, "testfiles/plist_files/gcpl_le", "testfiles/plist_files/gcpl_be")) < 0)
+ assert(ret > 0);
+
+ /* release resource */
+ if((ret = H5Pclose(gcpl1)) < 0)
+ assert(ret > 0);
+
+ /******* ENCODE/DECODE LCPLS *****/
+ if((lcpl1 = H5Pcreate(H5P_LINK_CREATE)) < 0)
+ assert(lcpl1 > 0);
+
+ if((ret = H5Pset_create_intermediate_group(lcpl1, 1 /*TRUE*/)) < 0)
+ assert(ret > 0);
+
+ if((ret = encode_plist(lcpl1, little_endian, "testfiles/plist_files/lcpl_le", "testfiles/plist_files/lcpl_be")) < 0)
+ assert(ret > 0);
+
+ /* release resource */
+ if((ret = H5Pclose(lcpl1)) < 0)
+ assert(ret > 0);
+
+ /******* ENCODE/DECODE OCPYLS *****/
+ if((ocpypl1 = H5Pcreate(H5P_OBJECT_COPY)) < 0)
+ assert(ocpypl1 > 0);
+
+ ret = H5Pset_copy_object(ocpypl1, H5O_COPY_EXPAND_EXT_LINK_FLAG);
+ assert(ret >= 0);
+
+ ret = H5Padd_merge_committed_dtype_path(ocpypl1, "foo");
+ assert(ret >= 0);
+
+ ret = H5Padd_merge_committed_dtype_path(ocpypl1, "bar");
+ assert(ret >= 0);
+
+ if((ret = encode_plist(ocpypl1, little_endian, "testfiles/plist_files/ocpypl_le", "testfiles/plist_files/ocpypl_be")) < 0)
+ assert(ret > 0);
+
+ /* release resource */
+ if((ret = H5Pclose(ocpypl1)) < 0)
+ assert(ret > 0);
+
+ /******* ENCODE/DECODE OCPLS *****/
+ if((ocpl1 = H5Pcreate(H5P_OBJECT_CREATE)) < 0)
+ assert(ocpl1 > 0);
+
+ if((ret = H5Pset_attr_creation_order(ocpl1, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED))) < 0)
+ assert(ret > 0);
+
+ if((ret = H5Pset_attr_phase_change (ocpl1, 110, 105)) < 0)
+ assert(ret > 0);
+
+ if((ret = H5Pset_filter (ocpl1, H5Z_FILTER_FLETCHER32, 0, (size_t)0, NULL)) < 0)
+ assert(ret > 0);
+
+ if((ret = encode_plist(ocpl1, little_endian, "testfiles/plist_files/ocpl_le", "testfiles/plist_files/ocpl_be")) < 0)
+ assert(ret > 0);
+
+ /* release resource */
+ if((ret = H5Pclose(ocpl1)) < 0)
+ assert(ret > 0);
+
+ /******* ENCODE/DECODE LAPLS *****/
+ if((lapl1 = H5Pcreate(H5P_LINK_ACCESS)) < 0)
+ assert(lapl1 > 0);
+
+ if((ret = H5Pset_nlinks(lapl1, (size_t)134)) < 0)
+ assert(ret > 0);
+
+ if((ret = H5Pset_elink_acc_flags(lapl1, H5F_ACC_RDONLY)) < 0)
+ assert(ret > 0);
+
+ if((ret = H5Pset_elink_prefix(lapl1, "/tmpasodiasod")) < 0)
+ assert(ret > 0);
+
+ /* Create FAPL for the elink FAPL */
+ if((fapl1 = ret = H5Pcreate(ret = H5P_FILE_ACCESS)) < 0)
+ assert(ret > 0);
+ if((ret = H5Pset_alignment(fapl1, 2, 1024)) < 0)
+ assert(ret > 0);
+
+ if((ret = H5Pset_elink_fapl(lapl1, fapl1)) < 0)
+ assert(ret > 0);
+
+ /* Close the elink's FAPL */
+ if((ret = H5Pclose(fapl1)) < 0)
+ assert(ret > 0);
+
+ if((ret = encode_plist(lapl1, little_endian, "testfiles/plist_files/lapl_le", "testfiles/plist_files/lapl_be")) < 0)
+ assert(ret > 0);
+
+ /* release resource */
+ if((ret = H5Pclose(lapl1)) < 0)
+ assert(ret > 0);
+
+ /******* ENCODE/DECODE FAPLS *****/
+ if((fapl1 = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ assert(fapl1 > 0);
+
+ if((ret = H5Pset_family_offset(fapl1, 1024)) < 0)
+ assert(ret > 0);
+ if((ret = H5Pset_meta_block_size(fapl1, 2098452)) < 0)
+ assert(ret > 0);
+ if((ret = H5Pset_sieve_buf_size(fapl1, 1048576)) < 0)
+ assert(ret > 0);
+ if((ret = H5Pset_alignment(fapl1, 2, 1024)) < 0)
+ assert(ret > 0);
+ if((ret = H5Pset_cache(fapl1, 1024, 128, 10485760, 0.3f)) < 0)
+ assert(ret > 0);
+ if((ret = H5Pset_elink_file_cache_size(fapl1, 10485760)) < 0)
+ assert(ret > 0);
+ if((ret = H5Pset_gc_references(fapl1, 1)) < 0)
+ assert(ret > 0);
+ if((ret = H5Pset_small_data_block_size(fapl1, 2048)) < 0)
+ assert(ret > 0);
+ if((ret = H5Pset_libver_bounds(fapl1, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST)) < 0)
+ assert(ret > 0);
+ if((ret = H5Pset_fclose_degree(fapl1, H5F_CLOSE_WEAK)) < 0)
+ assert(ret > 0);
+ if((ret = H5Pset_multi_type(fapl1, H5FD_MEM_GHEAP)) < 0)
+ assert(ret > 0);
+ if((ret = H5Pset_mdc_config(fapl1, &my_cache_config)) < 0)
+ assert(ret > 0);
+
+ if((ret = encode_plist(fapl1, little_endian, "testfiles/plist_files/fapl_le", "testfiles/plist_files/fapl_be")) < 0)
+ assert(ret > 0);
+
+ /* release resource */
+ if((ret = H5Pclose(fapl1)) < 0)
+ assert(ret > 0);
+
+ /******* ENCODE/DECODE FCPLS *****/
+ if((fcpl1 = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ assert(fcpl1 > 0);
+
+ if((ret = H5Pset_userblock(fcpl1, 1024) < 0))
+ assert(ret > 0);
+
+ if((ret = H5Pset_istore_k(fcpl1, 3) < 0))
+ assert(ret > 0);
+
+ if((ret = H5Pset_sym_k(fcpl1, 4, 5) < 0))
+ assert(ret > 0);
+
+ if((ret = H5Pset_shared_mesg_nindexes(fcpl1, 8) < 0))
+ assert(ret > 0);
+
+ if((ret = H5Pset_shared_mesg_index(fcpl1, 1, H5O_SHMESG_SDSPACE_FLAG, 32) < 0))
+ assert(ret > 0);
+
+ if((ret = H5Pset_shared_mesg_phase_change(fcpl1, 60, 20) < 0))
+ assert(ret > 0);
+
+ if((ret = H5Pset_sizes(fcpl1, 8, 4) < 0))
+ assert(ret > 0);
+
+ if((ret = encode_plist(fcpl1, little_endian, "testfiles/plist_files/fcpl_le", "testfiles/plist_files/fcpl_be")) < 0)
+ assert(ret > 0);
+
+ /* release resource */
+ if((ret = H5Pclose(fcpl1)) < 0)
+ assert(ret > 0);
+
+ /******* ENCODE/DECODE STRCPLS *****/
+ strcpl1 = H5Pcreate(H5P_STRING_CREATE);
+ assert(strcpl1 > 0);
+
+ ret = H5Pset_char_encoding(strcpl1, H5T_CSET_UTF8);
+ assert(ret >= 0);
+
+ ret = encode_plist(strcpl1, little_endian, "testfiles/plist_files/strcpl_le", "testfiles/plist_files/strcpl_be");
+ assert(ret > 0);
+
+ /* release resource */
+ ret = H5Pclose(strcpl1);
+ assert(ret >= 0);
+
+ /******* ENCODE/DECODE ACPLS *****/
+ acpl1 = H5Pcreate(H5P_ATTRIBUTE_CREATE);
+ assert(acpl1 > 0);
+
+ ret = H5Pset_char_encoding(acpl1, H5T_CSET_UTF8);
+ assert(ret >= 0);
+
+ ret = encode_plist(acpl1, little_endian, "testfiles/plist_files/acpl_le", "testfiles/plist_files/acpl_be");
+ assert(ret > 0);
+
+ /* release resource */
+ ret = H5Pclose(acpl1);
+ assert(ret >= 0);
+
+ return 0;
+}
+
+static int
+encode_plist(hid_t plist_id, int little_endian, const char *filename_le, const char *filename_be)
+{
+ int fd = 0; /* file descriptor */
+ herr_t ret = 0;
+ void *temp_buf = NULL;
+ size_t temp_size = 0;
+ ssize_t write_size;
+
+ /* first call to encode returns only the size of the buffer needed */
+ if((ret = H5Pencode(plist_id, NULL, &temp_size)) < 0)
+ assert(ret > 0);
+
+ temp_buf = (void *)HDmalloc(temp_size);
+ assert(temp_buf);
+
+ if((ret = H5Pencode(plist_id, temp_buf, &temp_size)) < 0)
+ assert(ret > 0);
+
+ if(little_endian)
+ fd = HDopen(filename_le, O_RDWR | O_CREAT | O_TRUNC, 0666);
+ else
+ fd = HDopen(filename_be, O_RDWR | O_CREAT | O_TRUNC, 0666);
+ assert(fd > 0);
+
+ write_size = HDwrite(fd, temp_buf, temp_size);
+ assert(write_size == (ssize_t)temp_size);
+
+ HDclose(fd);
+
+ HDfree(temp_buf);
+
+ return 1;
+}
+
diff --git a/test/h5test.c b/test/h5test.c
index ea30fad..91497e3 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -408,7 +408,7 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size)
if (!fullname[0])
/* We didn't append the prefix yet */
- HDstrncpy(fullname, prefix, MIN(strlen(prefix), size));
+ HDstrncpy(fullname, prefix, MIN(HDstrlen(prefix), size));
if (HDstrlen(fullname) + HDstrlen(base_name) + 1 < size) {
/*
@@ -751,7 +751,7 @@ h5_set_info_object(void)
/* copy key/value pair into temporary buffer */
len = strcspn(valp, ";");
next = &valp[len];
- key_val = calloc(1, len + 1);
+ key_val = (char *)calloc(1, len + 1);
/* increment the next pointer past the terminating semicolon */
if (*next == ';')
@@ -766,7 +766,7 @@ h5_set_info_object(void)
if (!*namep) continue; /* was all white space, so move to next k/v pair */
/* eat up any ending white spaces */
- endp = &namep[strlen(namep) - 1];
+ endp = &namep[HDstrlen(namep) - 1];
while (endp && (*endp == ' ' || *endp == '\t'))
*endp-- = '\0';
@@ -1061,7 +1061,7 @@ getenv_all(MPI_Comm comm, int root, const char* name)
if(mpi_rank == root) {
env = HDgetenv(name);
if(env) {
- len = HDstrlen(env);
+ len = (int)HDstrlen(env);
MPI_Bcast(&len, 1, MPI_INT, root, comm);
MPI_Bcast(env, len, MPI_CHAR, root, comm);
}
@@ -1075,9 +1075,9 @@ getenv_all(MPI_Comm comm, int root, const char* name)
MPI_Bcast(&len, 1, MPI_INT, root, comm);
if(len >= 0) {
if(env == NULL)
- env = (char*) HDmalloc(len+1);
- else if(strlen(env) < len)
- env = (char*) HDrealloc(env, len+1);
+ env = (char*) HDmalloc((size_t)len+1);
+ else if(HDstrlen(env) < (size_t)len)
+ env = (char*) HDrealloc(env, (size_t)len+1);
MPI_Bcast(env, len, MPI_CHAR, root, comm);
env[len] = '\0';
@@ -1129,7 +1129,11 @@ h5_make_local_copy(const char *origfilename, const char *local_copy_name)
#ifdef H5_VMS
HDstrcat(filename, origfilename);
#else
- char * srcdir = HDgetenv("srcdir"); /* The source directory */
+ const char * srcdir = HDgetenv("srcdir"); /* The source directory */
+
+ /* Check for using the srcdir from configure time */
+ if(NULL == srcdir)
+ srcdir = config_srcdir;
if(srcdir && ((HDstrlen(srcdir) +
HDstrlen(origfilename) + 6) < FILENAME_BUF_SIZE)) {
diff --git a/test/h5test.h b/test/h5test.h
index dd38546..7813b51 100644
--- a/test/h5test.h
+++ b/test/h5test.h
@@ -104,6 +104,7 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */
#define H5_FAILED() {puts("*FAILED*");fflush(stdout);}
#define H5_WARNING() {puts("*WARNING*");fflush(stdout);}
#define SKIPPED() {puts(" -SKIP-");fflush(stdout);}
+#define PUTS_ERROR(s) {puts(s); AT(); goto error;}
#define TEST_ERROR {H5_FAILED(); AT(); goto error;}
#define STACK_ERROR {H5Eprint2(H5E_DEFAULT, stdout); goto error;}
#define FAIL_STACK_ERROR {H5_FAILED(); AT(); H5Eprint2(H5E_DEFAULT, stdout); \
@@ -175,7 +176,7 @@ H5TEST_DLL void ParseTestVerbosity(char *argv);
H5TEST_DLL int GetTestNumErrs(void);
H5TEST_DLL void IncTestNumErrs(void);
H5TEST_DLL const void *GetTestParameters(void);
-H5TEST_DLL int TestErrPrintf(const char *format, ...);
+H5TEST_DLL int TestErrPrintf(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
H5TEST_DLL void SetTest(const char *testname, int action);
H5TEST_DLL void TestAlarmOn(void);
H5TEST_DLL void TestAlarmOff(void);
diff --git a/test/links.c b/test/links.c
index 966802a..d77b371 100644
--- a/test/links.c
+++ b/test/links.c
@@ -1884,7 +1884,7 @@ external_link_root(hid_t fapl, hbool_t new_format)
/* Check that all file IDs have been closed */
if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR
- if(H5F_sfile_assert_num(0) != 0) TEST_ERROR
+ H5F_sfile_assert_num(0);
/* Open first file again with read-only access and check on objects created */
if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
@@ -1908,7 +1908,7 @@ external_link_root(hid_t fapl, hbool_t new_format)
/* Check that all file IDs have been closed */
if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR
- if(H5F_sfile_assert_num(0) != 0) TEST_ERROR
+ H5F_sfile_assert_num(0);
/* Verify that new objects can't be created through a read-only external
* link.
@@ -1925,7 +1925,7 @@ external_link_root(hid_t fapl, hbool_t new_format)
/* Check that all file IDs have been closed */
if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR
- if(H5F_sfile_assert_num(0) != 0) TEST_ERROR
+ H5F_sfile_assert_num(0);
PASSED();
return 0;
@@ -6754,8 +6754,7 @@ external_file_cache(hid_t fapl, hbool_t new_format)
TEST_ERROR
/* Verify that only 1 file is open */
- if(H5F_sfile_assert_num(1) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(1);
/* Open and close the target of the external link */
if((oid = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0)
@@ -6764,16 +6763,14 @@ external_file_cache(hid_t fapl, hbool_t new_format)
TEST_ERROR
/* Verify that both files are now open */
- if(H5F_sfile_assert_num(2) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(2);
/* Close file 1 */
if(H5Fclose(fid1) < 0)
TEST_ERROR
/* Verify that both files are now closed */
- if(H5F_sfile_assert_num(0) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
/*
@@ -6795,8 +6792,7 @@ external_file_cache(hid_t fapl, hbool_t new_format)
TEST_ERROR
/* Verify that only 1 file is open */
- if(H5F_sfile_assert_num(1) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(1);
/* Open and close the target of the external link */
if((oid = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0)
@@ -6805,24 +6801,21 @@ external_file_cache(hid_t fapl, hbool_t new_format)
TEST_ERROR
/* Verify that both files are now open */
- if(H5F_sfile_assert_num(2) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(2);
/* Release file 1's EFC */
if(H5Fclear_elink_file_cache(fid1) < 0)
TEST_ERROR
/* Verify that only the parent file is now open */
- if(H5F_sfile_assert_num(1) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(1);
/* Close file 1 */
if(H5Fclose(fid1) < 0)
TEST_ERROR
/* Verify that both files are now closed */
- if(H5F_sfile_assert_num(0) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
/*
@@ -6858,8 +6851,7 @@ external_file_cache(hid_t fapl, hbool_t new_format)
TEST_ERROR
/* Verify that only 1 file is open */
- if(H5F_sfile_assert_num(1) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(1);
/* Open and close one branch of the tree */
if((oid = H5Oopen(fid1, "link_to_2/link_to_3", H5P_DEFAULT)) < 0)
@@ -6868,8 +6860,7 @@ external_file_cache(hid_t fapl, hbool_t new_format)
TEST_ERROR
/* Verify that files 2 and 3 are now open */
- if(H5F_sfile_assert_num(3) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(3);
/* Open and close the other branch of the tree */
if((oid = H5Oopen(fid1, "link_to_2/link_to_4", H5P_DEFAULT)) < 0)
@@ -6878,16 +6869,14 @@ external_file_cache(hid_t fapl, hbool_t new_format)
TEST_ERROR
/* Verify that all files are now open */
- if(H5F_sfile_assert_num(4) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(4);
/* Close file 1 */
if(H5Fclose(fid1) < 0)
TEST_ERROR
/* Verify that all files are now closed */
- if(H5F_sfile_assert_num(0) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
/*
@@ -6923,8 +6912,7 @@ external_file_cache(hid_t fapl, hbool_t new_format)
TEST_ERROR
/* Verify that only 1 file is open */
- if(H5F_sfile_assert_num(1) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(1);
/* Open and close one branch of the tree */
if((oid = H5Oopen(fid1, "link_to_2/link_to_3", H5P_DEFAULT)) < 0)
@@ -6933,8 +6921,7 @@ external_file_cache(hid_t fapl, hbool_t new_format)
TEST_ERROR
/* Verify that files 2 and 3 are now open */
- if(H5F_sfile_assert_num(3) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(3);
/* Open and close the other branch of the tree */
if((oid = H5Oopen(fid1, "link_to_2/link_to_4", H5P_DEFAULT)) < 0)
@@ -6943,24 +6930,21 @@ external_file_cache(hid_t fapl, hbool_t new_format)
TEST_ERROR
/* Verify that all files are now open */
- if(H5F_sfile_assert_num(4) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(4);
/* Release file 1's EFC */
if(H5Fclear_elink_file_cache(fid1) < 0)
TEST_ERROR
/* Verify that only file 1 is now open */
- if(H5F_sfile_assert_num(1) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(1);
/* Close file 1 */
if(H5Fclose(fid1) < 0)
TEST_ERROR
/* Verify that all files are now closed */
- if(H5F_sfile_assert_num(0) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
#ifndef H5_CANNOT_OPEN_TWICE
/*
@@ -6992,8 +6976,7 @@ external_file_cache(hid_t fapl, hbool_t new_format)
TEST_ERROR
/* Verify that only 1 file is open */
- if(H5F_sfile_assert_num(1) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(1);
/* Open and close one complete cycle */
if((oid = H5Oopen(fid1, "link_to_2/link_to_3/link_to_1", H5P_DEFAULT)) < 0)
@@ -7002,16 +6985,14 @@ external_file_cache(hid_t fapl, hbool_t new_format)
TEST_ERROR
/* Verify that all files are now open */
- if(H5F_sfile_assert_num(3) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(3);
/* Close file 1 */
if(H5Fclose(fid1) < 0)
TEST_ERROR
/* Verify that all files are now closed */
- if(H5F_sfile_assert_num(0) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
/*
@@ -7043,8 +7024,7 @@ external_file_cache(hid_t fapl, hbool_t new_format)
TEST_ERROR
/* Verify that only 1 file is open */
- if(H5F_sfile_assert_num(1) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(1);
/* Open and close one complete cycle */
if((oid = H5Oopen(fid1, "link_to_2/link_to_3/link_to_1", H5P_DEFAULT)) < 0)
@@ -7053,24 +7033,21 @@ external_file_cache(hid_t fapl, hbool_t new_format)
TEST_ERROR
/* Verify that all files are now open */
- if(H5F_sfile_assert_num(3) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(3);
/* Release file 1's EFC */
if(H5Fclear_elink_file_cache(fid1) < 0)
TEST_ERROR
/* Verify that only file 1 is now open */
- if(H5F_sfile_assert_num(1) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(1);
/* Close file 1 */
if(H5Fclose(fid1) < 0)
TEST_ERROR
/* Verify that all files are now closed */
- if(H5F_sfile_assert_num(0) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
#endif /* H5_CANNOT_OPEN_TWICE */
/* Close fapl */
@@ -7165,8 +7142,7 @@ external_open_twice(hid_t fapl, hbool_t new_format)
TEST_ERROR
/* Verify that both files are now closed */
- if(H5F_sfile_assert_num(0) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
/*
@@ -7212,8 +7188,7 @@ external_open_twice(hid_t fapl, hbool_t new_format)
TEST_ERROR
/* Verify that both files are now closed */
- if(H5F_sfile_assert_num(0) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
/*
@@ -7263,8 +7238,7 @@ external_open_twice(hid_t fapl, hbool_t new_format)
TEST_ERROR
/* Verify that both files are now closed */
- if(H5F_sfile_assert_num(0) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
/*
@@ -7312,8 +7286,7 @@ external_open_twice(hid_t fapl, hbool_t new_format)
TEST_ERROR
/* Verify that both files are now closed */
- if(H5F_sfile_assert_num(0) < 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
PASSED();
diff --git a/test/mount.c b/test/mount.c
index b7180fa..2502bbe 100644
--- a/test/mount.c
+++ b/test/mount.c
@@ -1181,7 +1181,7 @@ test_close(hid_t fapl)
/* Check that all file IDs have been closed */
if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR
- if(H5F_sfile_assert_num(0) != 0) TEST_ERROR
+ H5F_sfile_assert_num(0);
/* Build the virtual file again */
if((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0 ||
@@ -1198,7 +1198,7 @@ test_close(hid_t fapl)
/* Check that all file IDs have been closed */
if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR
- if(H5F_sfile_assert_num(0) != 0) TEST_ERROR
+ H5F_sfile_assert_num(0);
/* Shut down */
PASSED();
@@ -1810,8 +1810,7 @@ test_missing_unmount(hid_t fapl)
/* Check that all file IDs have been closed */
if(H5I_nmembers(H5I_FILE) != 0)
TEST_ERROR
- if(H5F_sfile_assert_num(0) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
PASSED();
return 0;
@@ -1946,8 +1945,7 @@ test_hold_open_file(hid_t fapl)
/* Check that all file IDs have been closed */
if(H5I_nmembers(H5I_FILE) != 0)
TEST_ERROR
- if(H5F_sfile_assert_num(0) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
PASSED();
return 0;
@@ -2103,8 +2101,7 @@ test_hold_open_group(hid_t fapl)
/* Check that all file IDs have been closed */
if(H5I_nmembers(H5I_FILE) != 0)
TEST_ERROR
- if(H5F_sfile_assert_num(0) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
PASSED();
return 0;
@@ -2249,8 +2246,7 @@ test_fcdegree_same(hid_t fapl)
/* Check that all file IDs have been closed */
if(H5I_nmembers(H5I_FILE) != 0)
TEST_ERROR
- if(H5F_sfile_assert_num(0) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
PASSED();
return 0;
@@ -2391,8 +2387,7 @@ test_fcdegree_semi(hid_t fapl)
/* Check that all file IDs have been closed */
if(H5I_nmembers(H5I_FILE) != 0)
TEST_ERROR
- if(H5F_sfile_assert_num(0) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
PASSED();
return 0;
@@ -2530,8 +2525,7 @@ test_fcdegree_strong(hid_t fapl)
/* Check that all file IDs have been closed */
if(H5I_nmembers(H5I_FILE) != 0)
TEST_ERROR
- if(H5F_sfile_assert_num(0) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
PASSED();
return 0;
@@ -2733,8 +2727,7 @@ test_acc_perm(hid_t fapl)
/* Check that all file IDs have been closed */
if(H5I_nmembers(H5I_FILE) != 0)
TEST_ERROR
- if(H5F_sfile_assert_num(0) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
PASSED();
return 0;
@@ -2957,8 +2950,7 @@ test_mult_mount(hid_t fapl)
/* Check that all file IDs have been closed */
if(H5I_nmembers(H5I_FILE) != 0)
TEST_ERROR
- if(H5F_sfile_assert_num(0) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
PASSED();
return 0;
@@ -3179,8 +3171,7 @@ test_nested_survive(hid_t fapl)
/* Check that all file IDs have been closed */
if(H5I_nmembers(H5I_FILE) != 0)
TEST_ERROR
- if(H5F_sfile_assert_num(0) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
PASSED();
return 0;
@@ -3295,8 +3286,7 @@ test_close_parent(hid_t fapl)
TEST_ERROR
/* Both underlying shared files should be open still */
- if(H5F_sfile_assert_num(2) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(2);
/* Check the name of "M" is still defined */
*name = '\0';
@@ -3317,16 +3307,14 @@ test_close_parent(hid_t fapl)
TEST_ERROR
/* Just file #2's underlying shared file should be open still */
- if(H5F_sfile_assert_num(1) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(1);
/* Close group in file #2, letting file #2 close */
if(H5Gclose(gidM) < 0)
TEST_ERROR
/* All underlying shared file structs should be closed */
- if(H5F_sfile_assert_num(0) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
PASSED();
return 0;
@@ -3703,16 +3691,14 @@ test_cut_graph(hid_t fapl)
TEST_ERROR
/* Check that all seven underlying files are still opened */
- if(H5F_sfile_assert_num(7) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(7);
/* Close "M" in file #5, which should close files 2, 4 & 5 */
if(H5Gclose(gidM) < 0)
TEST_ERROR
/* Check that only four underlying files are still opened */
- if(H5F_sfile_assert_num(4) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(4);
/* Unmount file #3 from file #1, cutting the graph */
if(H5Funmount(gidQ, "/B") < 0)
@@ -3720,8 +3706,7 @@ test_cut_graph(hid_t fapl)
/* Check that only three underlying files are still opened */
/* (File #1 should close after being cut off from the graph) */
- if(H5F_sfile_assert_num(3) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(3);
/* Check the name of "Q" is defined in its file */
*name = '\0';
@@ -3749,8 +3734,7 @@ test_cut_graph(hid_t fapl)
TEST_ERROR
/* Verify that all underlying shared files have been closed now */
- if(H5F_sfile_assert_num(0) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
PASSED();
return 0;
@@ -3917,16 +3901,14 @@ test_symlink(hid_t fapl)
TEST_ERROR
/* Verify that all 3 underlying shared files are still open */
- if(H5F_sfile_assert_num(3) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(3);
/* Close object opened through soft link */
if(H5Gclose(gidL) < 0)
TEST_ERROR
/* Verify that all underlying shared files have been closed now */
- if(H5F_sfile_assert_num(0) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
PASSED();
return 0;
@@ -4036,8 +4018,7 @@ test_sharedacc(hid_t fapl)
/* Check that all file IDs have been closed */
if(H5I_nmembers(H5I_FILE) != 0)
TEST_ERROR
- if(H5F_sfile_assert_num(0) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
PASSED();
return 0;
@@ -4129,16 +4110,14 @@ test_sharedclose(hid_t fapl)
TEST_ERROR
/* Check that file #3 is still open */
- if(H5F_sfile_assert_num(3) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(3);
/* Close group B/C in file #1b. This should close file #1b and #3. */
if(H5Gclose(gid3) < 0)
TEST_ERROR
/* Check that file #3 has been closed */
- if(H5F_sfile_assert_num(2) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(2);
/* Unmount file 2 and close the rest of the handles */
if(H5Funmount(fid1a, "A") < 0)
@@ -4153,8 +4132,7 @@ test_sharedclose(hid_t fapl)
/* Check that all file IDs have been closed */
if(H5I_nmembers(H5I_FILE) != 0)
TEST_ERROR
- if(H5F_sfile_assert_num(0) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
/* Create file #1 & its group */
if((fid1a = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
@@ -4197,8 +4175,7 @@ test_sharedclose(hid_t fapl)
/* Check that all file IDs have been closed */
if(H5I_nmembers(H5I_FILE) != 0)
TEST_ERROR
- if(H5F_sfile_assert_num(0) != 0)
- TEST_ERROR
+ H5F_sfile_assert_num(0);
PASSED();
return 0;
@@ -4324,7 +4301,7 @@ test_multisharedclose(hid_t fapl)
/* Check that all file IDs have been closed */
if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR
- if(H5F_sfile_assert_num(0) < 0) TEST_ERROR
+ H5F_sfile_assert_num(0);
PASSED();
return 0;
diff --git a/test/testfiles/plist_files/acpl_be b/test/testfiles/plist_files/acpl_be
new file mode 100644
index 0000000..ba342d9
--- /dev/null
+++ b/test/testfiles/plist_files/acpl_be
Binary files differ
diff --git a/test/testfiles/plist_files/acpl_le b/test/testfiles/plist_files/acpl_le
new file mode 100644
index 0000000..ba342d9
--- /dev/null
+++ b/test/testfiles/plist_files/acpl_le
Binary files differ
diff --git a/test/testfiles/plist_files/dapl_be b/test/testfiles/plist_files/dapl_be
new file mode 100644
index 0000000..4df4e7f
--- /dev/null
+++ b/test/testfiles/plist_files/dapl_be
Binary files differ
diff --git a/test/testfiles/plist_files/dapl_le b/test/testfiles/plist_files/dapl_le
new file mode 100644
index 0000000..4df4e7f
--- /dev/null
+++ b/test/testfiles/plist_files/dapl_le
Binary files differ
diff --git a/test/testfiles/plist_files/dcpl_be b/test/testfiles/plist_files/dcpl_be
new file mode 100644
index 0000000..667c67f
--- /dev/null
+++ b/test/testfiles/plist_files/dcpl_be
Binary files differ
diff --git a/test/testfiles/plist_files/dcpl_le b/test/testfiles/plist_files/dcpl_le
new file mode 100644
index 0000000..667c67f
--- /dev/null
+++ b/test/testfiles/plist_files/dcpl_le
Binary files differ
diff --git a/test/testfiles/plist_files/dxpl_be b/test/testfiles/plist_files/dxpl_be
new file mode 100644
index 0000000..5ff2ea0
--- /dev/null
+++ b/test/testfiles/plist_files/dxpl_be
Binary files differ
diff --git a/test/testfiles/plist_files/dxpl_le b/test/testfiles/plist_files/dxpl_le
new file mode 100644
index 0000000..5ff2ea0
--- /dev/null
+++ b/test/testfiles/plist_files/dxpl_le
Binary files differ
diff --git a/test/testfiles/plist_files/fapl_be b/test/testfiles/plist_files/fapl_be
new file mode 100644
index 0000000..8fcefa2
--- /dev/null
+++ b/test/testfiles/plist_files/fapl_be
Binary files differ
diff --git a/test/testfiles/plist_files/fapl_le b/test/testfiles/plist_files/fapl_le
new file mode 100644
index 0000000..8fcefa2
--- /dev/null
+++ b/test/testfiles/plist_files/fapl_le
Binary files differ
diff --git a/test/testfiles/plist_files/fcpl_be b/test/testfiles/plist_files/fcpl_be
new file mode 100644
index 0000000..ffa5242
--- /dev/null
+++ b/test/testfiles/plist_files/fcpl_be
Binary files differ
diff --git a/test/testfiles/plist_files/fcpl_le b/test/testfiles/plist_files/fcpl_le
new file mode 100644
index 0000000..ffa5242
--- /dev/null
+++ b/test/testfiles/plist_files/fcpl_le
Binary files differ
diff --git a/test/testfiles/plist_files/gcpl_be b/test/testfiles/plist_files/gcpl_be
new file mode 100644
index 0000000..1eec32c
--- /dev/null
+++ b/test/testfiles/plist_files/gcpl_be
Binary files differ
diff --git a/test/testfiles/plist_files/gcpl_le b/test/testfiles/plist_files/gcpl_le
new file mode 100644
index 0000000..1eec32c
--- /dev/null
+++ b/test/testfiles/plist_files/gcpl_le
Binary files differ
diff --git a/test/testfiles/plist_files/lapl_be b/test/testfiles/plist_files/lapl_be
new file mode 100644
index 0000000..30f52a4
--- /dev/null
+++ b/test/testfiles/plist_files/lapl_be
Binary files differ
diff --git a/test/testfiles/plist_files/lapl_le b/test/testfiles/plist_files/lapl_le
new file mode 100644
index 0000000..30f52a4
--- /dev/null
+++ b/test/testfiles/plist_files/lapl_le
Binary files differ
diff --git a/test/testfiles/plist_files/lcpl_be b/test/testfiles/plist_files/lcpl_be
new file mode 100644
index 0000000..4584e5c
--- /dev/null
+++ b/test/testfiles/plist_files/lcpl_be
Binary files differ
diff --git a/test/testfiles/plist_files/lcpl_le b/test/testfiles/plist_files/lcpl_le
new file mode 100644
index 0000000..4584e5c
--- /dev/null
+++ b/test/testfiles/plist_files/lcpl_le
Binary files differ
diff --git a/test/testfiles/plist_files/ocpl_be b/test/testfiles/plist_files/ocpl_be
new file mode 100644
index 0000000..bc46636
--- /dev/null
+++ b/test/testfiles/plist_files/ocpl_be
Binary files differ
diff --git a/test/testfiles/plist_files/ocpl_le b/test/testfiles/plist_files/ocpl_le
new file mode 100644
index 0000000..bc46636
--- /dev/null
+++ b/test/testfiles/plist_files/ocpl_le
Binary files differ
diff --git a/test/testfiles/plist_files/ocpypl_be b/test/testfiles/plist_files/ocpypl_be
new file mode 100644
index 0000000..a0d826d
--- /dev/null
+++ b/test/testfiles/plist_files/ocpypl_be
Binary files differ
diff --git a/test/testfiles/plist_files/ocpypl_le b/test/testfiles/plist_files/ocpypl_le
new file mode 100644
index 0000000..a0d826d
--- /dev/null
+++ b/test/testfiles/plist_files/ocpypl_le
Binary files differ
diff --git a/test/testfiles/plist_files/strcpl_be b/test/testfiles/plist_files/strcpl_be
new file mode 100644
index 0000000..4190a63
--- /dev/null
+++ b/test/testfiles/plist_files/strcpl_be
Binary files differ
diff --git a/test/testfiles/plist_files/strcpl_le b/test/testfiles/plist_files/strcpl_le
new file mode 100644
index 0000000..4190a63
--- /dev/null
+++ b/test/testfiles/plist_files/strcpl_le
Binary files differ
diff --git a/test/testframe.c b/test/testframe.c
index 6fbace1..5835b73 100644
--- a/test/testframe.c
+++ b/test/testframe.c
@@ -124,12 +124,6 @@ AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), con
*/
void TestInit(const char *ProgName, void (*private_usage)(void), int (*private_parser)(int ac, char *av[]))
{
-#if !(defined MAC)
- /* Un-buffer the stdout and stderr */
- setbuf(stderr, NULL);
- setbuf(stdout, NULL);
-#endif
-
/*
* Turn off automatic error reporting since we do it ourselves. Besides,
* half the functions this test calls are private, so automatic error
diff --git a/test/testhdf5.h b/test/testhdf5.h
index 149b4c8..c92c0f0 100644
--- a/test/testhdf5.h
+++ b/test/testhdf5.h
@@ -125,7 +125,17 @@
} while(0)
/* Used to document process through a test */
-#define MESSAGE(V,A) {if (HDGetTestVerbosity()>(V)) print_func A;}
+#if defined(H5_HAVE_PARALLEL) && defined(H5_PARALLEL_TEST)
+#define MESSAGE(V,A) { \
+ int mpi_rank; \
+ \
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); \
+ if(mpi_rank == 0 && HDGetTestVerbosity() > (V)) \
+ print_func A ; \
+}
+#else /* H5_HAVE_PARALLEL */
+#define MESSAGE(V,A) {if (HDGetTestVerbosity() > (V)) print_func A;}
+#endif /* H5_HAVE_PARALLEL */
/* Used to indicate an error that is complex to check for */
#define ERROR(where) do { \
diff --git a/test/tgenprop.c b/test/tgenprop.c
index 3dbaa14..f304f11 100644
--- a/test/tgenprop.c
+++ b/test/tgenprop.c
@@ -743,11 +743,11 @@ test_genprop_basic_list_prop(void)
/* Add temporary properties */
- /* Insert first temporary property into class (with no callbacks) */
+ /* Insert first temporary property into list (with no callbacks) */
ret = H5Pinsert2(lid1, PROP3_NAME, PROP3_SIZE, PROP3_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(ret, "H5Pinsert2");
- /* Insert second temporary property into class (with no callbacks) */
+ /* Insert second temporary property into list (with no callbacks) */
ret = H5Pinsert2(lid1, PROP4_NAME, PROP4_SIZE, PROP4_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(ret, "H5Pinsert2");
@@ -1215,10 +1215,10 @@ test_genprop_list_callback(void)
/* The compare callback should have been called once on property 1 (to check
* if the create callback modified the value) */
- VERIFY(prop1_cb_info.cmp_count, 1, "H5Pequal");
+ VERIFY(prop1_cb_info.cmp_count, 1, "H5Pcreate");
/* The compare callback should not have been called on property 3, as there
* is no create callback */
- VERIFY(prop3_cb_info.cmp_count, 0, "H5Pequal");
+ VERIFY(prop3_cb_info.cmp_count, 0, "H5Pcreate");
/* Verify creation callback information for properties tracked */
VERIFY(prop1_cb_info.crt_count, 1, "H5Pcreate");
@@ -1233,7 +1233,7 @@ test_genprop_list_callback(void)
VERIFY(prop1_value, *PROP1_DEF_VALUE, "H5Pget");
/* The compare callback should have been called once (to check if the get
* callback modified the value) */
- VERIFY(prop1_cb_info.cmp_count, 2, "H5Pequal");
+ VERIFY(prop1_cb_info.cmp_count, 2, "H5Pget");
ret = H5Pget(lid1, PROP2_NAME,&prop2_value);
CHECK_I(ret, "H5Pget");
/* Verify the floating-poing value in this way to avoid compiler warning. */
@@ -1248,7 +1248,7 @@ test_genprop_list_callback(void)
TestErrPrintf("Property #3 doesn't match!, line=%d\n",__LINE__);
/* The compare callback should not have been called, as there is no get
* callback for this property */
- VERIFY(prop3_cb_info.cmp_count, 0, "H5Pequal");
+ VERIFY(prop3_cb_info.cmp_count, 0, "H5Pget");
ret = H5Pget(lid1, PROP4_NAME,&prop4_value);
CHECK_I(ret, "H5Pget");
/* Verify the floating-poing value in this way to avoid compiler warning. */
@@ -1278,7 +1278,7 @@ test_genprop_list_callback(void)
/* The compare callback should have been called once (to check if the new
* value needed to be copied onto the property list) */
- VERIFY(prop1_cb_info.cmp_count, 3, "H5Pequal");
+ VERIFY(prop1_cb_info.cmp_count, 3, "H5Pset");
/* Set value of property #3 to different value */
ret = H5Pset(lid1, PROP3_NAME,prop3_new_value);
@@ -1286,7 +1286,7 @@ test_genprop_list_callback(void)
/* The compare callback should have been called once (to check if the new
* value needed to be copied onto the property list) */
- VERIFY(prop3_cb_info.cmp_count, 1, "H5Pequal");
+ VERIFY(prop3_cb_info.cmp_count, 1, "H5Pset");
/* Check new value of tracked properties */
ret = H5Pget(lid1, PROP1_NAME,&prop1_value);
@@ -1625,6 +1625,7 @@ test_genprop_equal(void)
hid_t cid1; /* Generic Property class ID */
hid_t lid1; /* Generic Property list ID */
hid_t lid2; /* Generic Property list ID */
+ int prop1_new_value = 20; /* Property #1 new value */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -1651,13 +1652,114 @@ test_genprop_equal(void)
CHECK_I(lid2, "H5Pcopy");
/* Check that the lists are equal */
- ret = H5Pequal(lid1,lid2);
+ ret = H5Pequal(lid1, lid2);
+ VERIFY(ret, 1, "H5Pequal");
+
+ /* Set property in first list to another value */
+ ret = H5Pset(lid1, PROP1_NAME, &prop1_new_value);
+ CHECK_I(ret, "H5Pset");
+
+ /* Check that the lists are not equal */
+ ret = H5Pequal(lid1, lid2);
+ VERIFY(ret, 0, "H5Pequal");
+
+ /* Set property in first list back to default */
+ ret = H5Pset(lid1, PROP1_NAME, PROP1_DEF_VALUE);
+ CHECK_I(ret, "H5Pset");
+
+ /* Check that the lists are still equal */
+ ret = H5Pequal(lid1, lid2);
+ VERIFY(ret, 1, "H5Pequal");
+
+ /* Insert first temporary property into first list (with no callbacks) */
+ ret = H5Pinsert2(lid1, PROP3_NAME, PROP3_SIZE, PROP3_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL);
+ CHECK_I(ret, "H5Pinsert2");
+
+ /* Check that the lists are not equal */
+ ret = H5Pequal(lid1, lid2);
+ VERIFY(ret, 0, "H5Pequal");
+
+ /* Insert first temporary property into second list (with no callbacks) */
+ ret = H5Pinsert2(lid2, PROP3_NAME, PROP3_SIZE, PROP3_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL);
+ CHECK_I(ret, "H5Pinsert2");
+
+ /* Check that the lists are equal */
+ ret = H5Pequal(lid1, lid2);
+ VERIFY(ret, 1, "H5Pequal");
+
+ /* Insert second temporary property into second list (with no callbacks) */
+ ret = H5Pinsert2(lid2, PROP4_NAME, PROP4_SIZE, PROP4_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL);
+ CHECK_I(ret, "H5Pinsert2");
+
+ /* Check that the lists are not equal */
+ ret = H5Pequal(lid1, lid2);
+ VERIFY(ret, 0, "H5Pequal");
+
+ /* Insert second temporary property into first list (with no callbacks) */
+ ret = H5Pinsert2(lid1, PROP4_NAME, PROP4_SIZE, PROP4_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL);
+ CHECK_I(ret, "H5Pinsert2");
+
+ /* Check that the lists are equal */
+ ret = H5Pequal(lid1, lid2);
VERIFY(ret, 1, "H5Pequal");
+ /* Remove first temporary property from first list */
+ ret = H5Premove(lid1, PROP3_NAME);
+ CHECK_I(ret, "H5Premove");
+
+ /* Check that the lists are not equal */
+ ret = H5Pequal(lid1, lid2);
+ VERIFY(ret, 0, "H5Pequal");
+
+ /* Remove second temporary property from second list */
+ ret = H5Premove(lid2, PROP4_NAME);
+ CHECK_I(ret, "H5Premove");
+
+ /* Check that the lists are not equal */
+ ret = H5Pequal(lid1, lid2);
+ VERIFY(ret, 0, "H5Pequal");
+
+ /* Remove first temporary property from second list */
+ ret = H5Premove(lid2, PROP3_NAME);
+ CHECK_I(ret, "H5Premove");
+
+ /* Check that the lists are not equal */
+ ret = H5Pequal(lid1, lid2);
+ VERIFY(ret, 0, "H5Pequal");
+
+ /* Remove first permanent property from first list */
+ ret = H5Premove(lid1, PROP1_NAME);
+ CHECK_I(ret, "H5Premove");
+
+ /* Check that the lists are not equal */
+ ret = H5Pequal(lid1, lid2);
+ VERIFY(ret, 0, "H5Pequal");
+
+ /* Remove second temporary property from first list */
+ ret = H5Premove(lid1, PROP4_NAME);
+ CHECK_I(ret, "H5Premove");
+
+ /* Check that the lists are not equal */
+ ret = H5Pequal(lid1, lid2);
+ VERIFY(ret, 0, "H5Pequal");
+
+ /* Remove first permanent property from second list */
+ ret = H5Premove(lid2, PROP1_NAME);
+ CHECK_I(ret, "H5Premove");
+
+ /* Check that the lists are equal */
+ ret = H5Pequal(lid1, lid2);
+ VERIFY(ret, 1, "H5Pequal");
+
+ /* Close property lists */
+ ret = H5Pclose(lid1);
+ CHECK_I(ret, "H5Pclose");
+ ret = H5Pclose(lid2);
+ CHECK_I(ret, "H5Pclose");
+
/* Close class */
ret = H5Pclose_class(cid1);
CHECK_I(ret, "H5Pclose_class");
-
} /* ent test_genprop_equal() */
/****************************************************************