summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2012-09-25 15:47:25 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2012-09-25 15:47:25 (GMT)
commit6a89177036b5808ed0ce06ce0aab3af056b56984 (patch)
tree43367eb16716e1a2f074e2af07121e2723eae8d8 /test
parent50e3990f2a9e3bba421460d8d5cb21bb6f6e98fe (diff)
downloadhdf5-6a89177036b5808ed0ce06ce0aab3af056b56984.zip
hdf5-6a89177036b5808ed0ce06ce0aab3af056b56984.tar.gz
hdf5-6a89177036b5808ed0ce06ce0aab3af056b56984.tar.bz2
[svn-r22807] Description:
Add encode/decode API routines for property lists: H5Pencode/H5Pdecode. Tested on: FreeBSD/32 8.2 (loyalty) w/gcc4.6, w/C++ & FORTRAN, in debug mode FreeBSD/64 8.2 (freedom) w/gcc4.6, w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (koala) w/Intel compilers, w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, w/threadsafe, in production mode Linux/PPC 2.6 (ostrich) w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-ia64 2.6 (ember) w/Intel compilers, w/parallel, C++ & FORTRAN, in production mode Mac OS X/32 10.7.3 (amazon) in debug mode Mac OS X/32 10.7.3 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode Mac OS X/32 10.7.3 (amazon) w/parallel, in debug mode
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am4
-rw-r--r--test/Makefile.in72
-rw-r--r--test/enc_dec_plist.c480
-rw-r--r--test/enc_dec_plist_with_endianess.c160
-rw-r--r--test/gen_plist.c435
-rw-r--r--test/h5test.h1
-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
30 files changed, 1128 insertions, 24 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index cb56d52..fd40ad6 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -40,7 +40,7 @@ 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 \
+ 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 6d15c55..6f39794 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -108,11 +108,12 @@ am__EXEEXT_1 = testhdf5$(EXEEXT) lheap$(EXEEXT) ohdr$(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) getname$(EXEEXT) vfd$(EXEEXT) ntypes$(EXEEXT) \
- dangle$(EXEEXT) dtransform$(EXEEXT) reserved$(EXEEXT) \
- cross_read$(EXEEXT) freespace$(EXEEXT) mf$(EXEEXT) \
- farray$(EXEEXT) earray$(EXEEXT) btree2$(EXEEXT) fheap$(EXEEXT) \
- file_image$(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) \
+ btree2$(EXEEXT) fheap$(EXEEXT) file_image$(EXEEXT)
am__EXEEXT_2 = gen_bad_ohdr$(EXEEXT) gen_bogus$(EXEEXT) \
gen_cross$(EXEEXT) gen_deflate$(EXEEXT) gen_filters$(EXEEXT) \
gen_new_array$(EXEEXT) gen_new_fill$(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)
@@ -191,6 +192,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)
@@ -299,6 +309,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)
@@ -454,28 +468,30 @@ 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 dsets.c dt_arith.c dtransform.c dtypes.c \
- earray.c efc.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_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 \
- space_overflow.c stab.c tcheck_version.c $(testhdf5_SOURCES) \
- testmeta.c $(ttsafe_SOURCES) unlink.c vfd.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_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 space_overflow.c stab.c tcheck_version.c \
+ $(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c \
+ vfd.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 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 \
@@ -820,7 +836,7 @@ 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 \
+ 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
@@ -835,7 +851,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.
@@ -1008,6 +1024,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)
@@ -1089,6 +1111,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)
@@ -1195,6 +1220,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@
@@ -1222,6 +1249,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/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.h b/test/h5test.h
index 0c52bd1..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); \
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