summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2015-12-15 09:48:59 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2015-12-15 09:48:59 (GMT)
commit4fe9d56f786f1f43e06655fa238ac7b11a194ba1 (patch)
tree7b1d0a0d729a2fe508efb0c46360d5204edec7b1 /tools
parente9da1c3460abdb32496f9271edf2a2dbbaa4e72b (diff)
downloadhdf5-4fe9d56f786f1f43e06655fa238ac7b11a194ba1.zip
hdf5-4fe9d56f786f1f43e06655fa238ac7b11a194ba1.tar.gz
hdf5-4fe9d56f786f1f43e06655fa238ac7b11a194ba1.tar.bz2
[svn-r28658] Manual merge of revise_chunks and alpha branch.
Tested on: Unbuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 Autotools serial (C++ Fortran) Autotools parallel (MPICH 3.1.4, Fortran) CMake serial (CMake 3.3.2)
Diffstat (limited to 'tools')
-rw-r--r--tools/Makefile.am3
-rw-r--r--tools/h5copy/h5copygentest.c44
-rw-r--r--tools/h5copy/testfiles/h5copytst.h5bin30448 -> 30480 bytes
-rw-r--r--tools/h5copy/testfiles/h5copytst_new.h5bin0 -> 15029 bytes
-rw-r--r--tools/h5copy/testfiles/h5copytst_new.out.ls502
-rw-r--r--tools/h5diff/h5diffgentest.c101
-rw-r--r--tools/h5diff/testfiles/h5diff_dset_idx1.h5bin0 -> 5974 bytes
-rw-r--r--tools/h5diff/testfiles/h5diff_dset_idx2.h5bin0 -> 2206 bytes
-rw-r--r--tools/h5diff/testfiles/h5diff_hyper1.h5bin1052720 -> 1052720 bytes
-rw-r--r--tools/h5diff/testfiles/h5diff_hyper2.h5bin1052720 -> 1052720 bytes
-rw-r--r--tools/h5diff/testfiles/h5diff_idx.txt14
-rw-r--r--tools/h5diff/testfiles/tmptest.he5bin4740424 -> 4740424 bytes
-rw-r--r--tools/h5diff/testfiles/tmptest2.he5bin4734280 -> 4734280 bytes
-rw-r--r--tools/h5dump/h5dump_xml.c1
-rw-r--r--tools/h5dump/h5dumpgentest.c129
-rw-r--r--tools/h5format_convert/Makefile.am49
-rw-r--r--tools/h5format_convert/h5fc_chk_idx.c101
-rw-r--r--tools/h5format_convert/h5fc_gentest.c635
-rw-r--r--tools/h5format_convert/h5format_convert.c438
-rw-r--r--tools/h5format_convert/testfiles/h5fc_d_file.ddl22
-rw-r--r--tools/h5format_convert/testfiles/h5fc_dname.ddl22
-rw-r--r--tools/h5format_convert/testfiles/h5fc_edge_v3.h5bin0 -> 2526 bytes
-rw-r--r--tools/h5format_convert/testfiles/h5fc_help.ddl21
-rw-r--r--tools/h5format_convert/testfiles/h5fc_latest_v3.h5bin0 -> 6130 bytes
-rw-r--r--tools/h5format_convert/testfiles/h5fc_non_v3.h5bin0 -> 4336 bytes
-rw-r--r--tools/h5format_convert/testfiles/h5fc_nonexistdset_file.ddl1
-rw-r--r--tools/h5format_convert/testfiles/h5fc_nonexistfile.ddl1
-rw-r--r--tools/h5format_convert/testfiles/h5fc_nooption.ddl21
-rw-r--r--tools/h5format_convert/testfiles/h5fc_v1.h5bin0 -> 8252 bytes
-rw-r--r--tools/h5format_convert/testfiles/h5fc_v_all.ddl26
-rw-r--r--tools/h5format_convert/testfiles/h5fc_v_bt1.ddl11
-rw-r--r--tools/h5format_convert/testfiles/h5fc_v_n_1d.ddl13
-rw-r--r--tools/h5format_convert/testfiles/h5fc_v_n_all.ddl47
-rw-r--r--tools/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl12
-rw-r--r--tools/h5format_convert/testfiles/h5fc_v_non_chunked.ddl9
-rw-r--r--tools/h5format_convert/testh5fc.sh.in400
-rw-r--r--tools/h5import/testfiles/binfp64.h5bin10760 -> 10760 bytes
-rw-r--r--tools/h5import/testfiles/binin16.h5bin10760 -> 10760 bytes
-rw-r--r--tools/h5import/testfiles/binin32.h5bin9472 -> 9472 bytes
-rw-r--r--tools/h5import/testfiles/binin8.h5bin10760 -> 10760 bytes
-rw-r--r--tools/h5import/testfiles/binuin16.h5bin10760 -> 10760 bytes
-rw-r--r--tools/h5import/testfiles/binuin32.h5bin6384 -> 6384 bytes
-rw-r--r--tools/h5import/testfiles/txtfp32.h5bin4192 -> 4192 bytes
-rw-r--r--tools/h5import/testfiles/txtfp64.h5bin9784 -> 9784 bytes
-rw-r--r--tools/h5import/testfiles/txtin16.h5bin9784 -> 9784 bytes
-rw-r--r--tools/h5import/testfiles/txtin32.h5bin4192 -> 4192 bytes
-rw-r--r--tools/h5import/testfiles/txtin8.h5bin9784 -> 9784 bytes
-rw-r--r--tools/h5import/testfiles/txtuin16.h5bin10240 -> 10240 bytes
-rw-r--r--tools/h5import/testfiles/txtuin32.h5bin6240 -> 6240 bytes
-rw-r--r--tools/h5ls/h5ls.c1
-rw-r--r--tools/h5ls/testh5ls.sh.in5
-rw-r--r--tools/h5repack/h5repack.c4
-rw-r--r--tools/h5repack/h5repack.h5
-rw-r--r--tools/h5repack/h5repack_main.c13
-rw-r--r--tools/h5repack/h5repacktst.c167
-rw-r--r--tools/h5repack/testfiles/h5repack_attr.h5bin20056 -> 20056 bytes
-rw-r--r--tools/h5repack/testfiles/h5repack_deflate.h5bin5962 -> 5962 bytes
-rw-r--r--tools/h5repack/testfiles/h5repack_early.h5bin2067224 -> 2067224 bytes
-rw-r--r--tools/h5repack/testfiles/h5repack_fill.h5bin2072 -> 2072 bytes
-rw-r--r--tools/h5repack/testfiles/h5repack_filters.h5bin29744 -> 29744 bytes
-rw-r--r--tools/h5repack/testfiles/h5repack_fletcher.h5bin7880 -> 7880 bytes
-rw-r--r--tools/h5repack/testfiles/h5repack_hlink.h5bin6576 -> 6576 bytes
-rw-r--r--tools/h5repack/testfiles/h5repack_layouto.h5bin1576 -> 1576 bytes
-rw-r--r--tools/h5repack/testfiles/h5repack_nbit.h5bin13776 -> 13776 bytes
-rw-r--r--tools/h5repack/testfiles/h5repack_shuffle.h5bin7864 -> 7864 bytes
-rw-r--r--tools/h5repack/testfiles/h5repack_soffset.h5bin11052 -> 11052 bytes
-rw-r--r--tools/h5repack/testfiles/h5repack_szip.h5bin5588 -> 5588 bytes
-rw-r--r--tools/h5stat/h5stat_gentest.c119
-rw-r--r--tools/h5stat/testfiles/h5stat_filters.h5bin46272 -> 46272 bytes
-rw-r--r--tools/h5stat/testfiles/h5stat_idx.ddl93
-rw-r--r--tools/h5stat/testfiles/h5stat_idx.h5bin0 -> 2206 bytes
-rw-r--r--tools/h5stat/testh5stat.sh.in4
-rw-r--r--tools/lib/h5tools.h11
-rw-r--r--tools/lib/h5tools_dump.c4
-rw-r--r--tools/lib/h5tools_str.c67
-rw-r--r--tools/misc/Makefile.am14
-rw-r--r--tools/misc/clear_open_chk.c72
-rw-r--r--tools/misc/h5clear.c137
-rw-r--r--tools/misc/h5clear_gentest.c174
-rw-r--r--tools/misc/h5debug.c52
-rw-r--r--tools/misc/testh5clear.sh.in130
-rw-r--r--tools/testfiles/family_file00000.h5bin1024 -> 1024 bytes
-rw-r--r--tools/testfiles/taindices.h5bin17160 -> 17160 bytes
-rw-r--r--tools/testfiles/tarray1.h5bin2112 -> 2112 bytes
-rw-r--r--tools/testfiles/tarray2.h5bin3008 -> 3008 bytes
-rw-r--r--tools/testfiles/tarray3.h5bin3200 -> 3200 bytes
-rw-r--r--tools/testfiles/tarray4.h5bin2176 -> 2176 bytes
-rw-r--r--tools/testfiles/tarray5.h5bin2368 -> 2368 bytes
-rw-r--r--tools/testfiles/tarray6.h5bin6400 -> 6400 bytes
-rw-r--r--tools/testfiles/tarray7.h5bin6400 -> 6400 bytes
-rw-r--r--tools/testfiles/tattr.h5bin3024 -> 3024 bytes
-rw-r--r--tools/testfiles/tattr2.h5bin33840 -> 33840 bytes
-rw-r--r--tools/testfiles/tbigdims.h5bin6192 -> 6192 bytes
-rw-r--r--tools/testfiles/tbitfields.h5bin2704 -> 2704 bytes
-rw-r--r--tools/testfiles/tchar.h5bin2356 -> 2356 bytes
-rw-r--r--tools/testfiles/tcompound.h5bin8192 -> 8192 bytes
-rw-r--r--tools/testfiles/tcompound2.h5bin13640 -> 13640 bytes
-rw-r--r--tools/testfiles/tcompound_complex.h5bin8192 -> 8192 bytes
-rw-r--r--tools/testfiles/tdatareg.h5bin5652 -> 5652 bytes
-rw-r--r--tools/testfiles/tdset.h5bin7648 -> 7648 bytes
-rw-r--r--tools/testfiles/tdset2.h5bin9936 -> 9936 bytes
-rw-r--r--tools/testfiles/tdset_idx.ddl61
-rw-r--r--tools/testfiles/tdset_idx.h5bin0 -> 10562 bytes
-rw-r--r--tools/testfiles/tdset_idx.ls36
-rw-r--r--tools/testfiles/tempty.h5bin4304 -> 4304 bytes
-rw-r--r--tools/testfiles/tenum.h5bin2128 -> 2128 bytes
-rw-r--r--tools/testfiles/tfamily00000.h5bin256 -> 256 bytes
-rw-r--r--tools/testfiles/tfcontents2.h5bin792 -> 792 bytes
-rw-r--r--tools/testfiles/tfvalues.h5bin9552 -> 9552 bytes
-rw-r--r--tools/testfiles/tgroup.h5bin11096 -> 11096 bytes
-rw-r--r--tools/testfiles/thlink.h5bin5536 -> 5536 bytes
-rw-r--r--tools/testfiles/thyperslab.h5bin1050880 -> 1050880 bytes
-rw-r--r--tools/testfiles/tlarge_objname.h5bin40008 -> 40008 bytes
-rw-r--r--tools/testfiles/tlonglinks.h5bin203168 -> 203168 bytes
-rw-r--r--tools/testfiles/tloop.h5bin3168 -> 3168 bytes
-rw-r--r--tools/testfiles/tloop2.h5bin3168 -> 3168 bytes
-rw-r--r--tools/testfiles/tmulti-s.h5bin2048 -> 2048 bytes
-rw-r--r--tools/testfiles/tname-amp.h5bin2880 -> 2880 bytes
-rw-r--r--tools/testfiles/tname-apos.h5bin2880 -> 2880 bytes
-rw-r--r--tools/testfiles/tname-gt.h5bin2880 -> 2880 bytes
-rw-r--r--tools/testfiles/tname-lt.h5bin2880 -> 2880 bytes
-rw-r--r--tools/testfiles/tname-quot.h5bin2880 -> 2880 bytes
-rw-r--r--tools/testfiles/tname-sp.h5bin2880 -> 2880 bytes
-rw-r--r--tools/testfiles/tnestedcomp.h5bin2072 -> 2072 bytes
-rw-r--r--tools/testfiles/tnodata.h5bin1412 -> 1412 bytes
-rw-r--r--tools/testfiles/tnullspace.h5bin3624 -> 3624 bytes
-rw-r--r--tools/testfiles/tobjref.h5bin2900 -> 2900 bytes
-rw-r--r--tools/testfiles/topaque.h5bin1744 -> 1744 bytes
-rw-r--r--tools/testfiles/tref-escapes-at.h5bin5849 -> 5849 bytes
-rw-r--r--tools/testfiles/tref-escapes.h5bin5536 -> 5536 bytes
-rw-r--r--tools/testfiles/tref.h5bin3004 -> 3004 bytes
-rw-r--r--tools/testfiles/tsaf.h5bin769444 -> 769444 bytes
-rw-r--r--tools/testfiles/tslink.h5bin1168 -> 1168 bytes
-rw-r--r--tools/testfiles/tsplit_file-m.h5bin2048 -> 2048 bytes
-rw-r--r--tools/testfiles/tstr.h5bin15608 -> 15608 bytes
-rw-r--r--tools/testfiles/tstr2.h5bin11096 -> 11096 bytes
-rw-r--r--tools/testfiles/tstr3.h5bin8736 -> 8736 bytes
-rw-r--r--tools/testfiles/tstring-at.h5bin1672 -> 1672 bytes
-rw-r--r--tools/testfiles/tstring.h5bin2160 -> 2160 bytes
-rw-r--r--tools/testfiles/tvldtypes1.h5bin8336 -> 8336 bytes
-rw-r--r--tools/testfiles/tvldtypes2.h5bin6208 -> 6208 bytes
-rw-r--r--tools/testfiles/tvldtypes3.h5bin6240 -> 6240 bytes
-rw-r--r--tools/testfiles/tvldtypes4.h5bin8192 -> 8192 bytes
-rw-r--r--tools/testfiles/tvldtypes5.h5bin8192 -> 8192 bytes
-rw-r--r--tools/testfiles/tvms.h5bin2288 -> 2288 bytes
145 files changed, 3679 insertions, 113 deletions
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 095cc30..bffc14d 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -24,7 +24,6 @@ include $(top_srcdir)/config/commence.am
CONFIG=ordered
# All subdirectories
-SUBDIRS=lib h5diff h5ls h5dump misc h5import h5repack h5jam h5copy h5stat \
- perform
+SUBDIRS=lib h5diff h5ls h5dump misc h5import h5repack h5jam h5copy h5stat h5format_convert perform
include $(top_srcdir)/config/conclude.am
diff --git a/tools/h5copy/h5copygentest.c b/tools/h5copy/h5copygentest.c
index 49204f5..45d4e16 100644
--- a/tools/h5copy/h5copygentest.c
+++ b/tools/h5copy/h5copygentest.c
@@ -22,6 +22,7 @@
/* HDF file names */
#define HDF_FILE1 "h5copytst.h5"
+#define HDF_FILE1_NEW "h5copytst_new.h5"
#define HDF_FILE2 "h5copy_ref.h5"
#define HDF_EXT_SRC_FILE "h5copy_extlinks_src.h5"
#define HDF_EXT_TRG_FILE "h5copy_extlinks_trg.h5"
@@ -644,20 +645,41 @@ out:
*------------------------------------------------------------------------*/
static void Test_Obj_Copy(void)
{
- hid_t fid=0;
+ hid_t fid = (-1); /* File id */
+ hid_t fapl_new = (-1); /* File access property id */
+ unsigned new_format; /* New format or old format */
- /* Create source file */
- fid = H5Fcreate(HDF_FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- if (fid < 0)
- {
- fprintf(stderr, "Error: %s> H5Fcreate failed.\n", HDF_FILE1);
+ if((fapl_new = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
+ fprintf(stderr, "Error: H5Pcreate failed.\n");
goto out;
}
+ if(H5Pset_libver_bounds(fapl_new, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) {
+ fprintf(stderr, "Error: H5Pset_libver_bounds failed.\n");
+ goto out;
+ }
+
+ /* Test with old & new format groups */
+ for(new_format = FALSE; new_format <= TRUE; new_format++) {
+
+ /* Set the FAPL for the type of format */
+ /* Create source file */
+ if(new_format)
+ fid = H5Fcreate(HDF_FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_new);
+ else
+ fid = H5Fcreate(HDF_FILE1_NEW, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if(fid < 0) {
+ fprintf(stderr, "Error: H5Fcreate failed.\n");
+ goto out;
+ }
+
+ gent_datasets(fid);
+ gent_empty_group(fid);
+ gent_nested_datasets(fid);
+ gent_nested_group(fid);
- gent_datasets(fid);
- gent_empty_group(fid);
- gent_nested_datasets(fid);
- gent_nested_group(fid);
+ H5Fclose(fid);
+ fid = (-1);
+ } /* end for */
out:
/*-----------------------------------------------------------------------
@@ -665,6 +687,8 @@ out:
*------------------------------------------------------------------------*/
if(fid > 0)
H5Fclose(fid);
+ if(fapl_new > 0)
+ H5Pclose(fapl_new);
}
/*-------------------------------------------------------------------------
diff --git a/tools/h5copy/testfiles/h5copytst.h5 b/tools/h5copy/testfiles/h5copytst.h5
index f407f82..0f10410 100644
--- a/tools/h5copy/testfiles/h5copytst.h5
+++ b/tools/h5copy/testfiles/h5copytst.h5
Binary files differ
diff --git a/tools/h5copy/testfiles/h5copytst_new.h5 b/tools/h5copy/testfiles/h5copytst_new.h5
new file mode 100644
index 0000000..57e1805
--- /dev/null
+++ b/tools/h5copy/testfiles/h5copytst_new.h5
Binary files differ
diff --git a/tools/h5copy/testfiles/h5copytst_new.out.ls b/tools/h5copy/testfiles/h5copytst_new.out.ls
new file mode 100644
index 0000000..9df6b2e
--- /dev/null
+++ b/tools/h5copy/testfiles/h5copytst_new.out.ls
@@ -0,0 +1,502 @@
+#############################
+Expected output for 'h5ls ../testfiles/h5copytst_new.out.h5'
+#############################
+Opened "../testfiles/h5copytst_new.out.h5" with sec2 driver.
+/ Group
+ Location: 1:96
+ Links: 1
+/A Group
+ Location: 1:65602
+ Links: 1
+/A/B1 Group
+ Location: 1:66306
+ Links: 1
+/A/B1/simple Dataset {6/6}
+ Location: 1:65509
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/A/B2 Group
+ Location: 1:69807
+ Links: 1
+/A/B2/simple2 Dataset {6/6}
+ Location: 1:69714
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/C Group
+ Location: 1:72980
+ Links: 1
+/C/D Group
+ Location: 1:73684
+ Links: 1
+/C/D/simple Dataset {6/6}
+ Location: 1:72887
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/E Group
+ Location: 1:76217
+ Links: 1
+/E/F Group
+ Location: 1:76921
+ Links: 1
+/E/F/grp_dsets Group
+ Location: 1:75044
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+/E/F/grp_dsets/chunk Dataset {6/6}
+ Location: 1:76014
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/E/F/grp_dsets/compact Dataset {6/6}
+ Location: 1:75367
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/E/F/grp_dsets/compound Dataset {2/2}
+ Location: 1:75470
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: struct {
+ "str1" +0 20-byte null-terminated ASCII string
+ "str2" +20 20-byte null-terminated ASCII string
+ } 40 bytes
+/E/F/grp_dsets/compressed Dataset {6/6}
+ Location: 1:75683
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Filter-0: deflate-1 OPT {1}
+ Type: 32-bit little-endian integer
+/E/F/grp_dsets/named_vl Dataset {2/2}
+ Location: 1:75853
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: shared-1:75793 variable length of
+ 32-bit little-endian integer
+/E/F/grp_dsets/nested_vl Dataset {2/2}
+ Location: 1:76108
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: variable length of
+ variable length of
+ 32-bit little-endian integer
+/E/F/grp_dsets/simple Dataset {6/6}
+ Location: 1:75274
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/E/F/grp_dsets/vl Type
+ Location: 1:75793
+ Links: 2
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Type: shared-1:75793 variable length of
+ 32-bit little-endian integer
+/G Group
+ Location: 1:85688
+ Links: 1
+/G/H Group
+ Location: 1:86392
+ Links: 1
+/G/H/grp_nested Group
+ Location: 1:84436
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+/G/H/grp_nested/grp_dsets Group
+ Location: 1:84515
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+/G/H/grp_nested/grp_dsets/chunk Dataset {6/6}
+ Location: 1:85485
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/G/H/grp_nested/grp_dsets/compact Dataset {6/6}
+ Location: 1:84838
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/G/H/grp_nested/grp_dsets/compound Dataset {2/2}
+ Location: 1:84941
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: struct {
+ "str1" +0 20-byte null-terminated ASCII string
+ "str2" +20 20-byte null-terminated ASCII string
+ } 40 bytes
+/G/H/grp_nested/grp_dsets/compressed Dataset {6/6}
+ Location: 1:85154
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Filter-0: deflate-1 OPT {1}
+ Type: 32-bit little-endian integer
+/G/H/grp_nested/grp_dsets/named_vl Dataset {2/2}
+ Location: 1:85324
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: shared-1:85264 variable length of
+ 32-bit little-endian integer
+/G/H/grp_nested/grp_dsets/nested_vl Dataset {2/2}
+ Location: 1:85579
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: variable length of
+ variable length of
+ 32-bit little-endian integer
+/G/H/grp_nested/grp_dsets/simple Dataset {6/6}
+ Location: 1:84745
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/G/H/grp_nested/grp_dsets/vl Type
+ Location: 1:85264
+ Links: 2
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Type: shared-1:85264 variable length of
+ 32-bit little-endian integer
+/chunk Dataset {6/6}
+ Location: 1:2238
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/compact Dataset {6/6}
+ Location: 1:4240
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/compound Dataset {2/2}
+ Location: 1:6391
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: struct {
+ "str1" +0 20-byte null-terminated ASCII string
+ "str2" +20 20-byte null-terminated ASCII string
+ } 40 bytes
+/compressed Dataset {6/6}
+ Location: 1:6604
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Filter-0: deflate-1 OPT {1}
+ Type: 32-bit little-endian integer
+/grp_dsets Group
+ Location: 1:27748
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+/grp_dsets/chunk Dataset {6/6}
+ Location: 1:28718
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_dsets/compact Dataset {6/6}
+ Location: 1:28071
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_dsets/compound Dataset {2/2}
+ Location: 1:28174
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: struct {
+ "str1" +0 20-byte null-terminated ASCII string
+ "str2" +20 20-byte null-terminated ASCII string
+ } 40 bytes
+/grp_dsets/compressed Dataset {6/6}
+ Location: 1:28387
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Filter-0: deflate-1 OPT {1}
+ Type: 32-bit little-endian integer
+/grp_dsets/named_vl Dataset {2/2}
+ Location: 1:28557
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: shared-1:28497 variable length of
+ 32-bit little-endian integer
+/grp_dsets/nested_vl Dataset {2/2}
+ Location: 1:28812
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: variable length of
+ variable length of
+ 32-bit little-endian integer
+/grp_dsets/simple Dataset {6/6}
+ Location: 1:27978
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_dsets/simple_group Dataset {6/6}
+ Location: 1:46180
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_dsets/vl Type
+ Location: 1:28497
+ Links: 2
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Type: shared-1:28497 variable length of
+ 32-bit little-endian integer
+/grp_empty Group
+ Location: 1:27693
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+/grp_nested Group
+ Location: 1:35940
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+/grp_nested/grp_dsets Group
+ Location: 1:36019
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+/grp_nested/grp_dsets/chunk Dataset {6/6}
+ Location: 1:36989
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_nested/grp_dsets/compact Dataset {6/6}
+ Location: 1:36342
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_nested/grp_dsets/compound Dataset {2/2}
+ Location: 1:36445
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: struct {
+ "str1" +0 20-byte null-terminated ASCII string
+ "str2" +20 20-byte null-terminated ASCII string
+ } 40 bytes
+/grp_nested/grp_dsets/compressed Dataset {6/6}
+ Location: 1:36658
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Filter-0: deflate-1 OPT {1}
+ Type: 32-bit little-endian integer
+/grp_nested/grp_dsets/named_vl Dataset {2/2}
+ Location: 1:36828
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: shared-1:36768 variable length of
+ 32-bit little-endian integer
+/grp_nested/grp_dsets/nested_vl Dataset {2/2}
+ Location: 1:37083
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: variable length of
+ variable length of
+ 32-bit little-endian integer
+/grp_nested/grp_dsets/simple Dataset {6/6}
+ Location: 1:36249
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_nested/grp_dsets/vl Type
+ Location: 1:36768
+ Links: 2
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Type: shared-1:36768 variable length of
+ 32-bit little-endian integer
+/grp_rename Group
+ Location: 1:47077
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+/grp_rename/chunk Dataset {6/6}
+ Location: 1:48047
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_rename/compact Dataset {6/6}
+ Location: 1:47400
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_rename/compound Dataset {2/2}
+ Location: 1:47503
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: struct {
+ "str1" +0 20-byte null-terminated ASCII string
+ "str2" +20 20-byte null-terminated ASCII string
+ } 40 bytes
+/grp_rename/compressed Dataset {6/6}
+ Location: 1:47716
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Filter-0: deflate-1 OPT {1}
+ Type: 32-bit little-endian integer
+/grp_rename/grp_dsets Group
+ Location: 1:55269
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+/grp_rename/grp_dsets/chunk Dataset {6/6}
+ Location: 1:56239
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_rename/grp_dsets/compact Dataset {6/6}
+ Location: 1:55592
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_rename/grp_dsets/compound Dataset {2/2}
+ Location: 1:55695
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: struct {
+ "str1" +0 20-byte null-terminated ASCII string
+ "str2" +20 20-byte null-terminated ASCII string
+ } 40 bytes
+/grp_rename/grp_dsets/compressed Dataset {6/6}
+ Location: 1:55908
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Filter-0: deflate-1 OPT {1}
+ Type: 32-bit little-endian integer
+/grp_rename/grp_dsets/named_vl Dataset {2/2}
+ Location: 1:56078
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: shared-1:56018 variable length of
+ 32-bit little-endian integer
+/grp_rename/grp_dsets/nested_vl Dataset {2/2}
+ Location: 1:56333
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: variable length of
+ variable length of
+ 32-bit little-endian integer
+/grp_rename/grp_dsets/simple Dataset {6/6}
+ Location: 1:55499
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_rename/grp_dsets/vl Type
+ Location: 1:56018
+ Links: 2
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Type: shared-1:56018 variable length of
+ 32-bit little-endian integer
+/grp_rename/named_vl Dataset {2/2}
+ Location: 1:47886
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: shared-1:47826 variable length of
+ 32-bit little-endian integer
+/grp_rename/nested_vl Dataset {2/2}
+ Location: 1:48141
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: variable length of
+ variable length of
+ 32-bit little-endian integer
+/grp_rename/simple Dataset {6/6}
+ Location: 1:47307
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_rename/vl Type
+ Location: 1:47826
+ Links: 2
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Type: shared-1:47826 variable length of
+ 32-bit little-endian integer
+/named_vl Dataset {2/2}
+ Location: 1:8657
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: shared-1:8606 variable length of
+ 32-bit little-endian integer
+/nested_vl Dataset {2/2}
+ Location: 1:22942
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: variable length of
+ variable length of
+ 32-bit little-endian integer
+/rename Dataset {2/2}
+ Location: 1:27240
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: struct {
+ "str1" +0 20-byte null-terminated ASCII string
+ "str2" +20 20-byte null-terminated ASCII string
+ } 40 bytes
+/simple Dataset {6/6}
+ Location: 1:800
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/simple_top Dataset {6/6}
+ Location: 1:25099
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c
index 8f92660..937bd32 100644
--- a/tools/h5diff/h5diffgentest.c
+++ b/tools/h5diff/h5diffgentest.c
@@ -62,6 +62,8 @@ hsize_t H5TOOLS_MALLOCSIZE = (128 * 1024 * 1024);
#define FILE18 "h5diff_ext2softlink_trg.h5"
#define FILE19 "h5diff_dset_zero_dim_size1.h5"
#define FILE20 "h5diff_dset_zero_dim_size2.h5"
+#define FILE21 "h5diff_dset_idx1.h5"
+#define FILE22 "h5diff_dset_idx2.h5"
#define DANGLE_LINK_FILE1 "h5diff_danglelinks1.h5"
#define DANGLE_LINK_FILE2 "h5diff_danglelinks2.h5"
#define GRP_RECURSE_FILE1 "h5diff_grp_recurse1.h5"
@@ -165,6 +167,7 @@ static void gen_datareg(hid_t fid,int make_diffs);
/* utilities */
static int write_attr(hid_t loc_id,int rank,hsize_t *dims,const char *name,hid_t tid,void *buf);
static int write_dset(hid_t loc_id,int rank,hsize_t *dims,const char *name,hid_t tid,void *buf);
+static int gen_dataset_idx(const char *file, int format);
/*-------------------------------------------------------------------------
@@ -211,6 +214,15 @@ int main(void)
test_special_datasets(FILE19,0);
test_special_datasets(FILE20,1);
+ /*
+ * Generate 2 files: FILE21 with old format; FILE22 with new format
+ * Create 2 datasets in each file:
+ * One dataset: chunked layout, w/o filters, fixed dimension
+ * One dataset: chunked layout, w/ filters, fixed dimension
+ */
+ gen_dataset_idx(FILE21, 0);
+ gen_dataset_idx(FILE22, 1);
+
test_dangle_links(DANGLE_LINK_FILE1, DANGLE_LINK_FILE2);
test_group_recurse(GRP_RECURSE_FILE1, GRP_RECURSE_FILE2);
@@ -2105,6 +2117,95 @@ out:
}
/*-------------------------------------------------------------------------
+* Function: gen_dataset_idx
+*
+* Purpose: Create a file with either the new or old format
+* Create two datasets in the file:
+* one dataset: fixed dimension, chunked layout, w/o filters
+* one dataset: fixed dimension, chunked layout, w/ filters
+*
+*-------------------------------------------------------------------------
+*/
+static
+int gen_dataset_idx(const char *file, int format)
+{
+ hid_t fid; /* file id */
+ hid_t did, did2; /* dataset id */
+ hid_t sid; /* space id */
+ hid_t fapl; /* file access property id */
+ hid_t dcpl; /* dataset creation property id */
+ hsize_t dims[1] = {10}; /* dataset dimension */
+ hsize_t c_dims[1] = {2}; /* chunk dimension */
+ herr_t status; /* return status */
+ int buf[10]; /* data buffer */
+ int i; /* local index variable */
+
+ /* Get a copy of the file aaccess property */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+
+ /* Set the "use the latest format" bounds for creating objects in the file */
+ if(format) {
+ status = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST);
+ assert(status >= 0);
+ }
+
+ /* Create a file */
+ if((fid = H5Fcreate(file, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ return -1;
+
+ /* Create data */
+ for(i = 0; i < 10; i++)
+ buf[i] = i;
+
+ /* Set chunk */
+ dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ status = H5Pset_chunk(dcpl, 1, c_dims);
+ assert(status >= 0);
+
+ /* Create a 1D dataset */
+ sid = H5Screate_simple(1, dims, NULL);
+ did = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+
+ /* Write to the dataset */
+ status = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+ assert(status >= 0);
+
+#if defined (H5_HAVE_FILTER_DEFLATE)
+ /* set deflate data */
+ status = H5Pset_deflate(dcpl, 9);
+ assert(status >= 0);
+
+ /* Create and write the dataset */
+ did2 = H5Dcreate2(fid, "dset_filter", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ status = H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+ assert(status >= 0);
+
+ /* Close the dataset */
+ status = H5Dclose(did2);
+ assert(status >= 0);
+
+#endif
+
+ /* closing: dataspace, dataset, file */
+ status = H5Sclose(sid);
+ assert(status >= 0);
+
+ status = H5Dclose(did);
+ assert(status >= 0);
+
+ status = H5Fclose(fid);
+ assert(status >= 0);
+
+ status = H5Pclose(dcpl);
+ assert(status >= 0);
+
+ status = H5Pclose(fapl);
+ assert(status >= 0);
+
+ return status;
+}
+
+/*-------------------------------------------------------------------------
*
* Purpose: Create test files to compare dangling links in various way
*
diff --git a/tools/h5diff/testfiles/h5diff_dset_idx1.h5 b/tools/h5diff/testfiles/h5diff_dset_idx1.h5
new file mode 100644
index 0000000..3252303
--- /dev/null
+++ b/tools/h5diff/testfiles/h5diff_dset_idx1.h5
Binary files differ
diff --git a/tools/h5diff/testfiles/h5diff_dset_idx2.h5 b/tools/h5diff/testfiles/h5diff_dset_idx2.h5
new file mode 100644
index 0000000..db7584d
--- /dev/null
+++ b/tools/h5diff/testfiles/h5diff_dset_idx2.h5
Binary files differ
diff --git a/tools/h5diff/testfiles/h5diff_hyper1.h5 b/tools/h5diff/testfiles/h5diff_hyper1.h5
index ceeff80..1fd47e1 100644
--- a/tools/h5diff/testfiles/h5diff_hyper1.h5
+++ b/tools/h5diff/testfiles/h5diff_hyper1.h5
Binary files differ
diff --git a/tools/h5diff/testfiles/h5diff_hyper2.h5 b/tools/h5diff/testfiles/h5diff_hyper2.h5
index 05a2eb1..ad2f468 100644
--- a/tools/h5diff/testfiles/h5diff_hyper2.h5
+++ b/tools/h5diff/testfiles/h5diff_hyper2.h5
Binary files differ
diff --git a/tools/h5diff/testfiles/h5diff_idx.txt b/tools/h5diff/testfiles/h5diff_idx.txt
new file mode 100644
index 0000000..754d3ea
--- /dev/null
+++ b/tools/h5diff/testfiles/h5diff_idx.txt
@@ -0,0 +1,14 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /dset
+ x x /dset_filter
+
+group : </> and </>
+0 differences found
+dataset: </dset> and </dset>
+0 differences found
+dataset: </dset_filter> and </dset_filter>
+0 differences found
+EXIT CODE: 0
diff --git a/tools/h5diff/testfiles/tmptest.he5 b/tools/h5diff/testfiles/tmptest.he5
index edcfcd2..7dedfc1 100644
--- a/tools/h5diff/testfiles/tmptest.he5
+++ b/tools/h5diff/testfiles/tmptest.he5
Binary files differ
diff --git a/tools/h5diff/testfiles/tmptest2.he5 b/tools/h5diff/testfiles/tmptest2.he5
index a6ab02b..0ce63dc 100644
--- a/tools/h5diff/testfiles/tmptest2.he5
+++ b/tools/h5diff/testfiles/tmptest2.he5
Binary files differ
diff --git a/tools/h5dump/h5dump_xml.c b/tools/h5dump/h5dump_xml.c
index 5bc43eb..00f894b 100644
--- a/tools/h5dump/h5dump_xml.c
+++ b/tools/h5dump/h5dump_xml.c
@@ -69,6 +69,7 @@ static h5tool_format_t xml_dataformat = {
"", /*cmpd_pre */
"", /*cmpd_suf */
"", /*cmpd_end */
+ "", /*cmpd_listv */
" ", /*vlen_sep */
" ", /*vlen_pre */
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c
index 250f96f..059fee5 100644
--- a/tools/h5dump/h5dumpgentest.c
+++ b/tools/h5dump/h5dumpgentest.c
@@ -98,6 +98,7 @@
#define FILE66 "packedbits.h5"
#define FILE67 "zerodim.h5"
#define FILE68 "charsets.h5"
+#define FILE68a "tdset_idx.h5"
#define FILE69 "tattrintsize.h5"
#define FILE70 "tcmpdintsize.h5"
#define FILE71 "tcmpdattrintsize.h5"
@@ -286,6 +287,16 @@ typedef struct s1_t {
#define F66_YDIM64 64
#define F66_DUMMYDBL "DummyDBL"
+/* Declarations for gent_dataset_idx() for "FILE68a" */
+#define F68a_DSET_FIXED "dset_fixed"
+#define F68a_DSET_FIXED_FILTER "dset_filter"
+#define F68a_DSET_BTREE "dset_btree"
+#define F68a_DIM200 200
+#define F68a_DIM100 100
+#define F68a_DIM20 20
+#define F68a_DIM10 10
+#define F68a_CHUNK 5
+
/* "FILE70" macros and for FILE71 */
/* Name of dataset to create in datafile */
#define F70_DATASETNAME "CompoundIntSize"
@@ -7012,6 +7023,90 @@ gent_fs_strategy_threshold(void)
H5Pclose(fcpl);
}
+/*
+ * Create a file with new format:
+ * Create one dataset with (set_chunk, fixed dims, null max. dims)
+ * so that Fixed Array indexing will be used.
+ * Create one dataset with (set_chunk, fixed dims, null max. dims, filter)
+ * so that Fixed Array indexing will be used.
+ * Create one dataset with (set_chunk, fixed dims, fixed max. dims)
+ * so that Fixed Array indexing will be used.
+ *
+ * Modifications:
+ * Fixed Array indexing will be used for chunked dataset
+ * with fixed max. dims setting.
+ *
+ */
+static void
+gent_dataset_idx(void)
+{
+ hid_t fid, space, dcpl, fapl;
+ hsize_t dims[2];
+ hsize_t maxdims[2];
+ int buf[20][10];
+ int i, j, ret;
+
+ /* Get a copy of the file aaccess property */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+
+ /* Set the "use the latest version of the format" bounds for creating objects in the file */
+ ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST);
+ assert(ret >= 0);
+
+ fid = H5Fcreate(FILE68a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ dcpl = H5Pcreate(H5P_DATASET_CREATE);
+
+ dims[0] = F68a_CHUNK;
+ dims[1] = F68a_CHUNK;
+
+ /* set chunk */
+ ret = H5Pset_chunk(dcpl, RANK, dims);
+ assert(ret >= 0);
+
+ /* dataset with fixed dimensions */
+ dims[0] = F68a_DIM20;
+ dims[1] = F68a_DIM10;
+ space = H5Screate_simple(RANK, dims, NULL);
+
+ for(i = 0; i < F68a_DIM20; i++)
+ for(j = 0; j < F68a_DIM10; j++)
+ buf[i][j] = j;
+
+ ret = make_dset(fid, F68a_DSET_FIXED, space, H5T_NATIVE_INT, dcpl, buf);
+ assert(ret >= 0);
+ H5Sclose(space);
+
+ /* dataset with non-fixed dimensions */
+ maxdims[0] = F68a_DIM200;
+ maxdims[1] = F68a_DIM100;
+ space = H5Screate_simple(RANK, dims, maxdims);
+
+ ret = make_dset(fid, F68a_DSET_BTREE, space, H5T_NATIVE_INT, dcpl, buf);
+ assert(ret >= 0);
+ H5Sclose(space);
+
+#if defined (H5_HAVE_FILTER_DEFLATE)
+
+ /* dataset with fixed dimensions and filters */
+ /* remove the filters from the dcpl */
+ ret = H5Premove_filter(dcpl, H5Z_FILTER_ALL);
+ assert(ret >= 0);
+
+ /* set deflate data */
+ ret = H5Pset_deflate(dcpl, 9);
+ assert(ret >= 0);
+
+ space = H5Screate_simple(RANK, dims, NULL);
+ ret = make_dset(fid, F68a_DSET_FIXED_FILTER, space, H5T_NATIVE_INT, dcpl, buf);
+ assert(ret >= 0);
+
+ H5Sclose(space);
+#endif
+
+ H5Pclose(dcpl);
+ H5Fclose(fid);
+}
+
/*-------------------------------------------------------------------------
* Function: gent_packedbits
*
@@ -7050,9 +7145,8 @@ gent_packedbits(void)
valu8bits = (uint8_t) ~0u; /* all 1s */
for(i = 0; i < dims[0]; i++){
dsetu8[i][0] = valu8bits;
- for(j = 1; j < dims[1]; j++) {
+ for(j = 1; j < dims[1]; j++)
dsetu8[i][j] = dsetu8[i][j-1] << 1;
- }
valu8bits <<= 1;
}
@@ -7068,9 +7162,8 @@ gent_packedbits(void)
valu16bits = (uint16_t) ~0u; /* all 1s */
for(i = 0; i < dims[0]; i++){
dsetu16[i][0] = valu16bits;
- for(j = 1; j < dims[1]; j++) {
+ for(j = 1; j < dims[1]; j++)
dsetu16[i][j] = dsetu16[i][j-1] << 1;
- }
valu16bits <<= 1;
}
@@ -7086,9 +7179,8 @@ gent_packedbits(void)
valu32bits = (uint32_t) ~0u; /* all 1s */
for(i = 0; i < dims[0]; i++){
dsetu32[i][0] = valu32bits;
- for(j = 1; j < dims[1]; j++) {
+ for(j = 1; j < dims[1]; j++)
dsetu32[i][j] = dsetu32[i][j-1] << 1;
- }
valu32bits <<= 1;
}
@@ -7104,9 +7196,8 @@ gent_packedbits(void)
valu64bits = (uint64_t) ~0Lu; /* all 1s */
for(i = 0; i < dims[0]; i++){
dsetu64[i][0] = valu64bits;
- for(j = 1; j < dims[1]; j++) {
+ for(j = 1; j < dims[1]; j++)
dsetu64[i][j] = dsetu64[i][j-1] << 1;
- }
valu64bits <<= 1;
}
@@ -7122,9 +7213,8 @@ gent_packedbits(void)
val8bits = (int8_t) ~0; /* all 1s */
for(i = 0; i < dims[0]; i++){
dset8[i][0] = val8bits;
- for(j = 1; j < dims[1]; j++) {
+ for(j = 1; j < dims[1]; j++)
dset8[i][j] = dset8[i][j-1] << 1;
- }
val8bits <<= 1;
}
@@ -7140,9 +7230,8 @@ gent_packedbits(void)
val16bits = (int16_t) ~0; /* all 1s */
for(i = 0; i < dims[0]; i++){
dset16[i][0] = val16bits;
- for(j = 1; j < dims[1]; j++) {
+ for(j = 1; j < dims[1]; j++)
dset16[i][j] = dset16[i][j-1] << 1;
- }
val16bits <<= 1;
}
@@ -7158,9 +7247,8 @@ gent_packedbits(void)
val32bits = (int32_t) ~0; /* all 1s */
for(i = 0; i < dims[0]; i++){
dset32[i][0] = val32bits;
- for(j = 1; j < dims[1]; j++) {
+ for(j = 1; j < dims[1]; j++)
dset32[i][j] = dset32[i][j-1] << 1;
- }
val32bits <<= 1;
}
@@ -7176,9 +7264,8 @@ gent_packedbits(void)
val64bits = (int64_t) ~0L; /* all 1s */
for(i = 0; i < dims[0]; i++){
dset64[i][0] = val64bits;
- for(j = 1; j < dims[1]; j++) {
+ for(j = 1; j < dims[1]; j++)
dset64[i][j] = dset64[i][j-1] << 1;
- }
val64bits <<= 1;
}
@@ -7415,17 +7502,22 @@ gent_charsets(void)
const char *utf8_p_;
} CharSetInfo;
- hid_t charset_dtid = H5Tcreate( H5T_COMPOUND, sizeof( CharSetInfo ) );
- hid_t ascii_dtid = H5Tcreate( H5T_STRING, H5T_VARIABLE );
+ hid_t charset_dtid;
+ hid_t ascii_dtid;
hid_t utf8_dtid = H5Tcreate( H5T_STRING, H5T_VARIABLE );
const char * writeData[] = { "ascii", "utf8", };
sid = H5Screate_simple( 1, dim, NULL );
fid = H5Fcreate( FILE68, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT );
+
+ charset_dtid = H5Tcreate( H5T_COMPOUND, sizeof( CharSetInfo ) );
+
+ ascii_dtid = H5Tcreate( H5T_STRING, H5T_VARIABLE );
status = H5Tset_cset( ascii_dtid, H5T_CSET_ASCII );
HDassert(status >= 0);
H5Tinsert( charset_dtid, "ascii", HOFFSET(CharSetInfo, ascii_p_ ), ascii_dtid );
+ utf8_dtid = H5Tcreate( H5T_STRING, H5T_VARIABLE );
status = H5Tset_cset( utf8_dtid, H5T_CSET_UTF8 );
HDassert(status >= 0);
H5Tinsert( charset_dtid, "utf8", HOFFSET( CharSetInfo, utf8_p_ ), utf8_dtid );
@@ -9795,6 +9887,7 @@ int main(void)
gent_extlinks();
gent_fs_strategy_threshold();
gent_packedbits();
+ gent_dataset_idx();
gent_attr_intsize();
gent_charsets();
gent_compound_intsizes();
diff --git a/tools/h5format_convert/Makefile.am b/tools/h5format_convert/Makefile.am
new file mode 100644
index 0000000..d3aef7d
--- /dev/null
+++ b/tools/h5format_convert/Makefile.am
@@ -0,0 +1,49 @@
+#
+# 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.
+##
+## Makefile.am
+## Run automake to generate a Makefile.in from this file.
+#
+# HDF5 Library Makefile(.in)
+#
+
+include $(top_srcdir)/config/commence.am
+
+# Include src directory
+AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
+
+#test script and program
+TEST_PROG=h5fc_gentest
+TEST_SCRIPT=testh5fc.sh
+
+check_PROGRAMS=$(TEST_PROG) h5fc_chk_idx
+check_SCRIPTS=$(TEST_SCRIPT)
+SCRIPT_DEPEND=h5format_convert$(EXEEXT)
+
+# These are our main targets, the tools
+bin_PROGRAMS=h5format_convert
+
+# Add h5format_convert specific linker flags here
+h5format_convert_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+
+# Tell automake to clean h5redeploy script
+CHECK_CLEANFILES+=*.h5
+
+# These were generated by configure. Remove them only when distclean.
+DISTCLEANFILES=testh5fc.sh
+
+# All programs rely on hdf5 library and h5tools library
+LDADD=$(LIBH5TOOLS) $(LIBHDF5)
+
+include $(top_srcdir)/config/conclude.am
diff --git a/tools/h5format_convert/h5fc_chk_idx.c b/tools/h5format_convert/h5fc_chk_idx.c
new file mode 100644
index 0000000..3114379
--- /dev/null
+++ b/tools/h5format_convert/h5fc_chk_idx.c
@@ -0,0 +1,101 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * A program to verify that the chunk indexing type of a dataset in a file
+ * is version 1 B-tree.
+ * This is to support the testing of the tool "h5format_convert".
+ */
+
+#include "hdf5.h"
+#include "H5private.h"
+#include "h5tools.h"
+
+static void usage(void);
+
+static void
+usage(void)
+{
+ HDfprintf(stdout, "Usage: h5fc_chk_idx file_name dataset_pathname\n");
+} /* usage() */
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: To check that the chunk indexing type for the dataset in
+ * the file is version 1 B-tree.
+ *
+ * Return: 0 -- the indexing type is version 1 B-tree
+ * 1 -- otherwise
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+main(int argc, char *argv[])
+{
+ char *fname = NULL;
+ char *dname = NULL;
+ hid_t fid = -1;
+ hid_t did = -1;
+ H5D_chunk_index_t idx_type;
+
+ /* h5fc_chk_idx fname dname */
+ if(argc != 3) {
+ usage();
+ exit(EXIT_FAILURE);
+ }
+
+ /* Duplicate the file name & dataset name */
+ fname = strdup(argv[1]);
+ dname = strdup(argv[2]);
+
+ /* Try opening the file */
+ if((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) {
+ HDfprintf(stderr, "h5fc_chk_idx: unable to open the file\n");
+ return EXIT_FAILURE;
+ }
+
+ /* Open the dataset */
+ if((did = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0) {
+ HDfprintf(stderr, "h5fc_chk_idx: unable to open the dataset\n");
+ exit(EXIT_FAILURE);
+ }
+
+ /* Get the dataset's chunk indexing type */
+ if(H5Dget_chunk_index_type(did, &idx_type) < 0) {
+ HDfprintf(stderr, "h5fc_chk_idx: unable to get chunk index type for the dataset\n");
+ exit(EXIT_FAILURE);
+ }
+
+ /* Close the dataset */
+ if(H5Dclose(did) < 0) {
+ HDfprintf(stderr, "h5fc_chk_idx: unable to close the dataset\n");
+ exit(EXIT_FAILURE);
+ }
+
+ /* Close the file */
+ if(H5Fclose(fid) < 0) {
+ HDfprintf(stderr, "h5fc_chk_idx_type: cannot close the file\n");
+ return EXIT_FAILURE;
+ }
+
+ /* Return success when the chunk indexing type is version 1 B-tree */
+ if(idx_type == H5D_CHUNK_IDX_BTREE)
+ return(EXIT_SUCCESS);
+ else {
+ HDfprintf(stderr, "Error: chunk indexing type is %d\n", idx_type);
+ return(EXIT_FAILURE);
+ }
+} /* main() */
diff --git a/tools/h5format_convert/h5fc_gentest.c b/tools/h5format_convert/h5fc_gentest.c
new file mode 100644
index 0000000..4dcc286
--- /dev/null
+++ b/tools/h5format_convert/h5fc_gentest.c
@@ -0,0 +1,635 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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 the binary hdf5 files for the h5format_convert tests.
+ * Usage: just execute the program without any arguments will
+ * generate all the binary hdf5 files
+ *
+ * If you regenerate the test files (e.g., changing some code,
+ * trying it on a new platform, ...), you need to verify the correctness
+ * of the expected output and update the corresponding *.ddl files.
+ */
+#include "hdf5.h"
+
+#define GROUP "GROUP"
+
+#define OLD_V1_FILE "h5fc_v1.h5"
+#define DSET_NON_CHUNKED "DSET_NON_CHUNKED"
+#define DSET_BT1 "DSET_BT1"
+#define DSET_NDATA_BT1 "DSET_NDATA_BT1"
+
+#define LATEST_V3_FILE "h5fc_latest_v3.h5"
+#define DSET_EA "DSET_EA"
+#define DSET_NDATA_EA "DSET_NDATA_EA"
+#define DSET_BT2 "DSET_BT2"
+#define DSET_NDATA_BT2 "DSET_NDATA_BT2"
+#define DSET_FA "DSET_FA"
+#define DSET_NDATA_FA "DSET_NDATA_FA"
+#define DSET_NONE "DSET_NONE"
+#define DSET_NDATA_NONE "DSET_NDATA_NONE"
+
+#define NON_V3_FILE "h5fc_non_v3.h5"
+
+#define EDGE_V3_FILE "h5fc_edge_v3.h5"
+#define DSET_EDGE "DSET_EDGE"
+
+/*
+ * Function: gen_old()
+ *
+ * Create an old format file with:
+ * 1) 1 non-chunked dataset
+ * 2) 2 chunked datasets with version 1 B-tree chunk indexing type: with/without data
+ */
+static void
+gen_old(const char *fname)
+{
+ hid_t fid = -1; /* file id */
+ hid_t fcpl = -1;
+ hid_t gid = -1; /* group id */
+ hid_t sid = -1; /* space id */
+ hid_t dcpl = -1; /* dataset creation property id */
+ hid_t did1 = -1, did2 = -1; /* dataset id */
+ hsize_t dims1[1] = {10}; /* dataset dimension */
+ hsize_t dims2[2] = {4, 6}; /* dataset dimension */
+ hsize_t c_dims[2] = {2, 3}; /* chunk dimension */
+ int i; /* local index variable */
+ int buf[24]; /* data buffer */
+
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ goto error;
+
+ if(H5Pset_istore_k(fcpl, 64) < 0)
+ goto error;
+
+ /* Create file */
+ if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Create a group */
+ if((gid = H5Gcreate2(fid, GROUP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+
+ /*
+ * Create a non-chunked dataset
+ */
+
+ /* Create dataspace */
+ if((sid = H5Screate_simple(1, dims1, NULL)) < 0)
+ goto error;
+
+ /* Create the dataset */
+ if((did1 = H5Dcreate2(fid, DSET_NON_CHUNKED, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Closing */
+ if(H5Sclose(sid) < 0)
+ goto error;
+ if(H5Dclose(did1) < 0)
+ goto error;
+
+ /*
+ * Create two chunked datasets with version 1 B-tree chunk indexing type
+ * (one with data, one without data)
+ */
+
+ /* Create data */
+ for(i = 0; i < 24; i++)
+ buf[i] = i;
+
+ /* Set chunk */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if(H5Pset_chunk(dcpl, 2, c_dims) < 0)
+ goto error;
+
+ /* Create dataspace */
+ if((sid = H5Screate_simple(2, dims2, NULL)) < 0)
+ goto error;
+
+ /* Create the 2 datasets */
+ if((did1 = H5Dcreate2(fid, DSET_NDATA_BT1, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ if((did2 = H5Dcreate2(gid, DSET_BT1, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Write to one dataset */
+ if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto error;
+
+ /* Closing */
+ if(H5Pclose(dcpl) < 0)
+ goto error;
+ if(H5Sclose(sid) < 0)
+ goto error;
+ if(H5Dclose(did1) < 0)
+ goto error;
+ if(H5Dclose(did2) < 0)
+ goto error;
+
+ if(H5Gclose(gid) < 0)
+ goto error;
+ if(H5Fclose(fid) < 0)
+ goto error;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Pclose(dcpl);
+ H5Sclose(sid);
+ H5Dclose(did1);
+ H5Dclose(did2);
+ H5Gclose(gid);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+
+} /* gen_old() */
+
+/*
+ * Function: gen_latest()
+ *
+ * Create a file with write+latest-format--this will result in v3 superblock+latest version support:
+ * 1) 2 chunked datasets with extensible array chunk indexing type (with/without data)
+ * 2) 2 chunked datasets with version 2 B-tree chunk indexing type (with/without data)
+ * 3) 2 chunked datasets with fixed array chunk indexing type (with/without data)
+ * 4) 2 chunked datasets with implicit array chunk indexing type (with/without data)
+ */
+static void
+gen_latest(const char *fname)
+{
+ hid_t fid = -1; /* file id */
+ hid_t fapl = -1; /* file access property list */
+ hid_t gid = -1; /* group id */
+ hid_t sid = -1; /* space id */
+ hid_t dcpl = -1; /* dataset creation property id */
+ hid_t did1 = -1, did2 = -1; /* dataset id */
+ hsize_t dims2[2] = {4, 6}; /* dataset dimension */
+ hsize_t max_dims[2]; /* maximum dataset dimension */
+ hsize_t c_dims[2] = {2, 3}; /* chunk dimension */
+ int i; /* local index variable */
+ int buf[24]; /* data buffer */
+
+ /* Create a new format file */
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ goto error;
+ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ goto error;
+
+ if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ goto error;
+
+ /* Create a group */
+ if((gid = H5Gcreate2(fid, GROUP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Set chunk */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if(H5Pset_chunk(dcpl, 2, c_dims) < 0)
+ goto error;
+
+ /*
+ * Create 2 chunked datasets with extensible array chunk indexing type
+ * (one with data; one without data)
+ */
+
+ /* Create dataspace */
+ max_dims[0] = 10;
+ max_dims[1] = H5S_UNLIMITED;
+ if((sid = H5Screate_simple(2, dims2, max_dims)) < 0)
+ goto error;
+
+ /* Create the 2 datasets */
+ if((did1 = H5Dcreate2(gid, DSET_NDATA_EA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ if((did2 = H5Dcreate2(fid, DSET_EA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Create data */
+ for(i = 0; i < 24; i++)
+ buf[i] = i;
+
+ /* Write to one dataset */
+ if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto error;
+
+ /* Closing */
+ if(H5Sclose(sid) < 0)
+ goto error;
+ if(H5Dclose(did1) < 0)
+ goto error;
+ if(H5Dclose(did2) < 0)
+ goto error;
+
+
+ /*
+ * Create 2 chunked datasets with version 2 B-tree chunk indexing type
+ * (one with data; one without data)
+ */
+
+ /* Create dataspace */
+ max_dims[0] = 10;
+ max_dims[0] = H5S_UNLIMITED;
+ max_dims[1] = H5S_UNLIMITED;
+ if((sid = H5Screate_simple(2, dims2, max_dims)) < 0)
+ goto error;
+
+ /* Create the 2 datasets */
+ if((did1 = H5Dcreate2(fid, DSET_NDATA_BT2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ if((did2 = H5Dcreate2(gid, DSET_BT2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Write to one dataset */
+ if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto error;
+
+ /* Closing */
+ if(H5Sclose(sid) < 0)
+ goto error;
+ if(H5Dclose(did1) < 0)
+ goto error;
+ if(H5Dclose(did2) < 0)
+ goto error;
+
+ /*
+ * Create 2 chunked datasets with fixed array chunk indexing type
+ * (one with data; one without data)
+ */
+
+ /* Create dataspace */
+ max_dims[0] = 20;
+ max_dims[1] = 10;
+ if((sid = H5Screate_simple(2, dims2, max_dims)) < 0)
+ goto error;
+
+ /* Create the datasets */
+ if((did1 = H5Dcreate2(fid, DSET_FA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ if((did2 = H5Dcreate2(gid, DSET_NDATA_FA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Write to the dataset */
+ if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto error;
+
+ /* Closing */
+ if(H5Sclose(sid) < 0)
+ goto error;
+ if(H5Dclose(did1) < 0)
+ goto error;
+ if(H5Dclose(did2) < 0)
+ goto error;
+
+
+ /*
+ * Create 2 chunked datasets with implicit chunk indexing type
+ * (one with data; one without data)
+ */
+
+ /* Create dataspace */
+ if((sid = H5Screate_simple(2, dims2, NULL)) < 0)
+ goto error;
+
+ /* Set early allocation */
+ if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0)
+ goto error;
+
+ /* Create the 2 datasets */
+ if((did1 = H5Dcreate2(fid, DSET_NONE, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ if((did2 = H5Dcreate2(gid, DSET_NDATA_NONE, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Write to one dataset */
+ if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto error;
+
+ /* Closing */
+ if(H5Dclose(did1) < 0)
+ goto error;
+ if(H5Dclose(did2) < 0)
+ goto error;
+ if(H5Sclose(sid) < 0)
+ goto error;
+
+ if(H5Pclose(dcpl) < 0)
+ goto error;
+ if(H5Gclose(gid) < 0)
+ goto error;
+ if(H5Fclose(fid) < 0)
+ goto error;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Pclose(dcpl);
+ H5Sclose(sid);
+ H5Dclose(did1);
+ H5Dclose(did2);
+ H5Gclose(gid);
+ H5Fclose(fid);
+ H5Pclose(fapl);
+ } H5E_END_TRY;
+
+} /* gen_latest() */
+
+/*
+ * Function: gen_non()
+ *
+ * Create a file with SWMR write+non-latest-format--this will result in v3 superbock+latest version support:
+ * 1) 1 chunked dataset with extensible array chunk indexing type (without data)
+ * 2) 1 chunked dataset with version 2 B-tree chunk indexing type (with data)
+ * Re-open the file with write+non-latest-format and create:
+ * 3) 1 chunked dataset with version 2 B-tree chunk indexing type (without data)
+ * 4) 1 chunked dataset with extensible array indexing type (with data)
+ * 5) 1 non-chunked dataset
+ */
+static void
+gen_non(const char *fname)
+{
+ hid_t fid = -1; /* file id */
+ hid_t gid = -1; /* group id */
+ hid_t sid = -1; /* space id */
+ hid_t dcpl = -1; /* dataset creation property id */
+ hid_t did1 = -1, did2 = -1; /* dataset id */
+ hsize_t dims1[1] = {10}; /* dataset dimension */
+ hsize_t dims2[2] = {4, 6}; /* dataset dimension */
+ hsize_t max_dims[2]; /* maximum dataset dimension */
+ hsize_t c_dims[2] = {2, 3}; /* chunk dimension */
+ int i; /* local index variable */
+ int buf[24]; /* data buffer */
+
+ /* Create a new file with SWMR_WRITE + non-latest-format */
+ if((fid = H5Fcreate(fname, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Create a group */
+ if((gid = H5Gcreate2(fid, GROUP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Create data */
+ for(i = 0; i < 24; i++)
+ buf[i] = i;
+
+ /* Set chunk */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if(H5Pset_chunk(dcpl, 2, c_dims) < 0)
+ goto error;
+
+ /*
+ * Create a chunked dataset with extensible array chunk indexing type (without data)
+ */
+
+ /* Create dataspace */
+ max_dims[0] = 10;
+ max_dims[1] = H5S_UNLIMITED;
+ if((sid = H5Screate_simple(2, dims2, max_dims)) < 0)
+ goto error;
+
+ /* Create the dataset */
+ if((did1 = H5Dcreate2(fid, DSET_NDATA_EA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Closing */
+ if(H5Sclose(sid) < 0)
+ goto error;
+ if(H5Dclose(did1) < 0)
+ goto error;
+
+ /*
+ * Create a chunked dataset with version 2 B-tree chunk indexing type (with data)
+ */
+
+ /* Create dataspace */
+ max_dims[0] = 10;
+ max_dims[0] = H5S_UNLIMITED;
+ max_dims[1] = H5S_UNLIMITED;
+ if((sid = H5Screate_simple(2, dims2, max_dims)) < 0)
+ goto error;
+
+ /* Create the dataset */
+ if((did1 = H5Dcreate2(gid, DSET_BT2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Write to the dataset */
+ if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto error;
+
+ /* Closing */
+ if(H5Sclose(sid) < 0)
+ goto error;
+ if(H5Dclose(did1) < 0)
+ goto error;
+ if(H5Pclose(dcpl) < 0)
+ goto error;
+ if(H5Gclose(gid) < 0)
+ goto error;
+ if(H5Fclose(fid) < 0)
+ goto error;
+
+ /* Re-open the file with old format */
+ if((fid = H5Fopen(fname, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Open the group */
+ if((gid = H5Gopen2(fid, GROUP, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /*
+ * Create a dataset with version 2 B-btree chunk indexing type (without data)
+ */
+
+ /* Set chunk */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if(H5Pset_chunk(dcpl, 2, c_dims) < 0)
+ goto error;
+
+ /* Create dataspace */
+ max_dims[0] = H5S_UNLIMITED;
+ max_dims[1] = H5S_UNLIMITED;
+ if((sid = H5Screate_simple(2, dims2, max_dims)) < 0)
+ goto error;
+
+ /* Create the dataset */
+ if((did1 = H5Dcreate2(fid, DSET_NDATA_BT2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Close the dataspace */
+ if(H5Sclose(sid) < 0)
+ goto error;
+
+ /*
+ * Create a dataset with version extensible array chunk indexing type (with data) in the group
+ */
+
+ /* Create dataspace */
+ max_dims[0] = 10;
+ max_dims[1] = H5S_UNLIMITED;
+ if((sid = H5Screate_simple(2, dims2, max_dims)) < 0)
+ goto error;
+
+ /* Create the dataset */
+ if((did2 = H5Dcreate2(gid, DSET_EA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Write to the dataset */
+ if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto error;
+
+ /* Closing */
+ if(H5Sclose(sid) < 0)
+ goto error;
+ if(H5Dclose(did1) < 0)
+ goto error;
+ if(H5Dclose(did2) < 0)
+ goto error;
+
+ /*
+ * Create a non-chunked dataset in the group
+ */
+
+ /* Create dataspace */
+ if((sid = H5Screate_simple(1, dims1, NULL)) < 0)
+ goto error;
+
+ /* Create the dataset */
+ if((did1 = H5Dcreate2(gid, DSET_NON_CHUNKED, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Closing */
+ if(H5Sclose(sid) < 0)
+ goto error;
+ if(H5Dclose(did1) < 0)
+ goto error;
+
+ if(H5Gclose(gid) < 0)
+ goto error;
+ if(H5Fclose(fid) < 0)
+ goto error;
+ if(H5Pclose(dcpl) < 0)
+ goto error;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Pclose(dcpl);
+ H5Sclose(sid);
+ H5Dclose(did1);
+ H5Dclose(did2);
+ H5Gclose(gid);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+
+} /* gen_non() */
+
+/*
+ * Function: gen_edge()
+ *
+ * Create a file with write+latest-format--this will result in v3 superblock+latest version support:
+ * A dataset: chunked, filtered, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS enabled
+ * (i.e. the dataset does not filter partial edge chunks)
+ */
+static void
+gen_edge(const char *fname)
+{
+ hid_t fid = -1; /* file id */
+ hid_t fapl = -1; /* file access property list */
+ hid_t sid = -1; /* dataspace id */
+ hid_t dcpl = -1; /* dataset creation property id */
+ hid_t did = -1; /* dataset id */
+ hsize_t dims2[2] = {12, 6}; /* Dataset dimensions */
+ hsize_t c_dims[2] = {5, 5}; /* Chunk dimensions */
+ float buf[12][6]; /* Buffer for writing data */
+ int i, j; /* local index variable */
+
+ /* Create a new format file */
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ goto error;
+ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ goto error;
+ if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ goto error;
+
+ /* Set chunk, filter, no-filter-edge-chunk */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if(H5Pset_chunk(dcpl, 2, c_dims) < 0)
+ goto error;
+ if(H5Pset_deflate(dcpl, 9) < 0)
+ goto error;
+ if(H5Pset_chunk_opts(dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS) < 0)
+ goto error;
+
+ /* Create dataspace */
+ if((sid = H5Screate_simple(2, dims2, NULL)) < 0)
+ goto error;
+
+ /* Create the dataset */
+ if((did = H5Dcreate2(fid, DSET_EDGE, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Create data */
+ for (i = 0; i< 12; i++)
+ for (j = 0; j< 6; j++)
+ buf[i][j] = 100.0F;
+
+ /* Write to the dataset */
+ if(H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto error;
+
+ /* Closing */
+ if(H5Pclose(dcpl) < 0)
+ goto error;
+ if(H5Sclose(sid) < 0)
+ goto error;
+ if(H5Dclose(did) < 0)
+ goto error;
+ if(H5Pclose(fapl) < 0)
+ goto error;
+ if(H5Fclose(fid) < 0)
+ goto error;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Pclose(dcpl);
+ H5Sclose(sid);
+ H5Dclose(did);
+ H5Fclose(fid);
+ H5Pclose(fapl);
+ } H5E_END_TRY;
+
+} /* gen_edge() */
+
+int main(void)
+{
+ /* Generate an old format file with v1 superbock */
+ gen_old(OLD_V1_FILE);
+
+ /* Generate a latest-format file with v3 superblock */
+ gen_latest(LATEST_V3_FILE);
+
+ /* Generate a non-latest-format file with v3 superblock */
+ gen_non(NON_V3_FILE);
+
+ /* Generate a new format file with a no-filter-edge-chunk dataset for testing */
+ gen_edge(EDGE_V3_FILE);
+ return 0;
+}
diff --git a/tools/h5format_convert/h5format_convert.c b/tools/h5format_convert/h5format_convert.c
new file mode 100644
index 0000000..7686acc
--- /dev/null
+++ b/tools/h5format_convert/h5format_convert.c
@@ -0,0 +1,438 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Programmer: Vailin Choi; Feb 2015
+ */
+
+
+/*
+ * We include the private header file so we can get to the uniform
+ * programming environment it declares.
+ * HDF5 API functions (except for H5G_basename())
+ */
+#include "H5private.h"
+#include "h5tools.h"
+#include "h5tools_utils.h"
+#include "h5trav.h"
+
+/* Name of tool */
+#define PROGRAMNAME "h5format_convert"
+
+static char *fname_g = NULL;
+static char *dname_g = NULL;
+static int dset_g = FALSE;
+static int noop_g = FALSE;
+static int verbose_g = 0;
+
+/*
+ * Command-line options: The user can specify short or long-named
+ * parameters.
+ */
+static const char *s_opts = "hVvd:n";
+static struct long_options l_opts[] = {
+ { "help", no_arg, 'h' },
+ { "hel", no_arg, 'h'},
+ { "he", no_arg, 'h'},
+ { "version", no_arg, 'V' },
+ { "version", no_arg, 'V' },
+ { "versio", no_arg, 'V' },
+ { "versi", no_arg, 'V' },
+ { "vers", no_arg, 'V' },
+ { "verbose", no_arg, 'v' },
+ { "verbos", no_arg, 'v' },
+ { "verbo", no_arg, 'v' },
+ { "verb", no_arg, 'v' },
+ { "dname", require_arg, 'd' },
+ { "dnam", require_arg, 'd' },
+ { "dna", require_arg, 'd' },
+ { "dn", require_arg, 'd' },
+ { "noop", no_arg, 'n' },
+ { "noo", no_arg, 'n' },
+ { "no", no_arg, 'n' },
+ { NULL, 0, '\0' }
+};
+
+
+/*-------------------------------------------------------------------------
+ * Function: usage
+ *
+ * Purpose: print usage
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
+static void usage(const char *prog)
+{
+ printf("usage: %s [OPTIONS] file_name\n", prog);
+ printf(" OPTIONS\n");
+ printf(" -h, --help Print a usage message and exit\n");
+ printf(" -V, --version Print version number and exit\n");
+ printf(" -v, --verbose Turn on verbose mode\n");
+ printf(" -d dname, --dname=dataset_name Pathname for the dataset\n");
+ printf(" -n, --noop Perform all the steps except the actual conversion\n");
+ printf("\n");
+ printf("Examples of use:\n");
+ printf("\n");
+ printf("h5format_convert -d /group/dataset file_name\n");
+ printf(" Convert the chunk indexing type to version 1 B-tree\n");
+ printf(" for the chunked dataset </group/dataset> in the HDF5 file <file_name>.\n");
+ printf("\n");
+ printf("h5format_convert file_name\n");
+ printf(" Convert the chunk indexing type to version 1 B-tree\n");
+ printf(" for all the chunked datasets in the HDF5 file <file_name>.\n");
+ printf("\n");
+ printf("h5format_convert -n -d /group/dataset file_name\n");
+ printf(" Go through all the steps except the actual conversion when \n");
+ printf(" converting the chunked dataset </group/dataset> in the HDF5 file <file_name>.\n");
+} /* usage() */
+
+/*-------------------------------------------------------------------------
+ * Function: parse_command_line
+ *
+ * Purpose: parse command line input
+ *
+ * Return: Success: 0
+ * Failure: 1
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+parse_command_line(int argc, const char **argv)
+{
+ int opt;
+
+ /* no arguments */
+ if (argc == 1) {
+ usage(h5tools_getprogname());
+ h5tools_setstatus(EXIT_FAILURE);
+ goto error;
+ }
+
+ /* parse command line options */
+ while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
+ switch((char) opt) {
+ case 'h':
+ usage(h5tools_getprogname());
+ h5tools_setstatus(EXIT_SUCCESS);
+ goto error;
+
+ case 'V':
+ print_version(h5tools_getprogname());
+ h5tools_setstatus(EXIT_SUCCESS);
+ goto error;
+
+ case 'v':
+ verbose_g = TRUE;
+ break;
+
+ case 'd': /* -d dname */
+ if(opt_arg != NULL && *opt_arg)
+ /* if(opt_arg != NULL)*/
+ dname_g = HDstrdup(opt_arg);
+ if(dname_g == NULL) {
+ h5tools_setstatus(EXIT_FAILURE);
+ error_msg("No dataset name\n", opt_arg);
+ usage(h5tools_getprogname());
+ goto error;
+ }
+ dset_g = TRUE;
+ break;
+
+ case 'n': /* -n */
+ noop_g = TRUE;
+ break;
+
+ default:
+ h5tools_setstatus(EXIT_FAILURE);
+ usage(h5tools_getprogname());
+ goto error;
+ break;
+ } /* switch */
+ } /* while */
+
+ if (argc <= opt_ind) {
+ error_msg("missing file name\n");
+ usage(h5tools_getprogname());
+ h5tools_setstatus(EXIT_FAILURE);
+ goto error;
+ }
+
+ fname_g = HDstrdup(argv[opt_ind]);
+
+ return(0);
+
+error:
+ return(-1); ;
+} /* parse_command_line() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: leave
+ *
+ * Purpose: Close HDF5
+ *
+ * Return: Does not return
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+leave(int ret)
+{
+ h5tools_close();
+
+ HDexit(ret);
+} /* leave() */
+
+/*-------------------------------------------------------------------------
+ * Function: convert()
+ *
+ * Purpose: To change the chunk indexing type for the dataset to version 1 B-tree.
+ * -- the dataset has to be chunked
+ * -- the dataset's chunk indexing type is not already version 1 B-tree.
+ * If the above conditions are not fulfilled, the tool will not perform
+ * the conversion but will exit with success.
+ *
+ * Return: Success: 0
+ * Failure: 1
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+convert(hid_t fid, const char *dname)
+{
+ hid_t dcpl = -1;
+ hid_t did = -1;
+ H5D_layout_t layout_type;
+ H5D_chunk_index_t idx_type;
+
+ /* Open the dataset */
+ if((did = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0) {
+ error_msg("unable to open dataset \"%s\"\n", dname);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto error;
+
+ } else if(verbose_g)
+ printf("Open the dataset\n");
+
+ /* Get the dataset's creation property list */
+ if((dcpl = H5Dget_create_plist(did)) < 0) {
+ error_msg("unable to get the dataset creation property list\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ goto error;
+ }
+
+ /* Get the dataset's layout */
+ if((layout_type = H5Pget_layout(dcpl)) < 0) {
+ error_msg("unable to get the dataset layout type\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ goto error;
+
+ } else if(verbose_g)
+ printf("Retrieve the dataset's layout\n");
+
+ /* No further action if not a chunked dataset */
+ if(layout_type != H5D_CHUNKED) {
+ if(verbose_g)
+ printf("Dataset is not chunked: no further action\n");
+ h5tools_setstatus(EXIT_SUCCESS);
+ goto done;
+
+ } else if(verbose_g)
+ printf("Verify the dataset is a chunked dataset\n");
+
+ /* Get the dataset's chunk indexing type */
+ if(H5Dget_chunk_index_type(did, &idx_type) < 0) {
+ error_msg("unable to get the chunk indexing type for \"%s\"\n", dname);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto error;
+
+ } else if(verbose_g)
+ printf("Retrieve the dataset's chunk indexing type\n");
+
+ /* No further action if the chunk indexing type is already version 1 B-tree */
+ if(idx_type == H5D_CHUNK_IDX_BTREE) {
+ if(verbose_g)
+ printf("Chunk indexing type is already version 1 B-tree: no further action\n");
+ h5tools_setstatus(EXIT_SUCCESS);
+ goto done;
+
+ } else if (verbose_g)
+ printf("Verify the dataset's chunk indexing type is not version 1 B-tree\n");
+
+ /* No further action if it is a noop */
+ if(noop_g) {
+ if(verbose_g)
+ printf("Not converting the dataset\n");
+ h5tools_setstatus(EXIT_SUCCESS);
+ goto done;
+ }
+
+ if(verbose_g)
+ printf("Converting the dataset...\n");
+
+ /* Convert the dataset's chunk indexing type to version 1 B-tree */
+ if(H5Dformat_convert(did) < 0) {
+ error_msg("unable to convert chunk indexing for \"%s\"\n", dname);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto error;
+
+ } else if(verbose_g)
+ printf("Done\n");
+
+done:
+ /* Close the dataset */
+ if(H5Dclose(did) < 0) {
+ error_msg("unable to close dataset \"%s\"\n", dname);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto error;
+ } else if(verbose_g)
+ printf("Close the dataset\n");
+
+ /* Close the dataset creation property list */
+ if(H5Pclose(dcpl) < 0) {
+ error_msg("unable to close dataset creation property list\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ goto error;
+ } else if(verbose_g)
+ printf("Close the dataset creation property list\n");
+
+ return(0);
+
+error:
+ if(verbose_g)
+ printf("Error encountered\n");
+
+ H5E_BEGIN_TRY {
+ H5Pclose(dcpl);
+ H5Dclose(did);
+ } H5E_END_TRY;
+
+ return(-1);
+
+} /* convert() */
+
+/*-------------------------------------------------------------------------
+ * Function: convert_dsets_cb()
+ *
+ * Purpose: The callback routine from the traversal to convert the
+ * chunk indexing type of the dataset object.
+ *
+ * Return: Success: 0
+ * Failure: 1
+ *-------------------------------------------------------------------------
+ */
+static int
+convert_dsets_cb(const char *path, const H5O_info_t *oi, const char *already_visited, void *_fid)
+{
+ hid_t fid = *(hid_t *)_fid;
+
+ /* If the object has already been seen then just return */
+ if(NULL == already_visited) {
+
+ if(oi->type == H5O_TYPE_DATASET) {
+ if(verbose_g)
+ printf("Going to process dataset:%s...\n", path);
+ if(convert(fid, path) < 0)
+ goto error;
+ }
+
+ } /* end if */
+
+ return 0;
+
+error:
+ return -1;
+
+} /* end convert_dsets_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: To convert the chunk indexing type of a dataset in a file to
+ * version 1 B-tree.
+ *
+ * Return: Success: 0
+ * Failure: 1
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+main(int argc, const char *argv[])
+{
+ H5E_auto2_t func;
+ void *edata;
+ hid_t fid = -1;
+
+ h5tools_setprogname(PROGRAMNAME);
+ h5tools_setstatus(EXIT_SUCCESS);
+
+ /* Disable error reporting */
+ H5Eget_auto2(H5E_DEFAULT, &func, &edata);
+ H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
+
+ /* Initialize h5tools lib */
+ h5tools_init();
+
+ /* Parse command line options */
+ if(parse_command_line(argc, argv) < 0)
+ goto done;
+ else if(verbose_g)
+ printf("Process command line options\n");
+
+ if(noop_g && verbose_g)
+ printf("It is noop...\n");
+
+ /* Open the HDF5 file */
+ if((fid = h5tools_fopen(fname_g, H5F_ACC_RDWR, H5P_DEFAULT, NULL, NULL, 0)) < 0) {
+ error_msg("unable to open file \"%s\"\n", fname_g);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ } else if(verbose_g)
+ printf("Open the file %s\n", fname_g);
+
+ if(dset_g) { /* Convert a specified dataset in the file */
+ if(verbose_g)
+ printf("Going to process dataset: %s...\n", dname_g);
+ if(convert(fid, dname_g) < 0)
+ goto done;
+ } else { /* Convert all datasets in the file */
+ if(verbose_g)
+ printf("Processing all datasets in the file...\n");
+ if(h5trav_visit(fid, "/", TRUE, TRUE, convert_dsets_cb, NULL, &fid) < 0)
+ goto done;
+ }
+
+done:
+ /* Close the file */
+ if(fid >= 0) {
+ if(H5Fclose(fid) < 0) {
+ error_msg("unable to close file \"%s\"\n", fname_g);
+ h5tools_setstatus(EXIT_FAILURE);
+ } else if(verbose_g)
+ printf("Close the file\n");
+ }
+
+ if(fname_g)
+ HDfree(fname_g);
+ if(dname_g)
+ HDfree(dname_g);
+
+ H5Eset_auto2(H5E_DEFAULT, func, edata);
+ leave(h5tools_getstatus());
+
+} /* end main() */
diff --git a/tools/h5format_convert/testfiles/h5fc_d_file.ddl b/tools/h5format_convert/testfiles/h5fc_d_file.ddl
new file mode 100644
index 0000000..3641a4f
--- /dev/null
+++ b/tools/h5format_convert/testfiles/h5fc_d_file.ddl
@@ -0,0 +1,22 @@
+usage: h5format_convert [OPTIONS] file_name
+ OPTIONS
+ -h, --help Print a usage message and exit
+ -V, --version Print version number and exit
+ -v, --verbose Turn on verbose mode
+ -d dname, --dname=dataset_name Pathname for the dataset
+ -n, --noop Perform all the steps except the actual conversion
+
+Examples of use:
+
+h5format_convert -d /group/dataset file_name
+ Convert the chunk indexing type to version 1 B-tree
+ for the chunked dataset </group/dataset> in the HDF5 file <file_name>.
+
+h5format_convert file_name
+ Convert the chunk indexing type to version 1 B-tree
+ for all the chunked datasets in the HDF5 file <file_name>.
+
+h5format_convert -n -d /group/dataset file_name
+ Go through all the steps except the actual conversion when
+ converting the chunked dataset </group/dataset> in the HDF5 file <file_name>.
+h5format_convert error: missing file name
diff --git a/tools/h5format_convert/testfiles/h5fc_dname.ddl b/tools/h5format_convert/testfiles/h5fc_dname.ddl
new file mode 100644
index 0000000..c391764
--- /dev/null
+++ b/tools/h5format_convert/testfiles/h5fc_dname.ddl
@@ -0,0 +1,22 @@
+usage: h5format_convert [OPTIONS] file_name
+ OPTIONS
+ -h, --help Print a usage message and exit
+ -V, --version Print version number and exit
+ -v, --verbose Turn on verbose mode
+ -d dname, --dname=dataset_name Pathname for the dataset
+ -n, --noop Perform all the steps except the actual conversion
+
+Examples of use:
+
+h5format_convert -d /group/dataset file_name
+ Convert the chunk indexing type to version 1 B-tree
+ for the chunked dataset </group/dataset> in the HDF5 file <file_name>.
+
+h5format_convert file_name
+ Convert the chunk indexing type to version 1 B-tree
+ for all the chunked datasets in the HDF5 file <file_name>.
+
+h5format_convert -n -d /group/dataset file_name
+ Go through all the steps except the actual conversion when
+ converting the chunked dataset </group/dataset> in the HDF5 file <file_name>.
+h5format_convert error: No dataset name
diff --git a/tools/h5format_convert/testfiles/h5fc_edge_v3.h5 b/tools/h5format_convert/testfiles/h5fc_edge_v3.h5
new file mode 100644
index 0000000..debeda4
--- /dev/null
+++ b/tools/h5format_convert/testfiles/h5fc_edge_v3.h5
Binary files differ
diff --git a/tools/h5format_convert/testfiles/h5fc_help.ddl b/tools/h5format_convert/testfiles/h5fc_help.ddl
new file mode 100644
index 0000000..9081ab8
--- /dev/null
+++ b/tools/h5format_convert/testfiles/h5fc_help.ddl
@@ -0,0 +1,21 @@
+usage: h5format_convert [OPTIONS] file_name
+ OPTIONS
+ -h, --help Print a usage message and exit
+ -V, --version Print version number and exit
+ -v, --verbose Turn on verbose mode
+ -d dname, --dname=dataset_name Pathname for the dataset
+ -n, --noop Perform all the steps except the actual conversion
+
+Examples of use:
+
+h5format_convert -d /group/dataset file_name
+ Convert the chunk indexing type to version 1 B-tree
+ for the chunked dataset </group/dataset> in the HDF5 file <file_name>.
+
+h5format_convert file_name
+ Convert the chunk indexing type to version 1 B-tree
+ for all the chunked datasets in the HDF5 file <file_name>.
+
+h5format_convert -n -d /group/dataset file_name
+ Go through all the steps except the actual conversion when
+ converting the chunked dataset </group/dataset> in the HDF5 file <file_name>.
diff --git a/tools/h5format_convert/testfiles/h5fc_latest_v3.h5 b/tools/h5format_convert/testfiles/h5fc_latest_v3.h5
new file mode 100644
index 0000000..f7de743
--- /dev/null
+++ b/tools/h5format_convert/testfiles/h5fc_latest_v3.h5
Binary files differ
diff --git a/tools/h5format_convert/testfiles/h5fc_non_v3.h5 b/tools/h5format_convert/testfiles/h5fc_non_v3.h5
new file mode 100644
index 0000000..b1bffa8
--- /dev/null
+++ b/tools/h5format_convert/testfiles/h5fc_non_v3.h5
Binary files differ
diff --git a/tools/h5format_convert/testfiles/h5fc_nonexistdset_file.ddl b/tools/h5format_convert/testfiles/h5fc_nonexistdset_file.ddl
new file mode 100644
index 0000000..39450c0
--- /dev/null
+++ b/tools/h5format_convert/testfiles/h5fc_nonexistdset_file.ddl
@@ -0,0 +1 @@
+h5format_convert error: unable to open dataset "nonexist"
diff --git a/tools/h5format_convert/testfiles/h5fc_nonexistfile.ddl b/tools/h5format_convert/testfiles/h5fc_nonexistfile.ddl
new file mode 100644
index 0000000..706ea9d
--- /dev/null
+++ b/tools/h5format_convert/testfiles/h5fc_nonexistfile.ddl
@@ -0,0 +1 @@
+h5format_convert error: unable to open file "nonexist.h5"
diff --git a/tools/h5format_convert/testfiles/h5fc_nooption.ddl b/tools/h5format_convert/testfiles/h5fc_nooption.ddl
new file mode 100644
index 0000000..9081ab8
--- /dev/null
+++ b/tools/h5format_convert/testfiles/h5fc_nooption.ddl
@@ -0,0 +1,21 @@
+usage: h5format_convert [OPTIONS] file_name
+ OPTIONS
+ -h, --help Print a usage message and exit
+ -V, --version Print version number and exit
+ -v, --verbose Turn on verbose mode
+ -d dname, --dname=dataset_name Pathname for the dataset
+ -n, --noop Perform all the steps except the actual conversion
+
+Examples of use:
+
+h5format_convert -d /group/dataset file_name
+ Convert the chunk indexing type to version 1 B-tree
+ for the chunked dataset </group/dataset> in the HDF5 file <file_name>.
+
+h5format_convert file_name
+ Convert the chunk indexing type to version 1 B-tree
+ for all the chunked datasets in the HDF5 file <file_name>.
+
+h5format_convert -n -d /group/dataset file_name
+ Go through all the steps except the actual conversion when
+ converting the chunked dataset </group/dataset> in the HDF5 file <file_name>.
diff --git a/tools/h5format_convert/testfiles/h5fc_v1.h5 b/tools/h5format_convert/testfiles/h5fc_v1.h5
new file mode 100644
index 0000000..d3d66f8
--- /dev/null
+++ b/tools/h5format_convert/testfiles/h5fc_v1.h5
Binary files differ
diff --git a/tools/h5format_convert/testfiles/h5fc_v_all.ddl b/tools/h5format_convert/testfiles/h5fc_v_all.ddl
new file mode 100644
index 0000000..3f474fe
--- /dev/null
+++ b/tools/h5format_convert/testfiles/h5fc_v_all.ddl
@@ -0,0 +1,26 @@
+Process command line options
+Open the file tmp.h5
+Processing all datasets in the file...
+Going to process dataset:/DSET_NDATA_BT1...
+Open the dataset
+Retrieve the dataset's layout
+Verify the dataset is a chunked dataset
+Retrieve the dataset's chunk indexing type
+Chunk indexing type is already version 1 B-tree: no further action
+Close the dataset
+Close the dataset creation property list
+Going to process dataset:/DSET_NON_CHUNKED...
+Open the dataset
+Retrieve the dataset's layout
+Dataset is not chunked: no further action
+Close the dataset
+Close the dataset creation property list
+Going to process dataset:/GROUP/DSET_BT1...
+Open the dataset
+Retrieve the dataset's layout
+Verify the dataset is a chunked dataset
+Retrieve the dataset's chunk indexing type
+Chunk indexing type is already version 1 B-tree: no further action
+Close the dataset
+Close the dataset creation property list
+Close the file
diff --git a/tools/h5format_convert/testfiles/h5fc_v_bt1.ddl b/tools/h5format_convert/testfiles/h5fc_v_bt1.ddl
new file mode 100644
index 0000000..abb0a89
--- /dev/null
+++ b/tools/h5format_convert/testfiles/h5fc_v_bt1.ddl
@@ -0,0 +1,11 @@
+Process command line options
+Open the file tmp.h5
+Going to process dataset: /GROUP/DSET_BT1...
+Open the dataset
+Retrieve the dataset's layout
+Verify the dataset is a chunked dataset
+Retrieve the dataset's chunk indexing type
+Chunk indexing type is already version 1 B-tree: no further action
+Close the dataset
+Close the dataset creation property list
+Close the file
diff --git a/tools/h5format_convert/testfiles/h5fc_v_n_1d.ddl b/tools/h5format_convert/testfiles/h5fc_v_n_1d.ddl
new file mode 100644
index 0000000..a26dc66
--- /dev/null
+++ b/tools/h5format_convert/testfiles/h5fc_v_n_1d.ddl
@@ -0,0 +1,13 @@
+Process command line options
+It is noop...
+Open the file tmp.h5
+Going to process dataset: /DSET_EA...
+Open the dataset
+Retrieve the dataset's layout
+Verify the dataset is a chunked dataset
+Retrieve the dataset's chunk indexing type
+Verify the dataset's chunk indexing type is not version 1 B-tree
+Not converting the dataset
+Close the dataset
+Close the dataset creation property list
+Close the file
diff --git a/tools/h5format_convert/testfiles/h5fc_v_n_all.ddl b/tools/h5format_convert/testfiles/h5fc_v_n_all.ddl
new file mode 100644
index 0000000..76c70ee
--- /dev/null
+++ b/tools/h5format_convert/testfiles/h5fc_v_n_all.ddl
@@ -0,0 +1,47 @@
+Process command line options
+It is noop...
+Open the file tmp.h5
+Processing all datasets in the file...
+Going to process dataset:/DSET_NDATA_BT2...
+Open the dataset
+Retrieve the dataset's layout
+Verify the dataset is a chunked dataset
+Retrieve the dataset's chunk indexing type
+Verify the dataset's chunk indexing type is not version 1 B-tree
+Not converting the dataset
+Close the dataset
+Close the dataset creation property list
+Going to process dataset:/DSET_NDATA_EA...
+Open the dataset
+Retrieve the dataset's layout
+Verify the dataset is a chunked dataset
+Retrieve the dataset's chunk indexing type
+Verify the dataset's chunk indexing type is not version 1 B-tree
+Not converting the dataset
+Close the dataset
+Close the dataset creation property list
+Going to process dataset:/GROUP/DSET_BT2...
+Open the dataset
+Retrieve the dataset's layout
+Verify the dataset is a chunked dataset
+Retrieve the dataset's chunk indexing type
+Verify the dataset's chunk indexing type is not version 1 B-tree
+Not converting the dataset
+Close the dataset
+Close the dataset creation property list
+Going to process dataset:/GROUP/DSET_EA...
+Open the dataset
+Retrieve the dataset's layout
+Verify the dataset is a chunked dataset
+Retrieve the dataset's chunk indexing type
+Verify the dataset's chunk indexing type is not version 1 B-tree
+Not converting the dataset
+Close the dataset
+Close the dataset creation property list
+Going to process dataset:/GROUP/DSET_NON_CHUNKED...
+Open the dataset
+Retrieve the dataset's layout
+Dataset is not chunked: no further action
+Close the dataset
+Close the dataset creation property list
+Close the file
diff --git a/tools/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl b/tools/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl
new file mode 100644
index 0000000..86081f3
--- /dev/null
+++ b/tools/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl
@@ -0,0 +1,12 @@
+Process command line options
+It is noop...
+Open the file tmp.h5
+Going to process dataset: /DSET_NDATA_BT1...
+Open the dataset
+Retrieve the dataset's layout
+Verify the dataset is a chunked dataset
+Retrieve the dataset's chunk indexing type
+Chunk indexing type is already version 1 B-tree: no further action
+Close the dataset
+Close the dataset creation property list
+Close the file
diff --git a/tools/h5format_convert/testfiles/h5fc_v_non_chunked.ddl b/tools/h5format_convert/testfiles/h5fc_v_non_chunked.ddl
new file mode 100644
index 0000000..baba0e4
--- /dev/null
+++ b/tools/h5format_convert/testfiles/h5fc_v_non_chunked.ddl
@@ -0,0 +1,9 @@
+Process command line options
+Open the file tmp.h5
+Going to process dataset: /DSET_NON_CHUNKED...
+Open the dataset
+Retrieve the dataset's layout
+Dataset is not chunked: no further action
+Close the dataset
+Close the dataset creation property list
+Close the file
diff --git a/tools/h5format_convert/testh5fc.sh.in b/tools/h5format_convert/testh5fc.sh.in
new file mode 100644
index 0000000..dc5aa48
--- /dev/null
+++ b/tools/h5format_convert/testh5fc.sh.in
@@ -0,0 +1,400 @@
+#! /bin/sh
+#
+# 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.
+#
+# Tests for the h5format_convert tool
+#
+#
+
+srcdir=@srcdir@
+
+# Determine which filters are available
+USE_FILTER_SZIP="@USE_FILTER_SZIP@"
+USE_FILTER_DEFLATE="@USE_FILTER_DEFLATE@"
+USE_FILTER_SHUFFLE="@USE_FILTER_SHUFFLE@"
+USE_FILTER_FLETCHER32="@USE_FILTER_FLETCHER32@"
+USE_FILTER_NBIT="@USE_FILTER_NBIT@"
+USE_FILTER_SCALEOFFSET="@USE_FILTER_SCALEOFFSET@"
+
+TESTNAME=h5format_convert
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+FORMCONV=h5format_convert # The tool name
+FORMCONV_BIN=`pwd`/$FORMCONV # The path of the tool binary
+
+CHK_IDX=h5fc_chk_idx # The program name
+CHK_IDX_BIN=`pwd`/$CHK_IDX # The program to verify the chunk indexing type is v1 B-tree
+
+RM='rm -rf'
+CMP='cmp -s'
+DIFF='diff -c'
+CP='cp'
+DIRNAME='dirname'
+LS='ls'
+AWK='awk'
+
+nerrors=0
+verbose=yes
+
+# source dirs
+SRC_TOOLS="$srcdir/.."
+SRC_TOOLS_TESTFILES="$SRC_TOOLS/testfiles"
+
+# testfiles source dirs for tools
+SRC_H5LS_TESTFILES="$SRC_TOOLS_TESTFILES"
+SRC_H5DUMP_TESTFILES="$SRC_TOOLS_TESTFILES"
+SRC_H5DIFF_TESTFILES="$SRC_TOOLS/h5diff/testfiles"
+SRC_H5COPY_TESTFILES="$SRC_TOOLS/h5copy/testfiles"
+SRC_H5REPACK_TESTFILES="$SRC_TOOLS/h5repack/testfiles"
+SRC_H5JAM_TESTFILES="$SRC_TOOLS/h5jam/testfiles"
+SRC_H5STAT_TESTFILES="$SRC_TOOLS/h5stat/testfiles"
+SRC_H5IMPORT_TESTFILES="$SRC_TOOLS/h5import/testfiles"
+SRC_H5FORMCONV_TESTFILES="$SRC_TOOLS/h5format_convert/testfiles"
+
+TESTDIR=./testfiles
+test -d $TESTDIR || mkdir $TESTDIR
+
+# Copy the testfile to a temporary file for testing as h5format_convert is changing the file in place
+TMPFILE=tmp.h5
+
+######################################################################
+# test files
+# --------------------------------------------------------------------
+# All the test files copy from source directory to test directory
+# NOTE: Keep this framework to add/remove test files.
+# Any test files from other tools can be used in this framework.
+# This list are also used for checking exist.
+# Comment '#' without space can be used.
+# --------------------------------------------------------------------
+LIST_HDF5_TEST_FILES="
+$SRC_H5FORMCONV_TESTFILES/h5fc_v1.h5
+$SRC_H5FORMCONV_TESTFILES/h5fc_latest_v3.h5
+$SRC_H5FORMCONV_TESTFILES/h5fc_non_v3.h5
+$SRC_H5FORMCONV_TESTFILES/h5fc_edge_v3.h5
+"
+
+LIST_OTHER_TEST_FILES="
+$SRC_H5FORMCONV_TESTFILES/h5fc_help.ddl
+$SRC_H5FORMCONV_TESTFILES/h5fc_nooption.ddl
+$SRC_H5FORMCONV_TESTFILES/h5fc_nonexistfile.ddl
+$SRC_H5FORMCONV_TESTFILES/h5fc_d_file.ddl
+$SRC_H5FORMCONV_TESTFILES/h5fc_dname.ddl
+$SRC_H5FORMCONV_TESTFILES/h5fc_nonexistdset_file.ddl
+$SRC_H5FORMCONV_TESTFILES/h5fc_v_non_chunked.ddl
+$SRC_H5FORMCONV_TESTFILES/h5fc_v_bt1.ddl
+$SRC_H5FORMCONV_TESTFILES/h5fc_v_ndata_bt1.ddl
+$SRC_H5FORMCONV_TESTFILES/h5fc_v_all.ddl
+$SRC_H5FORMCONV_TESTFILES/h5fc_v_n_1d.ddl
+$SRC_H5FORMCONV_TESTFILES/h5fc_v_n_all.ddl
+"
+
+#
+# copy test files and expected output files from source dirs to test dir
+#
+COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_OTHER_TEST_FILES"
+
+COPY_TESTFILES_TO_TESTDIR()
+{
+ # copy test files. Used -f to make sure get a new copy
+ for tstfile in $COPY_TESTFILES
+ do
+ # ignore '#' comment
+ echo $tstfile | tr -d ' ' | grep '^#' > /dev/null
+ RET=$?
+ if [ $RET -eq 1 ]; then
+ # skip cp if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=`$DIRNAME $tstfile`
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $CP -f $tstfile $TESTDIR
+ if [ $? -ne 0 ]; then
+ echo "Error: FAILED to copy $tstfile ."
+
+ # Comment out this to CREATE expected file
+ exit $EXIT_FAILURE
+ fi
+ fi
+ fi
+ done
+}
+
+CLEAN_TESTFILES_AND_TESTDIR()
+{
+ # skip rm if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=`$DIRNAME $tstfile`
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $RM $TESTDIR
+ else
+ $RM $TESTDIR/$TMPFILE
+ fi
+}
+
+# Print a line-line message left justified in a field of 80 characters
+# beginning with the word "Testing".
+#
+TESTING() {
+ SPACES=" "
+ echo "Testing $* $SPACES" | cut -c1-80 | tr -d '\012'
+}
+
+# Run a test and print PASS or *FAIL*. If a test fails then increment
+# the `nerrors' global variable and (if $verbose is set) display the
+# difference between the actual output and the expected output. The
+# expected output is given as the first argument to this function and
+# the actual output file is calculated by replacing the `.ddl' with
+# `.out'. The actual output is not removed if $HDF5_NOCLEANUP has a
+# non-zero value.
+#
+# $1: expected output
+# $2: the test file name
+# --fname might be empty or fname does not exist
+# --fname is copied to a temporary file for testing
+# $3 to at most $6--options to the tool such as:
+# -d dname or --dname=dname
+# -v or --verbose
+# -n or --noop
+TOOLTEST_OUT() {
+ # Prepare expected and actual output
+ expect="$TESTDIR/$1"
+ actual="$TESTDIR/`basename $1 .ddl`.out"
+ actual_err="$TESTDIR/`basename $1 .ddl`.err"
+ actual_sav=${actual}-sav
+ actual_err_sav=${actual_err}-sav
+
+ # Prepare the test file
+ $RM $TESTDIR/$TMPFILE
+ TFILE=$2
+ if [ ! -z "$2" ] && [ -e $TESTDIR/$2 ] ; then
+ $CP $TESTDIR/$2 $TESTDIR/$TMPFILE
+ TFILE=$TMPFILE
+ fi
+
+ # Run test.
+ TESTING $FORMCONV $3 $4 $5 $6 $2
+ (
+ cd $TESTDIR
+ $RUNSERIAL $FORMCONV_BIN $3 $4 $5 $6 $TFILE
+ ) >$actual 2>$actual_err
+ cp $actual $actual_sav
+ cp $actual_err $actual_err_sav
+ cat $actual_err >> $actual
+
+ # Compare output
+ if $CMP $expect $actual; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Expected result (*.ddl) differs from actual result (*.out)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
+ fi
+
+ # Clean up output file
+ if test -z "$HDF5_NOCLEANUP"; then
+ $RM $actual $actual_err
+ $RM $actual $actual_err $actual_sav $actual_err_sav
+ fi
+}
+
+# To check that the tool exits success, no output
+# Assume all short options
+# $1 is the test file name
+# --fname exists
+# --fname is copied to a temporary file for testing
+# $2 to at most $4--options to the tool such as:
+# -d dname
+# -n
+TOOLTEST() {
+ TESTING $FORMCONV $2 $3 $4 $1
+ $RM $TESTDIR/$TMPFILE
+ $CP $TESTDIR/$1 $TESTDIR/$TMPFILE
+ $RUNSERIAL $FORMCONV_BIN $2 $3 $4 $TESTDIR/$TMPFILE
+ exitcode=$?
+ if [ $exitcode -ne 0 ]; then
+ echo "*FAILED*"
+ echo " The tool exits failure"
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+ fi
+}
+
+CHECKING() {
+ SPACES=" "
+ echo "Verifying $* $SPACES" | cut -c1-80 | tr -d '\012'
+}
+
+# $1 dataset name
+# Assume $TESTDIR/$TMPFILE is the converted test file
+IDX_CHECK() {
+ CHECKING $1
+ $RUNSERIAL $CHK_IDX_BIN $TESTDIR/$TMPFILE $1
+ ret=$?
+ if [ $ret -eq 0 ]; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " The chunk indexing type is not correct"
+ nerrors="`expr $nerrors + 1`"
+ fi
+}
+
+# Print a "SKIP" message
+SKIP() {
+ TESTING $STAT $@
+ echo " -SKIP-"
+}
+
+
+
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+# prepare for test
+COPY_TESTFILES_TO_TESTDIR
+#
+#
+#
+# h5format_convert --help
+# h5format_convert (no options)
+# h5format_convert nonexist.h5 (no options, file does not exist)
+TOOLTEST_OUT h5fc_help.ddl '' --help
+TOOLTEST_OUT h5fc_nooption.ddl ''
+TOOLTEST_OUT h5fc_nonexistfile.ddl nonexist.h5
+#
+#
+# h5format_convert -d h5fc_v1.h5 (just -d option, file exists)
+# h5format_convert --dname h5fc_v1.h5 (just --dname option, file exists)
+# h5format_convert --dname (just --dname option)
+# h5format_convert --dname=nonexist h5fc_v1.h5 (dataset does not exist, file exists)
+TOOLTEST_OUT h5fc_d_file.ddl h5fc_v1.h5 -d
+TOOLTEST_OUT h5fc_d_file.ddl h5fc_v1.h5 --dname
+TOOLTEST_OUT h5fc_dname.ddl '' --dname
+TOOLTEST_OUT h5fc_nonexistdset_file.ddl h5fc_v1.h5 --dname=nonexist
+#
+#
+#
+# h5format_convert -d /DSET_NON_CHUNKED -v h5fc_v1.h5 (verbose, non-chunked dataset)
+# h5format_convert -d /GROUP/DSET_BT1 --verbose h5fc_v1.h5 (verbose, bt1 dataset)
+# h5format_convert -d /DSET_NDATA_BT1 -v -n h5fc_v1.h5 (verbose, noop, bt1+nodata dataset)
+# h5format_convert -v h5fc_v1.h5 (verbose, all datasets)
+TOOLTEST_OUT h5fc_v_non_chunked.ddl h5fc_v1.h5 -d /DSET_NON_CHUNKED -v
+TOOLTEST_OUT h5fc_v_bt1.ddl h5fc_v1.h5 -d /GROUP/DSET_BT1 --verbose
+TOOLTEST_OUT h5fc_v_ndata_bt1.ddl h5fc_v1.h5 -d /DSET_NDATA_BT1 -v -n
+TOOLTEST_OUT h5fc_v_all.ddl h5fc_v1.h5 -v
+#
+#
+#
+# h5format_convert -d /DSET_EA -v -n h5fc_latest_v3.h5 (verbose, noop, one ea dataset)
+# h5format_convert -v -n h5fc_non_v3.h5 (verbose, noop, all datasets)
+TOOLTEST_OUT h5fc_v_n_1d.ddl h5fc_latest_v3.h5 -d /DSET_EA -v -n
+TOOLTEST_OUT h5fc_v_n_all.ddl h5fc_non_v3.h5 -v -n
+#
+#
+#
+# No output from tests
+# 1) Use the tool to convert the dataset
+# 2) Verify the chunk indexing type is correct
+# h5format_convert -d /DSET_EA h5fc_latest_v3.h5
+# h5format_convert -d /GROUP/DSET_NDATA_EA h5fc_latest_v3.h5
+# h5format_convert -d /GROUP/DSET_BT2 h5fc_latest_v3.h5
+# h5format_convert -d /DSET_NDATA_BT2 h5fc_latest_v3.h5
+# h5format_convert -d /DSET_FA h5fc_latest_v3.h5
+# h5format_convert -d /GROUP/DSET_FA h5fc_latest_v3.h5
+# h5format_convert -d /DSET_NONE h5fc_latest_v3.h5
+# h5format_convert -d /GROUP/DSET_NONE h5fc_latest_v3.h5
+TOOLTEST h5fc_latest_v3.h5 -d /DSET_EA
+IDX_CHECK /DSET_EA
+#
+TOOLTEST h5fc_latest_v3.h5 -d /GROUP/DSET_NDATA_EA
+IDX_CHECK /GROUP/DSET_NDATA_EA
+#
+TOOLTEST h5fc_latest_v3.h5 -d /GROUP/DSET_BT2
+IDX_CHECK /GROUP/DSET_BT2
+#
+TOOLTEST h5fc_latest_v3.h5 -d /DSET_NDATA_BT2
+IDX_CHECK /DSET_NDATA_BT2
+#
+TOOLTEST h5fc_latest_v3.h5 -d /DSET_FA
+IDX_CHECK /DSET_FA
+#
+TOOLTEST h5fc_latest_v3.h5 -d /GROUP/DSET_NDATA_FA
+IDX_CHECK /GROUP/DSET_NDATA_FA
+#
+TOOLTEST h5fc_latest_v3.h5 -d /DSET_NONE
+IDX_CHECK /DSET_NONE
+#
+TOOLTEST h5fc_latest_v3.h5 -d /GROUP/DSET_NDATA_NONE
+IDX_CHECK /GROUP/DSET_NDATA_NONE
+#
+#
+#
+# No output from tests: just check exit code
+# h5format_convert -d /DSET_NDATA_BT1 h5fc_v1.h5 (v1-btree dataset)
+# h5format_convert -d /GROUP/DSET_NON_CHUNKED h5fc_non_v3.h5 (non-chunked dataset)
+TOOLTEST h5fc_v1.h5 -d /DSET_NDATA_BT1
+TOOLTEST h5fc_non_v3.h5 -d /GROUP/DSET_NON_CHUNKED
+#
+#
+#
+# No output from tests: just check exit code
+# h5format_convert -d /GROUP/DSET_BT2 -n h5fc_non_v3.h5 (noop, one dataset)
+# h5format_convert -n h5fc_non_v3.h5 (noop, all datasets)
+TOOLTEST h5fc_non_v3.h5 -d /GROUP/DSET_BT2 -n
+TOOLTEST h5fc_non_v3.h5 -n
+#
+#
+#
+# No output from tests: just check exit code
+# h5format_convert h5fc_non_v3.h5
+# 1) convert all datasets
+# 2) verify indexing types
+TOOLTEST h5fc_non_v3.h5
+IDX_CHECK /DSET_NDATA_EA
+IDX_CHECK /DSET_NDATA_BT2
+IDX_CHECK /GROUP/DSET_BT2
+IDX_CHECK /GROUP/DSET_EA
+#
+#
+#
+# No output from test: just check exit code
+# h5format_convert h5fc_edge_v3.h5
+# 1) convert the chunked dataset (filter, no-filter-edge-chunk)
+# 2) verify the indexing type
+TOOLTEST h5fc_edge_v3.h5
+IDX_CHECK /DSET_EDGE
+#
+#
+#
+# Clean up temporary files/directories
+CLEAN_TESTFILES_AND_TESTDIR
+
+if test $nerrors -eq 0 ; then
+ echo "All $TESTNAME tests passed."
+ exit $EXIT_SUCCESS
+else
+ echo "$TESTNAME tests failed with $nerrors errors."
+ exit $EXIT_FAILURE
+fi
+
diff --git a/tools/h5import/testfiles/binfp64.h5 b/tools/h5import/testfiles/binfp64.h5
index 80e3a8a..5426edb 100644
--- a/tools/h5import/testfiles/binfp64.h5
+++ b/tools/h5import/testfiles/binfp64.h5
Binary files differ
diff --git a/tools/h5import/testfiles/binin16.h5 b/tools/h5import/testfiles/binin16.h5
index 0825bbc..6d89c63 100644
--- a/tools/h5import/testfiles/binin16.h5
+++ b/tools/h5import/testfiles/binin16.h5
Binary files differ
diff --git a/tools/h5import/testfiles/binin32.h5 b/tools/h5import/testfiles/binin32.h5
index fd8faa9..61cc507 100644
--- a/tools/h5import/testfiles/binin32.h5
+++ b/tools/h5import/testfiles/binin32.h5
Binary files differ
diff --git a/tools/h5import/testfiles/binin8.h5 b/tools/h5import/testfiles/binin8.h5
index a1d1a37..efd3ae0 100644
--- a/tools/h5import/testfiles/binin8.h5
+++ b/tools/h5import/testfiles/binin8.h5
Binary files differ
diff --git a/tools/h5import/testfiles/binuin16.h5 b/tools/h5import/testfiles/binuin16.h5
index c486c89..1af804c 100644
--- a/tools/h5import/testfiles/binuin16.h5
+++ b/tools/h5import/testfiles/binuin16.h5
Binary files differ
diff --git a/tools/h5import/testfiles/binuin32.h5 b/tools/h5import/testfiles/binuin32.h5
index 41699d7..e7d12d9 100644
--- a/tools/h5import/testfiles/binuin32.h5
+++ b/tools/h5import/testfiles/binuin32.h5
Binary files differ
diff --git a/tools/h5import/testfiles/txtfp32.h5 b/tools/h5import/testfiles/txtfp32.h5
index f74e003..bd41f06 100644
--- a/tools/h5import/testfiles/txtfp32.h5
+++ b/tools/h5import/testfiles/txtfp32.h5
Binary files differ
diff --git a/tools/h5import/testfiles/txtfp64.h5 b/tools/h5import/testfiles/txtfp64.h5
index b6ba4f5..41c4e9e 100644
--- a/tools/h5import/testfiles/txtfp64.h5
+++ b/tools/h5import/testfiles/txtfp64.h5
Binary files differ
diff --git a/tools/h5import/testfiles/txtin16.h5 b/tools/h5import/testfiles/txtin16.h5
index dc6c1ea..5089c97 100644
--- a/tools/h5import/testfiles/txtin16.h5
+++ b/tools/h5import/testfiles/txtin16.h5
Binary files differ
diff --git a/tools/h5import/testfiles/txtin32.h5 b/tools/h5import/testfiles/txtin32.h5
index 350333c..8d547cf 100644
--- a/tools/h5import/testfiles/txtin32.h5
+++ b/tools/h5import/testfiles/txtin32.h5
Binary files differ
diff --git a/tools/h5import/testfiles/txtin8.h5 b/tools/h5import/testfiles/txtin8.h5
index 42e7727..61b7165 100644
--- a/tools/h5import/testfiles/txtin8.h5
+++ b/tools/h5import/testfiles/txtin8.h5
Binary files differ
diff --git a/tools/h5import/testfiles/txtuin16.h5 b/tools/h5import/testfiles/txtuin16.h5
index 9ee166a..c43b875 100644
--- a/tools/h5import/testfiles/txtuin16.h5
+++ b/tools/h5import/testfiles/txtuin16.h5
Binary files differ
diff --git a/tools/h5import/testfiles/txtuin32.h5 b/tools/h5import/testfiles/txtuin32.h5
index 1a4dda5..aec3b0f 100644
--- a/tools/h5import/testfiles/txtuin32.h5
+++ b/tools/h5import/testfiles/txtuin32.h5
Binary files differ
diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c
index cce5f3d..c962e80 100644
--- a/tools/h5ls/h5ls.c
+++ b/tools/h5ls/h5ls.c
@@ -70,6 +70,7 @@ static h5tool_format_t ls_dataformat = {
"{", /*cmpd_pre */
"}", /*cmpd_suf */
"", /*cmpd_end */
+ NULL, /* cmpd_listv */
",", /*vlen_sep */
"(", /*vlen_pre */
diff --git a/tools/h5ls/testh5ls.sh.in b/tools/h5ls/testh5ls.sh.in
index bf40bfa..68b317c 100644
--- a/tools/h5ls/testh5ls.sh.in
+++ b/tools/h5ls/testh5ls.sh.in
@@ -88,6 +88,7 @@ $SRC_H5LS_TESTFILES/tsoftlinks.h5
$SRC_H5LS_TESTFILES/tstr.h5
$SRC_H5LS_TESTFILES/tudlink.h5
$SRC_H5LS_TESTFILES/tvldtypes1.h5
+$SRC_H5LS_TESTFILES/tdset_idx.h5
"
LIST_OTHER_TEST_FILES="
@@ -147,6 +148,7 @@ $SRC_H5LS_TESTFILES/tudlink-1.ls
$SRC_H5LS_TESTFILES/tvldtypes1.ls
$SRC_H5LS_TESTFILES/tvldtypes2le.ls
$SRC_H5LS_TESTFILES/tvldtypes2be.ls
+$SRC_H5LS_TESTFILES/tdset_idx.ls
"
@@ -418,6 +420,9 @@ else
TOOLTEST tdataregbe.ls 0 -v tdatareg.h5
fi
+# test for file with datasets that use Fixed Array chunk indices
+echo "***skip testing tdset_idx.h5"
+#TOOLTEST tdset_idx.ls 0 -w80 -d tdset_idx.h5
# Clean up temporary files/directories
CLEAN_TESTFILES_AND_TESTDIR
diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c
index c1e63f1..286d7f0 100644
--- a/tools/h5repack/h5repack.c
+++ b/tools/h5repack/h5repack.c
@@ -77,14 +77,14 @@ int h5repack(const char* infile, const char* outfile, pack_opt_t *options) {
*
*-------------------------------------------------------------------------
*/
-
-int h5repack_init(pack_opt_t *options, int verbose,
+int h5repack_init(pack_opt_t *options, int verbose, hbool_t latest,
H5F_file_space_type_t strategy, hsize_t threshold) {
int k, n;
HDmemset(options, 0, sizeof(pack_opt_t));
options->min_comp = 0;
options->verbose = verbose;
+ options->latest = latest;
options->layout_g = H5D_LAYOUT_ERROR;
for (n = 0; n < H5_REPACK_MAX_NFILTERS; n++) {
diff --git a/tools/h5repack/h5repack.h b/tools/h5repack/h5repack.h
index 69e36fc..329be1f 100644
--- a/tools/h5repack/h5repack.h
+++ b/tools/h5repack/h5repack.h
@@ -105,7 +105,7 @@ typedef struct {
int verbose; /*verbose mode */
hsize_t min_comp; /*minimum size to compress, in bytes */
int use_native; /*use a native type in write */
- int latest; /*pack file with the latest file format */
+ hbool_t latest; /*pack file with the latest file format */
int grp_compact; /* Set the maximum number of links to store as header messages in the group */
int grp_indexed; /* Set the minimum number of links to store in the indexed format */
int msg_size[8]; /* Minimum size of shared messages: dataspace,
@@ -138,7 +138,8 @@ extern "C" {
int h5repack(const char* infile, const char* outfile, pack_opt_t *options);
int h5repack_addfilter(const char* str, pack_opt_t *options);
int h5repack_addlayout(const char* str, pack_opt_t *options);
-int h5repack_init(pack_opt_t *options, int verbose, H5F_file_space_type_t strategy, hsize_t threshold);
+int h5repack_init(pack_opt_t *options, int verbose, hbool_t latest,
+ H5F_file_space_type_t strategy, hsize_t threshold);
int h5repack_end(pack_opt_t *options);
int h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options);
int h5repack_cmp_pl(const char *fname1, const char *fname2);
diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c
index c56e3ce..708c173 100644
--- a/tools/h5repack/h5repack_main.c
+++ b/tools/h5repack/h5repack_main.c
@@ -193,6 +193,7 @@ static void usage(const char *prog) {
printf("\n");
}
+
/*-------------------------------------------------------------------------
* Function: leave
*
@@ -360,7 +361,7 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options) {
has_i_o = 1;
break;
- /* -o for backward compability */
+ /* -o for backward compability */
case 'o':
outfile = opt_arg;
has_i_o = 1;
@@ -423,19 +424,19 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options) {
break;
case 'L':
- options->latest = 1;
+ options->latest = TRUE;
break;
case 'c':
options->grp_compact = HDatoi( opt_arg );
if (options->grp_compact > 0)
- options->latest = 1; /* must use latest format */
+ options->latest = TRUE; /* must use latest format */
break;
case 'd':
options->grp_indexed = HDatoi( opt_arg );
if (options->grp_indexed > 0)
- options->latest = 1; /* must use latest format */
+ options->latest = TRUE; /* must use latest format */
break;
case 's':
@@ -443,7 +444,7 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options) {
int idx = 0;
int ssize = 0;
char *msgPtr = HDstrchr( opt_arg, ':');
- options->latest = 1; /* must use latest format */
+ options->latest = TRUE; /* must use latest format */
if (msgPtr == NULL) {
ssize = HDatoi( opt_arg );
for (idx = 0; idx < 5; idx++)
@@ -579,7 +580,7 @@ int main(int argc, const char **argv) {
}
/* initialize options */
- h5repack_init(&options, 0, H5F_FILE_SPACE_DEFAULT, (hsize_t) 0);
+ h5repack_init(&options, 0, FALSE, H5F_FILE_SPACE_DEFAULT, (hsize_t) 0);
if (parse_command_line(argc, argv, &options) < 0)
goto done;
diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c
index 3959300..030b052 100644
--- a/tools/h5repack/h5repacktst.c
+++ b/tools/h5repack/h5repacktst.c
@@ -214,7 +214,7 @@ int main (void)
TESTING(" copy of datasets (fill values)");
/* fs_type = 0; fs_size = 0 */
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack(FNAME0,FNAME0OUT,&pack_options) < 0)
GOERROR;
@@ -234,7 +234,7 @@ int main (void)
*-------------------------------------------------------------------------
*/
TESTING(" copy of datasets (all datatypes)");
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack(FNAME1,FNAME1OUT,&pack_options) < 0)
GOERROR;
@@ -254,7 +254,7 @@ int main (void)
*-------------------------------------------------------------------------
*/
TESTING(" copy of datasets (attributes)");
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack(FNAME2,FNAME2OUT,&pack_options) < 0)
GOERROR;
@@ -273,7 +273,7 @@ int main (void)
*-------------------------------------------------------------------------
*/
TESTING(" copy of datasets (hardlinks)");
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack(FNAME3,FNAME3OUT,&pack_options) < 0)
GOERROR;
@@ -293,7 +293,7 @@ int main (void)
*-------------------------------------------------------------------------
*/
TESTING(" copy of allocation early file");
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack(FNAME5,FNAME5OUT,&pack_options) < 0)
GOERROR;
@@ -314,7 +314,7 @@ int main (void)
* deflate
*-------------------------------------------------------------------------
*/
- TESTING(" adding deflate filter");
+ TESTING(" adding deflate filter (old_format)");
#ifdef H5_HAVE_FILTER_DEFLATE
@@ -323,7 +323,34 @@ int main (void)
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack_addfilter("dset1:GZIP=9",&pack_options) < 0)
+ GOERROR;
+ if (h5repack_addlayout("dset1:CHUNK=20x10",&pack_options) < 0)
+ GOERROR;
+ if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0)
+ GOERROR;
+ if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
+ GOERROR;
+ if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0)
+ GOERROR;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+ PASSED();
+#else
+ SKIPPED();
+#endif
+
+ TESTING(" adding deflate filter (new format)");
+#ifdef H5_HAVE_FILTER_DEFLATE
+ /*-------------------------------------------------------------------------
+ * test an individual object option
+ * For new format, "dset1" should be using Fixed Array indexing
+ *-------------------------------------------------------------------------
+ */
+
+ if (h5repack_init (&pack_options, 0, TRUE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset1:GZIP=9",&pack_options) < 0)
GOERROR;
@@ -351,7 +378,7 @@ int main (void)
#ifdef H5_HAVE_FILTER_DEFLATE
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("GZIP=1",&pack_options) < 0)
GOERROR;
@@ -389,7 +416,7 @@ int main (void)
*/
if (szip_can_encode) {
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset2:SZIP=8,EC",&pack_options) < 0)
GOERROR;
@@ -421,7 +448,7 @@ int main (void)
#if defined (H5_HAVE_FILTER_SZIP)
if (szip_can_encode) {
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("SZIP=8,NN",&pack_options) < 0)
GOERROR;
@@ -450,7 +477,7 @@ int main (void)
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset1:SHUF",&pack_options) < 0)
GOERROR;
@@ -475,7 +502,7 @@ int main (void)
TESTING(" addding shuffle filter to all");
/* fs_type = H5F_FILE_SPACE_ALL_PERSIST; fs_size = 1 */
- if (h5repack_init (&pack_options, 0, H5_INC_ENUM(H5F_file_space_type_t, fs_type), ++fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, H5_INC_ENUM(H5F_file_space_type_t, fs_type), ++fs_size) < 0)
GOERROR;
if (h5repack_addfilter("SHUF",&pack_options) < 0)
GOERROR;
@@ -500,7 +527,7 @@ int main (void)
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset1:FLET",&pack_options) < 0)
GOERROR;
@@ -525,7 +552,7 @@ int main (void)
TESTING(" adding checksum filter to all");
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("FLET",&pack_options) < 0)
GOERROR;
@@ -550,7 +577,7 @@ int main (void)
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("dset1:CHUNK 20x10",&pack_options) < 0)
GOERROR;
@@ -583,14 +610,36 @@ int main (void)
PASSED();
- TESTING(" adding layout chunked");
+ TESTING(" adding layout chunked (old format)");
+
+ /*-------------------------------------------------------------------------
+ * test an individual object option
+ *-------------------------------------------------------------------------
+ */
+
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack_addlayout("dset1:CHUNK=20x10",&pack_options) < 0)
+ GOERROR;
+ if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0)
+ GOERROR;
+ if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
+ GOERROR;
+ if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options )<= 0)
+ GOERROR;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+ PASSED();
+
+ TESTING(" adding layout chunked (new format)");
/*-------------------------------------------------------------------------
* test an individual object option
+ * For new format, "dset1" should be using Fixed Array indexing
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, TRUE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("dset1:CHUNK=20x10",&pack_options) < 0)
GOERROR;
@@ -610,7 +659,7 @@ int main (void)
*/
TESTING(" adding layout chunked to all");
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("CHUNK=20x10",&pack_options) < 0)
GOERROR;
@@ -631,7 +680,7 @@ int main (void)
* test an individual object option
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("dset1:CONTI",&pack_options) < 0)
GOERROR;
@@ -652,7 +701,7 @@ int main (void)
* test all objects option
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("CONTI",&pack_options) < 0)
GOERROR;
@@ -669,7 +718,7 @@ int main (void)
* do the same test for a file with filters (chunked)
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("CONTI",&pack_options) < 0)
GOERROR;
@@ -691,7 +740,7 @@ int main (void)
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("dset1:COMPA",&pack_options) < 0)
GOERROR;
@@ -713,7 +762,7 @@ int main (void)
*/
/* fs_type = H5F_FILE_SPACE_ALL; fs_size = 2 */
- if (h5repack_init (&pack_options, 0, H5_INC_ENUM(H5F_file_space_type_t, fs_type), ++fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, H5_INC_ENUM(H5F_file_space_type_t, fs_type), ++fs_size) < 0)
GOERROR;
if (h5repack_addlayout("COMPA",&pack_options) < 0)
GOERROR;
@@ -735,7 +784,7 @@ int main (void)
* layout compact to contiguous conversion
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("dset_compact:CONTI",&pack_options) < 0)
GOERROR;
@@ -755,7 +804,7 @@ int main (void)
* layout compact to chunk conversion
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("dset_compact:CHUNK=2x5",&pack_options) < 0)
GOERROR;
@@ -775,7 +824,7 @@ int main (void)
* layout compact to compact conversion
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("dset_compact:COMPA",&pack_options) < 0)
GOERROR;
@@ -794,7 +843,7 @@ int main (void)
* layout contiguous to compact conversion
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("dset_contiguous:COMPA",&pack_options) < 0)
GOERROR;
@@ -813,7 +862,7 @@ int main (void)
* layout contiguous to chunk conversion
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("dset_contiguous:CHUNK=3x6",&pack_options) < 0)
GOERROR;
@@ -833,7 +882,7 @@ int main (void)
* layout contiguous to contiguous conversion
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("dset_contiguous:CONTI",&pack_options) < 0)
GOERROR;
@@ -852,7 +901,7 @@ int main (void)
* layout chunked to compact conversion
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("dset_chunk:COMPA",&pack_options) < 0)
GOERROR;
@@ -872,7 +921,7 @@ int main (void)
* layout chunked to contiguous conversion
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("dset_chunk:CONTI",&pack_options) < 0)
GOERROR;
@@ -891,7 +940,7 @@ int main (void)
* layout chunked to chunked conversion
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("dset_chunk:CHUNK=18x13",&pack_options) < 0)
GOERROR;
@@ -922,7 +971,7 @@ int main (void)
#if defined (H5_HAVE_FILTER_SZIP)
if (szip_can_encode) {
/* fs_type = H5F_FILE_SPACE_AGGR_VFD; fs_size = 3 */
- if (h5repack_init (&pack_options, 0, H5_INC_ENUM(H5F_file_space_type_t, fs_type), ++fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, H5_INC_ENUM(H5F_file_space_type_t, fs_type), ++fs_size) < 0)
GOERROR;
if (h5repack(FNAME7,FNAME7OUT,&pack_options) < 0)
GOERROR;
@@ -947,7 +996,7 @@ int main (void)
#if defined (H5_HAVE_FILTER_SZIP)
if (szip_can_encode) {
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset_szip:NONE",&pack_options) < 0)
GOERROR;
@@ -972,7 +1021,7 @@ int main (void)
TESTING(" copy of deflate filter");
#ifdef H5_HAVE_FILTER_DEFLATE
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack(FNAME8,FNAME8OUT,&pack_options) < 0)
GOERROR;
@@ -992,7 +1041,7 @@ int main (void)
TESTING(" removing deflate filter");
#ifdef H5_HAVE_FILTER_DEFLATE
- if (h5repack_init (&pack_options, 0, fs_type, ++fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, ++fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset_deflate:NONE",&pack_options) < 0)
GOERROR;
@@ -1014,7 +1063,7 @@ int main (void)
TESTING(" copy of shuffle filter");
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack(FNAME9,FNAME9OUT,&pack_options) < 0)
GOERROR;
@@ -1030,7 +1079,7 @@ int main (void)
TESTING(" removing shuffle filter");
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset_shuffle:NONE",&pack_options) < 0)
GOERROR;
@@ -1048,7 +1097,7 @@ int main (void)
TESTING(" copy of fletcher filter");
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack(FNAME10,FNAME10OUT,&pack_options) < 0)
GOERROR;
@@ -1064,7 +1113,7 @@ int main (void)
TESTING(" removing fletcher filter");
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset_fletcher32:NONE",&pack_options) < 0)
GOERROR;
@@ -1082,7 +1131,7 @@ int main (void)
TESTING(" copy of nbit filter");
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack(FNAME12,FNAME12OUT,&pack_options) < 0)
GOERROR;
@@ -1098,7 +1147,7 @@ int main (void)
TESTING(" removing nbit filter");
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset_nbit:NONE",&pack_options) < 0)
GOERROR;
@@ -1116,7 +1165,7 @@ int main (void)
TESTING(" adding nbit filter");
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset_int31:NBIT",&pack_options) < 0)
GOERROR;
@@ -1134,7 +1183,7 @@ int main (void)
TESTING(" copy of scaleoffset filter");
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack(FNAME13,FNAME13OUT,&pack_options) < 0)
GOERROR;
@@ -1150,7 +1199,7 @@ int main (void)
TESTING(" removing scaleoffset filter");
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset_scaleoffset:NONE",&pack_options) < 0)
GOERROR;
@@ -1168,7 +1217,7 @@ int main (void)
TESTING(" adding scaleoffset filter");
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset_none:SOFF=31,IN",&pack_options) < 0)
GOERROR;
@@ -1201,7 +1250,7 @@ int main (void)
if (szip_can_encode) {
/* fs_type = H5F_FILE_SPACE_VFD; fs_size = 4 */
- if (h5repack_init (&pack_options, 0, H5_INC_ENUM(H5F_file_space_type_t, fs_type), ++fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, H5_INC_ENUM(H5F_file_space_type_t, fs_type), ++fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset_deflate:SZIP=8,NN",&pack_options) < 0)
GOERROR;
@@ -1227,7 +1276,7 @@ int main (void)
#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_HAVE_FILTER_DEFLATE)
if (szip_can_encode) {
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset_szip:GZIP=1",&pack_options) < 0)
GOERROR;
@@ -1258,7 +1307,7 @@ int main (void)
#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_HAVE_FILTER_DEFLATE)
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("NONE",&pack_options) < 0)
GOERROR;
@@ -1282,7 +1331,7 @@ int main (void)
*/
TESTING(" big file");
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack(FNAME14,FNAME14OUT,&pack_options) < 0)
GOERROR;
@@ -1299,7 +1348,7 @@ int main (void)
*-------------------------------------------------------------------------
*/
TESTING(" external datasets");
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack(FNAME15,FNAME15OUT,&pack_options) < 0)
GOERROR;
@@ -1316,7 +1365,7 @@ int main (void)
*-------------------------------------------------------------------------
*/
TESTING(" file with userblock");
- if(h5repack_init(&pack_options, 0, fs_type, fs_size) < 0)
+ if(h5repack_init(&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if(h5repack(FNAME16, FNAME16OUT, &pack_options) < 0)
GOERROR;
@@ -1335,7 +1384,7 @@ int main (void)
*-------------------------------------------------------------------------
*/
TESTING(" latest file format options");
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
pack_options.latest=1;
pack_options.grp_compact=10;
@@ -1365,7 +1414,7 @@ int main (void)
#if defined (H5_HAVE_FILTER_DEFLATE)
- if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("GZIP=1",&pack_options) < 0)
GOERROR;
@@ -1394,7 +1443,7 @@ int main (void)
#ifdef H5_HAVE_FILTER_DEFLATE
- if(h5repack_init(&pack_options, 0, fs_type, fs_size) < 0)
+ if(h5repack_init(&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
/* add the options for a user block size and user block filename */
@@ -1427,7 +1476,7 @@ int main (void)
#ifdef H5_HAVE_FILTER_DEFLATE
- if(h5repack_init(&pack_options, 0, fs_type, fs_size) < 0)
+ if(h5repack_init(&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
/* add the options for aligment */
@@ -1481,7 +1530,7 @@ int main (void)
*/
TESTING(" file with committed datatypes");
- if(h5repack_init(&pack_options, 0, fs_type, fs_size) < 0)
+ if(h5repack_init(&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if(h5repack(FNAME17, FNAME17OUT, &pack_options) < 0)
@@ -1508,7 +1557,7 @@ int main (void)
/* First run without metadata option. No need to verify the correctness */
/* since this has been verified by earlier tests. Just record the file */
/* size of the output file. */
- if(h5repack_init(&pack_options, 0, H5F_FILE_SPACE_DEFAULT, (hsize_t)0) < 0)
+ if(h5repack_init(&pack_options, 0, FALSE, H5F_FILE_SPACE_DEFAULT, (hsize_t)0) < 0)
GOERROR;
if(h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
GOERROR;
@@ -1519,7 +1568,7 @@ int main (void)
GOERROR;
/* run it again with metadata option */
- if(h5repack_init(&pack_options, 0, H5F_FILE_SPACE_DEFAULT, (hsize_t)0) < 0)
+ if(h5repack_init(&pack_options, 0, FALSE, H5F_FILE_SPACE_DEFAULT, (hsize_t)0) < 0)
GOERROR;
pack_options.meta_block_size = 8192;
if(h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
diff --git a/tools/h5repack/testfiles/h5repack_attr.h5 b/tools/h5repack/testfiles/h5repack_attr.h5
index fe066db..3bc4906 100644
--- a/tools/h5repack/testfiles/h5repack_attr.h5
+++ b/tools/h5repack/testfiles/h5repack_attr.h5
Binary files differ
diff --git a/tools/h5repack/testfiles/h5repack_deflate.h5 b/tools/h5repack/testfiles/h5repack_deflate.h5
index 3a4b86d..86d66c0 100644
--- a/tools/h5repack/testfiles/h5repack_deflate.h5
+++ b/tools/h5repack/testfiles/h5repack_deflate.h5
Binary files differ
diff --git a/tools/h5repack/testfiles/h5repack_early.h5 b/tools/h5repack/testfiles/h5repack_early.h5
index 9b92890..0394bef 100644
--- a/tools/h5repack/testfiles/h5repack_early.h5
+++ b/tools/h5repack/testfiles/h5repack_early.h5
Binary files differ
diff --git a/tools/h5repack/testfiles/h5repack_fill.h5 b/tools/h5repack/testfiles/h5repack_fill.h5
index 21516cb..81c32d5 100644
--- a/tools/h5repack/testfiles/h5repack_fill.h5
+++ b/tools/h5repack/testfiles/h5repack_fill.h5
Binary files differ
diff --git a/tools/h5repack/testfiles/h5repack_filters.h5 b/tools/h5repack/testfiles/h5repack_filters.h5
index 042b8db..0600adb 100644
--- a/tools/h5repack/testfiles/h5repack_filters.h5
+++ b/tools/h5repack/testfiles/h5repack_filters.h5
Binary files differ
diff --git a/tools/h5repack/testfiles/h5repack_fletcher.h5 b/tools/h5repack/testfiles/h5repack_fletcher.h5
index 2f137b0..e4e2c05 100644
--- a/tools/h5repack/testfiles/h5repack_fletcher.h5
+++ b/tools/h5repack/testfiles/h5repack_fletcher.h5
Binary files differ
diff --git a/tools/h5repack/testfiles/h5repack_hlink.h5 b/tools/h5repack/testfiles/h5repack_hlink.h5
index 3d22728..b00f9a2 100644
--- a/tools/h5repack/testfiles/h5repack_hlink.h5
+++ b/tools/h5repack/testfiles/h5repack_hlink.h5
Binary files differ
diff --git a/tools/h5repack/testfiles/h5repack_layouto.h5 b/tools/h5repack/testfiles/h5repack_layouto.h5
index a038e68..3322020 100644
--- a/tools/h5repack/testfiles/h5repack_layouto.h5
+++ b/tools/h5repack/testfiles/h5repack_layouto.h5
Binary files differ
diff --git a/tools/h5repack/testfiles/h5repack_nbit.h5 b/tools/h5repack/testfiles/h5repack_nbit.h5
index 3ada112..c678f1c 100644
--- a/tools/h5repack/testfiles/h5repack_nbit.h5
+++ b/tools/h5repack/testfiles/h5repack_nbit.h5
Binary files differ
diff --git a/tools/h5repack/testfiles/h5repack_shuffle.h5 b/tools/h5repack/testfiles/h5repack_shuffle.h5
index d13cca7..6520193 100644
--- a/tools/h5repack/testfiles/h5repack_shuffle.h5
+++ b/tools/h5repack/testfiles/h5repack_shuffle.h5
Binary files differ
diff --git a/tools/h5repack/testfiles/h5repack_soffset.h5 b/tools/h5repack/testfiles/h5repack_soffset.h5
index 89ee99a..a9457d3 100644
--- a/tools/h5repack/testfiles/h5repack_soffset.h5
+++ b/tools/h5repack/testfiles/h5repack_soffset.h5
Binary files differ
diff --git a/tools/h5repack/testfiles/h5repack_szip.h5 b/tools/h5repack/testfiles/h5repack_szip.h5
index b16d169..5eab9f8 100644
--- a/tools/h5repack/testfiles/h5repack_szip.h5
+++ b/tools/h5repack/testfiles/h5repack_szip.h5
Binary files differ
diff --git a/tools/h5stat/h5stat_gentest.c b/tools/h5stat/h5stat_gentest.c
index 100f5b2..02bd136 100644
--- a/tools/h5stat/h5stat_gentest.c
+++ b/tools/h5stat/h5stat_gentest.c
@@ -32,6 +32,11 @@
#define NUM_GRPS 35000
#define NUM_ATTRS 100
+/* Declarations for gen_idx_file() */
+#define IDX_FILE "h5stat_idx.h5"
+#define DSET "dset"
+#define DSET_FILTER "dset_filter"
+
/* For gen_threshold_file() */
#define THRESHOLD_FILE "h5stat_threshold.h5"
#define THRES_ATTR_NAME "attr"
@@ -43,7 +48,6 @@
/*
* Generate HDF5 file with latest format with
* NUM_GRPS groups and NUM_ATTRS attributes for the dataset
- *
*/
static void
gen_newgrat_file(const char *fname)
@@ -111,27 +115,33 @@ gen_newgrat_file(const char *fname)
} /* end for */
/* Close dataset, dataspace, datatype, file */
- if(H5Dclose(did) < 0)
+ if(H5Pclose(fapl) < 0)
goto error;
- if(H5Sclose(sid) < 0)
+ if(H5Pclose(fcpl) < 0)
+ goto error;
+ if(H5Dclose(did) < 0)
goto error;
if(H5Tclose(tid) < 0)
goto error;
+ if(H5Sclose(sid) < 0)
+ goto error;
if(H5Fclose(fid) < 0)
goto error;
error:
H5E_BEGIN_TRY {
+ H5Pclose(fapl);
+ H5Pclose(fcpl);
H5Aclose(attr_id);
- H5Dclose(did);
H5Tclose(tid);
H5Sclose(sid);
H5Gclose(gid);
+ H5Dclose(did);
H5Fclose(fid);
} H5E_END_TRY;
-
} /* gen_newgrat_file() */
+
/*
* Generate an HDF5 file with groups, datasets, attributes for testing the options:
* -l N (--links=N): Set the threshold for # of links when printing information for small groups.
@@ -331,11 +341,110 @@ error:
} /* gen_threshold_file() */
+/*
+ * Function: gen_idx_file
+ *
+ * Purpose: Create a file with datasets that use Fixed Array indexing:
+ * one dataset: fixed dimension, chunked layout, w/o filters
+ * one dataset: fixed dimension, chunked layout, w/ filters
+ *
+ */
+static void
+gen_idx_file(const char *fname)
+{
+ hid_t fapl = -1; /* file access property id */
+ hid_t fid = -1; /* file id */
+ hid_t sid = -1; /* space id */
+ hid_t dcpl = -1; /* dataset creation property id */
+ hid_t did = -1, did2 = -1; /* dataset id */
+ hsize_t dims[1] = {10}; /* dataset dimension */
+ hsize_t c_dims[1] = {2}; /* chunk dimension */
+ int i; /* local index variable */
+ int buf[10]; /* data buffer */
+
+ /* Get a copy of the file access property */
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ goto error;
+
+ /* Set the "use the latest format" bounds for creating objects in the file */
+ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ goto error;
+
+ /* Create file */
+ if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ goto error;
+
+ /* Create data */
+ for(i = 0; i < 10; i++)
+ buf[i] = i;
+
+ /* Set chunk */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+
+ if(H5Pset_chunk(dcpl, 1, c_dims) < 0)
+ goto error;
+
+ /* Create a 1D dataset */
+ if((sid = H5Screate_simple(1, dims, NULL)) < 0)
+ goto error;
+ if((did = H5Dcreate2(fid, DSET, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Write to the dataset */
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto error;
+
+#if defined (H5_HAVE_FILTER_DEFLATE)
+ /* set deflate data */
+ if(H5Pset_deflate(dcpl, 9) < 0)
+ goto error;
+
+ /* Create and write the dataset */
+ if((did2 = H5Dcreate2(fid, DSET_FILTER, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+ if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto error;
+
+ /* Close the dataset */
+ if(H5Dclose(did2) < 0)
+ goto error;
+#endif
+
+ /* closing: dataspace, dataset, file */
+ if(H5Pclose(fapl) < 0)
+ goto error;
+ if(H5Pclose(dcpl) < 0)
+ goto error;
+ if(H5Sclose(sid) < 0)
+ goto error;
+ if(H5Dclose(did) < 0)
+ goto error;
+ if(H5Fclose(fid) < 0)
+ goto error;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Pclose(fapl);
+ H5Pclose(dcpl);
+ H5Sclose(sid);
+ H5Dclose(did);
+ H5Fclose(fid);
+#if defined (H5_HAVE_FILTER_DEFLATE)
+ H5Dclose(did2);
+#endif
+ } H5E_END_TRY;
+
+} /* gen_idx_file() */
+
int main(void)
{
gen_newgrat_file(NEWGRAT_FILE);
gen_threshold_file(THRESHOLD_FILE);
+ /* Generate an HDF file to test for datasets with Fixed Array indexing */
+ gen_idx_file(IDX_FILE);
+
return 0;
}
diff --git a/tools/h5stat/testfiles/h5stat_filters.h5 b/tools/h5stat/testfiles/h5stat_filters.h5
index 5b5f4bb..cbd4467 100644
--- a/tools/h5stat/testfiles/h5stat_filters.h5
+++ b/tools/h5stat/testfiles/h5stat_filters.h5
Binary files differ
diff --git a/tools/h5stat/testfiles/h5stat_idx.ddl b/tools/h5stat/testfiles/h5stat_idx.ddl
new file mode 100644
index 0000000..b26f1a4
--- /dev/null
+++ b/tools/h5stat/testfiles/h5stat_idx.ddl
@@ -0,0 +1,93 @@
+Filename: h5stat_idx.h5
+File information
+ # of unique groups: 1
+ # of unique datasets: 2
+ # of unique named datatypes: 0
+ # of unique links: 0
+ # of unique other: 0
+ Max. # of links to object: 1
+ Max. # of objects in group: 2
+File space information for file metadata (in bytes):
+ Superblock: 48
+ Superblock extension: 0
+ User block: 0
+ Object headers: (total/unused)
+ Groups: 147/47
+ Datasets(exclude compact data): 568/362
+ Datatypes: 0/0
+ Groups:
+ B-tree/List: 0
+ Heap: 0
+ Attributes:
+ B-tree/List: 0
+ Heap: 0
+ Chunked datasets:
+ Index: 202
+ Datasets:
+ Heap: 0
+ Shared Messages:
+ Header: 0
+ B-tree/List: 0
+ Heap: 0
+ Free-space managers:
+ Header: 0
+ Amount of free space: 0
+Small groups (with 0 to 9 links):
+ # of groups with 2 link(s): 1
+ Total # of small groups: 1
+Group bins:
+ # of groups with 1 - 9 links: 1
+ Total # of groups: 1
+Dataset dimension information:
+ Max. rank of datasets: 1
+ Dataset ranks:
+ # of dataset with rank 1: 2
+1-D Dataset information:
+ Max. dimension size of 1-D datasets: 10
+ Small 1-D datasets (with dimension sizes 0 to 9):
+ Total # of small datasets: 0
+ 1-D Dataset dimension bins:
+ # of datasets with dimension size 10 - 99: 2
+ Total # of datasets: 2
+Dataset storage information:
+ Total raw data size: 110
+ Total external raw data size: 0
+Dataset layout information:
+ Dataset layout counts[COMPACT]: 0
+ Dataset layout counts[CONTIG]: 0
+ Dataset layout counts[CHUNKED]: 2
+ Dataset layout counts[VIRTUAL]: 0
+ Number of external files : 0
+Dataset filters information:
+ Number of datasets with:
+ NO filter: 1
+ GZIP filter: 1
+ SHUFFLE filter: 0
+ FLETCHER32 filter: 0
+ SZIP filter: 0
+ NBIT filter: 0
+ SCALEOFFSET filter: 0
+ USER-DEFINED filter: 0
+Dataset datatype information:
+ # of unique datatypes used by datasets: 1
+ Dataset datatype #0:
+ Count (total/named) = (2/0)
+ Size (desc./elmt) = (14/4)
+ Total dataset datatype count: 2
+Small # of attributes (objects with 1 to 10 attributes):
+ Total # of objects with small # of attributes: 0
+Attribute bins:
+ Total # of objects with attributes: 0
+ Max. # of attributes to objects: 0
+Free-space section threshold: 1 bytes
+Small size free-space sections (< 10 bytes):
+ Total # of small size sections: 0
+Free-space section bins:
+ Total # of sections: 0
+File space management strategy: H5F_FILE_SPACE_ALL
+Summary of file space information:
+ File metadata: 965 bytes
+ Raw data: 110 bytes
+ Amount/Percent of tracked free space: 0 bytes/0.0%
+ Unaccounted space: 1131 bytes
+Total space: 2206 bytes
diff --git a/tools/h5stat/testfiles/h5stat_idx.h5 b/tools/h5stat/testfiles/h5stat_idx.h5
new file mode 100644
index 0000000..303d1f8
--- /dev/null
+++ b/tools/h5stat/testfiles/h5stat_idx.h5
Binary files differ
diff --git a/tools/h5stat/testh5stat.sh.in b/tools/h5stat/testh5stat.sh.in
index 4d698da..b48f327 100644
--- a/tools/h5stat/testh5stat.sh.in
+++ b/tools/h5stat/testh5stat.sh.in
@@ -74,6 +74,7 @@ LIST_HDF5_TEST_FILES="
$SRC_H5STAT_TESTFILES/h5stat_filters.h5
$SRC_H5STAT_TESTFILES/h5stat_tsohm.h5
$SRC_H5STAT_TESTFILES/h5stat_newgrat.h5
+$SRC_H5STAT_TESTFILES/h5stat_idx.h5
$SRC_H5STAT_TESTFILES/h5stat_threshold.h5
"
@@ -94,6 +95,7 @@ $SRC_H5STAT_TESTFILES/h5stat_tsohm.ddl
$SRC_H5STAT_TESTFILES/h5stat_newgrat.ddl
$SRC_H5STAT_TESTFILES/h5stat_newgrat-UG.ddl
$SRC_H5STAT_TESTFILES/h5stat_newgrat-UA.ddl
+$SRC_H5STAT_TESTFILES/h5stat_idx.ddl
$SRC_H5STAT_TESTFILES/h5stat_err1_links.ddl
$SRC_H5STAT_TESTFILES/h5stat_links1.ddl
$SRC_H5STAT_TESTFILES/h5stat_links2.ddl
@@ -259,6 +261,8 @@ TOOLTEST h5stat_tsohm.ddl h5stat_tsohm.h5
TOOLTEST h5stat_newgrat.ddl h5stat_newgrat.h5
TOOLTEST h5stat_newgrat-UG.ddl -G h5stat_newgrat.h5
TOOLTEST h5stat_newgrat-UA.ddl -A h5stat_newgrat.h5
+# h5stat_idx.h5 is generated by h5stat_gentest.c
+TOOLTEST h5stat_idx.ddl h5stat_idx.h5
#
# Tests for -l (--links) option on h5stat_threshold.h5:
# -l 0 (incorrect threshold value)
diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h
index d2e3ea6..a7f28e5 100644
--- a/tools/lib/h5tools.h
+++ b/tools/lib/h5tools.h
@@ -203,6 +203,10 @@ typedef struct h5tools_dump_header_t {
} h5tools_dump_header_t;
+/* Forward declaration (see declaration in h5tools_str.c) */
+struct H5LD_memb_t;
+
+
/*
* Information about how to format output.
*/
@@ -338,12 +342,16 @@ typedef struct h5tool_format_t {
*
* end: a string to print after we reach the last element of
* each compound type. prints out before the suf.
+ *
+ * listv: h5watch: vector containing info about the list of compound fields to be printed.
*/
const char *cmpd_name;
const char *cmpd_sep;
const char *cmpd_pre;
const char *cmpd_suf;
const char *cmpd_end;
+ const struct H5LD_memb_t **cmpd_listv;
+
/*
* Fields associated with vlen data types.
@@ -510,12 +518,13 @@ typedef struct h5tools_context_t {
hsize_t size_last_dim; /*the size of the last dimension,
*needed so we can break after each
*row */
- int indent_level; /*the number of times we need some
+ int indent_level; /*the number of times we need some
*extra indentation */
int default_indent_level; /*this is used when the indent level gets changed */
hsize_t acc[H5S_MAX_RANK]; /* accumulator position */
hsize_t pos[H5S_MAX_RANK]; /* matrix position */
hsize_t sm_pos; /* current stripmine element position */
+ struct H5LD_memb_t **cmpd_listv; /* h5watch: vector containing info about the list of compound fields to be printed */
} h5tools_context_t;
typedef struct subset_d {
diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c
index 0d39981..c6e96e4 100644
--- a/tools/lib/h5tools_dump.c
+++ b/tools/lib/h5tools_dump.c
@@ -61,6 +61,7 @@ NULL, /*fmt_ullong */
"{", /*cmpd_pre */
"}", /*cmpd_suf */
"\n", /*cmpd_end */
+NULL, /* cmpd_listv */
", ", /*vlen_sep */
"(", /*vlen_pre */
@@ -1488,6 +1489,9 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_co
H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed");
ctx->size_last_dim = total_size[ctx->ndims - 1];
+ /* Set the compound datatype field list for display */
+ ctx->cmpd_listv = info->cmpd_listv;
+
h5tools_display_simple_subset(stream, info, ctx, dset, p_type, sset, f_space, total_size);
CATCH
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index bdb82a4..5477f91 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -29,6 +29,15 @@
#include "h5tools_ref.h"
#include "h5tools_str.h" /*function prototypes */
+/* Copied from hl/src/H5LDprivate.h */
+/* Info about the list of comma-separated compound fields */
+typedef struct H5LD_memb_t {
+ size_t tot_offset;
+ size_t last_tsize;
+ hid_t last_tid;
+ char **names;
+} H5LD_memb_t;
+
/*
* If REPEAT_VERBOSE is defined then character strings will be printed so
* that repeated character sequences like "AAAAAAAAAA" are displayed as
@@ -267,6 +276,9 @@ h5tools_str_fmt(h5tools_str_t *str/*in,out*/, size_t start, const char *fmt)
{
char _temp[1024], *temp = _temp;
+ HDassert(str);
+ HDassert(fmt);
+
/* If the format string is simply "%s" then don't bother doing anything */
if (!HDstrcmp(fmt, "%s"))
return str->s;
@@ -731,6 +743,9 @@ h5tools_str_indent(h5tools_str_t *str, const h5tool_format_t *info,
* PVN, 28 March 2006
* added H5T_NATIVE_LDOUBLE case
*
+ * Vailin Choi; August 2010
+ * Modified to handle printing of selected compound fields for h5watch.
+ *
* Raymond Lu, 2011-09-01
* CLANG compiler complained about the line (about 800):
* tempint = (tempint >> packed_data_offset) & packed_data_mask;
@@ -1029,7 +1044,57 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
} /* end if (sizeof(long long) == nsize) */
break;
case H5T_COMPOUND:
- {
+ if(ctx->cmpd_listv) { /* there is <list_of_fields> */
+ int save_indent_level; /* The indentation level */
+ size_t curr_field; /* Current field to display */
+ int i = 0, x = 0; /* Local index variable */
+ H5LD_memb_t **listv; /* Vector of information for <list_of_fields> */
+
+ listv = ctx->cmpd_listv;
+ ctx->cmpd_listv = NULL;
+
+ h5tools_str_append(str, "%s", OPT(info->cmpd_pre, "{"));
+
+ /*
+ * Go through the vector containing info about the comma-separated list of
+ * compound fields and then members in each field:
+ * put in "{", "}", ",", member name and value accordingly.
+ */
+ save_indent_level = ctx->indent_level;
+ for(curr_field = 0; listv[curr_field] != NULL; curr_field++) {
+ if (curr_field)
+ h5tools_str_append(str, "%s", OPT(info->cmpd_sep, ", "OPTIONAL_LINE_BREAK));
+ else
+ h5tools_str_append(str, "%s", OPT(info->cmpd_end, ""));
+
+ if(info->arr_linebreak)
+ h5tools_str_indent(str, info, ctx);
+
+ /* Process members of each field */
+ for(i = 0; listv[curr_field]->names[i] != NULL; i++) {
+ h5tools_str_append(str, OPT(info->cmpd_name, ""), listv[curr_field]->names[i]);
+ if(i) {
+ ctx->indent_level++;
+ h5tools_str_append(str, "%s", OPT(info->cmpd_pre, "{"));
+ }
+ }
+ h5tools_str_sprint(str, info, container, listv[curr_field]->last_tid, cp_vp + listv[curr_field]->tot_offset, ctx);
+ if(ctx->indent_level > 0)
+ for(x = ctx->indent_level; x > 0; x--)
+ h5tools_str_append(str, "%s", OPT(info->cmpd_suf, "}"));
+ ctx->indent_level = save_indent_level;
+ }
+
+
+ if(info->arr_linebreak) {
+ h5tools_str_append(str, "%s", OPT(info->cmpd_end, ""));
+ h5tools_str_indent(str, info, ctx);
+ }
+ h5tools_str_append(str, "%s", OPT(info->cmpd_suf, "}"));
+
+ ctx->cmpd_listv = info->cmpd_listv;
+
+ } else {
unsigned j;
nmembs = H5Tget_nmembers(type);
diff --git a/tools/misc/Makefile.am b/tools/misc/Makefile.am
index fdfe8f7..bde6805 100644
--- a/tools/misc/Makefile.am
+++ b/tools/misc/Makefile.am
@@ -27,20 +27,24 @@ AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
#test scripts and programs
TEST_PROG=h5repart_gentest talign
-TEST_SCRIPT=testh5repart.sh testh5mkgrp.sh
+TEST_SCRIPT=testh5repart.sh testh5mkgrp.sh testh5clear.sh
-check_PROGRAMS=$(TEST_PROG) repart_test
+
+check_PROGRAMS=$(TEST_PROG) repart_test clear_open_chk
check_SCRIPTS=$(TEST_SCRIPT)
-SCRIPT_DEPEND=h5repart$(EXEEXT) h5mkgrp$(EXEEXT)
+SCRIPT_DEPEND=h5repart$(EXEEXT) h5mkgrp$(EXEEXT) h5clear$(EXEEXT)
+
# These are our main targets, the tools
-bin_PROGRAMS=h5debug h5repart h5mkgrp
+bin_PROGRAMS=h5debug h5repart h5mkgrp h5clear
bin_SCRIPTS=h5redeploy
+noinst_PROGRAMS=h5clear_gentest
# Add h5debug, h5repart, and h5mkgrp specific linker flags here
h5debug_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
h5repart_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
h5mkgrp_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+h5clear_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
# Tell automake to clean h5redeploy script
CLEANFILES=h5redeploy
@@ -51,7 +55,7 @@ CLEANFILES=h5redeploy
CHECK_CLEANFILES+=*.h5 ../testfiles/fst_family*.h5 ../testfiles/scd_family*.h5
# These were generated by configure. Remove them only when distclean.
-DISTCLEANFILES=h5cc testh5repart.sh
+DISTCLEANFILES=h5cc testh5repart.sh testh5clear.sh
# All programs rely on hdf5 library and h5tools library
LDADD=$(LIBH5TOOLS) $(LIBHDF5)
diff --git a/tools/misc/clear_open_chk.c b/tools/misc/clear_open_chk.c
new file mode 100644
index 0000000..f3e6ba3
--- /dev/null
+++ b/tools/misc/clear_open_chk.c
@@ -0,0 +1,72 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#include "hdf5.h"
+#include "H5private.h"
+#include "h5tools.h"
+
+static void usage(void);
+
+static void
+usage(void)
+{
+ HDfprintf(stdout, "\n");
+ HDfprintf(stdout, "Usage error!\n");
+ HDfprintf(stdout, "Usage: clear_open_chk filename\n");
+} /* usage() */
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: To open the file which has zero or nonzero status_flags in
+ * the superblock.
+ *
+ * Return: 0 on success
+ * 1 on failure
+ *
+ * Programmer: Vailin Choi; July 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+main(int argc, char *argv[])
+{
+ char *fname; /* The HDF5 file name */
+ hid_t fid; /* File ID */
+
+ /* Check the # of arguments */
+ if(argc != 2) {
+ usage();
+ return(EXIT_FAILURE);
+ }
+
+ /* Get the file name */
+ fname = HDstrdup(argv[1]);
+
+ /* Try opening the file */
+ if((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) {
+ HDfprintf(stderr, "clear_open_chk: unable to open the file\n");
+ return EXIT_FAILURE;
+ }
+
+ /* Close the file */
+ if(H5Fclose(fid) < 0) {
+ HDfprintf(stderr, "clear_open_chk: cannot close the file\n");
+ return EXIT_FAILURE;
+ }
+
+ /* Return success */
+ return EXIT_SUCCESS;
+
+} /* main() */
diff --git a/tools/misc/h5clear.c b/tools/misc/h5clear.c
new file mode 100644
index 0000000..0be4f8f
--- /dev/null
+++ b/tools/misc/h5clear.c
@@ -0,0 +1,137 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Programmer:
+ *
+ * Purpose:
+ */
+
+#include "hdf5.h"
+#include "H5private.h"
+#include "h5tools.h"
+#include "h5tools_utils.h"
+
+/* Name of tool */
+#define PROGRAMNAME "h5clear"
+
+/* Make this private property (defined in H5Fprivate.h) available to h5clear. */
+#define H5F_ACS_CLEAR_STATUS_FLAGS_NAME "clear_status_flags"
+
+/*-------------------------------------------------------------------------
+ * Function: leave
+ *
+ * Purpose: Close the tools library and exit
+ *
+ * Return: Does not return
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+leave(int ret)
+{
+ h5tools_close();
+ HDexit(ret);
+
+} /* leave() */
+
+/*-------------------------------------------------------------------------
+ * Function: usage
+ *
+ * Purpose: Prints a usage message
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+usage(void)
+{
+ HDfprintf(stdout, "usage: h5clear filename\n");
+
+} /* usage() */
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose:
+ *
+ * Return: Success:
+ * Failure:
+ *
+ * Programmer:
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+main (int argc, char *argv[])
+{
+ char *fname; /* File name */
+ hbool_t clear = TRUE; /* To clear the status_flags in the file's superblock */
+ hid_t fapl = -1; /* File access property list */
+ hid_t fid = -1; /* File ID */
+
+ h5tools_setprogname(PROGRAMNAME);
+ h5tools_setstatus(EXIT_SUCCESS);
+
+ /* Disable the HDF5 library's error reporting */
+ H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
+
+ /* initialize h5tools lib */
+ h5tools_init();
+
+ /* Check for the # of arguments */
+ if(argc != 2) {
+ usage();
+ leave(EXIT_FAILURE);
+ }
+
+ /* Duplicate the file name */
+ fname = HDstrdup(argv[opt_ind]);
+
+ /* Get a copy of the file access property list */
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
+ error_msg("H5Pcreate\n");
+ exit(EXIT_FAILURE);
+ }
+
+ /* Set to clear the status_flags in the file's superblock */
+ /* This is a private property used by h5clear only */
+ if(H5Pset(fapl, H5F_ACS_CLEAR_STATUS_FLAGS_NAME, &clear) < 0) {
+ error_msg("H5Pset\n");
+ exit(EXIT_FAILURE);
+ }
+
+ if((fid = h5tools_fopen(fname, H5F_ACC_RDWR, fapl, NULL, NULL, (size_t)0)) < 0) {
+ error_msg("h5tools_fopen\n");
+ exit(EXIT_FAILURE);
+ }
+
+ /* Close the file */
+ if(H5Fclose(fid) < 0) {
+ error_msg("H5Fclose\n");
+ exit(EXIT_FAILURE);
+ }
+
+ /* CLose the property list */
+ if(H5Pclose(fapl) < 0) {
+ error_msg("H5Pclose\n");
+ exit(EXIT_FAILURE);
+ }
+
+ return EXIT_SUCCESS;
+} /* main() */
diff --git a/tools/misc/h5clear_gentest.c b/tools/misc/h5clear_gentest.c
new file mode 100644
index 0000000..0f20c35
--- /dev/null
+++ b/tools/misc/h5clear_gentest.c
@@ -0,0 +1,174 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#include "hdf5.h"
+#include "H5private.h"
+
+/* The HDF5 test files */
+const char *FILENAME[] = {
+ "h5clear_sec2_v3.h5", /* 0 -- sec2 file with superblock version 3 */
+ "h5clear_log_v3.h5", /* 1 -- log file with superblock veresion 3 */
+ "h5clear_sec2_v0.h5", /* 2 -- sec2 file with superblock version 0 */
+ "h5clear_sec2_v2.h5" /* 3 -- sec2 file with superblock version 2 */
+};
+
+#define KB 1024U
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: To create HDF5 files with non-zero status_flags in the superblock
+ * via flushing and exiting without closing the library.
+ *
+ * Due to file locking, status_flags in the superblock will be
+ * nonzero after H5Fcreate. The library will clear status_flags
+ * on file closing. This program, after "H5Fcreate" the files,
+ * exits without going through library closing. Thus, status_flags
+ * for these files are not cleared.
+ * The library will check consistency of status_flags when opening
+ * a file with superblock >= v3 and will return error accordingly.
+ * The library will not check status_flags when opening a file
+ * with < v3 superblock.
+ *
+ * These files are used by "h5clear" to see if the tool clears
+ * status_flags properly so users can open the files afterwards.
+ *
+ * Return: Success: 0
+ * Failure: 1
+ *
+ * Programmer: Vailin Choi; July 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+main(void)
+{
+ hid_t fid; /* File ID */
+ hid_t fcpl; /* File creation property list */
+ hid_t fapl, new_fapl; /* File access property lists */
+ char fname[512]; /* File name */
+ unsigned new_format; /* To use latest library format or not */
+
+ /* Create a copy of the file access property list */
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ goto error;
+
+ /* Copy the file access property list */
+ if((new_fapl = H5Pcopy(fapl)) < 0)
+ goto error;
+ /* Set to latest library format */
+ if(H5Pset_libver_bounds(new_fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ goto error;
+
+ /* Files created within this for loop will have v3 superblock and nonzero status_flags */
+ for(new_format = FALSE; new_format <= TRUE; new_format++) {
+ hid_t fapl2, my_fapl; /* File access property lists */
+
+ /* Set to use the appropriate file access property list */
+ if(new_format)
+ fapl2 = new_fapl;
+ else
+ fapl2 = fapl;
+ /*
+ * Create a sec2 file
+ */
+ if((my_fapl = H5Pcopy(fapl2)) < 0)
+ goto error;
+ /* Create the file */
+ sprintf(fname, "%s%s", new_format? "latest_":"", FILENAME[0]);
+ if((fid = H5Fcreate(fname, H5F_ACC_TRUNC | (new_format ? 0 : H5F_ACC_SWMR_WRITE), H5P_DEFAULT, my_fapl)) < 0)
+ goto error;
+
+ /* Flush the file */
+ if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
+ goto error;
+
+ /* Close the property list */
+ if(H5Pclose(my_fapl) < 0)
+ goto error;
+
+ /*
+ * Create a log file
+ */
+ /* Create a copy of file access property list */
+ if((my_fapl = H5Pcopy(fapl2)) < 0)
+ goto error;
+
+ /* Setup the fapl for the log driver */
+ if(H5Pset_fapl_log(my_fapl, "append.log", (unsigned long long)H5FD_LOG_ALL, (size_t)(4 * KB)) < 0)
+ goto error;
+
+ /* Create the file */
+ sprintf(fname, "%s%s", new_format? "latest_":"", FILENAME[1]);
+ if((fid = H5Fcreate(fname, H5F_ACC_TRUNC | (new_format ? 0 : H5F_ACC_SWMR_WRITE), H5P_DEFAULT, my_fapl)) < 0)
+ goto error;
+
+ /* Flush the file */
+ if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
+ goto error;
+
+ /* Close the property list */
+ if(H5Pclose(my_fapl) < 0)
+ goto error;
+
+ } /* end for */
+
+ /*
+ * Create a sec2 file with v0 superblock but nonzero status_flags
+ */
+ if((fid = H5Fcreate(FILENAME[2], H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ goto error;
+
+ /* Flush the file */
+ if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
+ goto error;
+
+
+ /*
+ * Create a sec2 file with v2 superblock but nonzero status_flags
+ */
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ goto error;
+ if(H5Pset_shared_mesg_nindexes(fcpl, 1) < 0)
+ goto error;
+ if(H5Pset_shared_mesg_index(fcpl, 0, H5O_SHMESG_DTYPE_FLAG, 50) < 0)
+ goto error;
+
+ if((fid = H5Fcreate(FILENAME[3], H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ goto error;
+
+ /* Flush the file */
+ if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
+ goto error;
+
+
+ /* Close the property lists */
+ if(H5Pclose(fapl) < 0)
+ goto error;
+ if(H5Pclose(new_fapl) < 0)
+ goto error;
+ if(H5Pclose(fcpl) < 0)
+ goto error;
+
+ fflush(stdout);
+ fflush(stderr);
+
+ /* Not going through library closing by calling _exit(0) with success */
+ HD_exit(0);
+
+error:
+
+ /* Exit with failure */
+ HD_exit(1);
+}
diff --git a/tools/misc/h5debug.c b/tools/misc/h5debug.c
index 480450d..aac14db 100644
--- a/tools/misc/h5debug.c
+++ b/tools/misc/h5debug.c
@@ -121,6 +121,14 @@ get_H5B2_class(const uint8_t *sig)
cls = H5A_BT2_CORDER;
break;
+ case H5B2_CDSET_ID:
+ cls = H5D_BT2;
+ break;
+
+ case H5B2_CDSET_FILT_ID:
+ cls = H5D_BT2_FILT;
+ break;
+
case H5B2_NUM_BTREE_ID:
default:
HDfprintf(stderr, "Unknown v2 B-tree subtype %u\n", (unsigned)(subtype));
@@ -157,6 +165,14 @@ get_H5EA_class(const uint8_t *sig)
cls = H5EA_CLS_TEST;
break;
+ case H5EA_CLS_CHUNK_ID:
+ cls = H5EA_CLS_CHUNK;
+ break;
+
+ case H5EA_CLS_FILT_CHUNK_ID:
+ cls = H5EA_CLS_FILT_CHUNK;
+ break;
+
case H5EA_NUM_CLS_ID:
default:
HDfprintf(stderr, "Unknown extensible array class %u\n", (unsigned)(clsid));
@@ -193,6 +209,14 @@ get_H5FA_class(const uint8_t *sig)
cls = H5FA_CLS_TEST;
break;
+ case H5FA_CLS_CHUNK_ID:
+ cls = H5FA_CLS_CHUNK;
+ break;
+
+ case H5FA_CLS_FILT_CHUNK_ID:
+ cls = H5FA_CLS_FILT_CHUNK;
+ break;
+
case H5FA_NUM_CLS_ID:
default:
HDfprintf(stderr, "Unknown fixed array class %u\n", (unsigned)(clsid));
@@ -398,6 +422,13 @@ main(int argc, char *argv[])
const H5B2_class_t *cls = get_H5B2_class(sig);
HDassert(cls);
+ if((cls == H5D_BT2 || cls == H5D_BT2_FILT) && extra == 0) {
+ fprintf(stderr, "ERROR: Need v2 B-tree header address and object header address containing the layout message in order to dump header\n");
+ fprintf(stderr, "v2 B-tree hdr usage:\n");
+ fprintf(stderr, "\th5debug <filename> <v2 B-tree header address> <object header address>\n");
+ HDexit(4);
+ }
+
status = H5B2__hdr_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, cls, (haddr_t)extra);
} else if(!HDmemcmp(sig, H5B2_INT_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
@@ -408,7 +439,16 @@ main(int argc, char *argv[])
HDassert(cls);
/* Check for enough valid parameters */
- if(extra == 0 || extra2 == 0 || extra3 == 0) {
+ if((cls == H5D_BT2 || cls == H5D_BT2_FILT) &&
+ (extra == 0 || extra2 == 0 || extra3 == 0 || extra4 == 0)) {
+
+ fprintf(stderr, "ERROR: Need v2 B-tree header address, the node's number of records, depth, and object header address containing the layout message in order to dump internal node\n");
+ fprintf(stderr, "NOTE: Leaf nodes are depth 0, the internal nodes above them are depth 1, etc.\n");
+ fprintf(stderr, "v2 B-tree internal node usage:\n");
+ fprintf(stderr, "\th5debug <filename> <internal node address> <v2 B-tree header address> <number of records> <depth> <object header address>\n");
+ HDexit(4);
+
+ } else if(extra == 0 || extra2 == 0 || extra3 == 0) {
HDfprintf(stderr, "ERROR: Need v2 B-tree header address and the node's number of records and depth in order to dump internal node\n");
HDfprintf(stderr, "NOTE: Leaf nodes are depth 0, the internal nodes above them are depth 1, etc.\n");
HDfprintf(stderr, "v2 B-tree internal node usage:\n");
@@ -426,7 +466,15 @@ main(int argc, char *argv[])
HDassert(cls);
/* Check for enough valid parameters */
- if(extra == 0 || extra2 == 0) {
+ if((cls == H5D_BT2 || cls == H5D_BT2_FILT) &&
+ (extra == 0 || extra2 == 0 || extra3 == 0 )) {
+
+ fprintf(stderr, "ERROR: Need v2 B-tree header address, number of records, and object header address containing the layout message in order to dump leaf node\n");
+ fprintf(stderr, "v2 B-tree leaf node usage:\n");
+ fprintf(stderr, "\th5debug <filename> <leaf node address> <v2 B-tree header address> <number of records> <object header address>\n");
+ HDexit(4);
+
+ } else if(extra == 0 || extra2 == 0) {
HDfprintf(stderr, "ERROR: Need v2 B-tree header address and number of records in order to dump leaf node\n");
HDfprintf(stderr, "v2 B-tree leaf node usage:\n");
HDfprintf(stderr, "\th5debug <filename> <leaf node address> <v2 B-tree header address> <number of records>\n");
diff --git a/tools/misc/testh5clear.sh.in b/tools/misc/testh5clear.sh.in
new file mode 100644
index 0000000..aeac03e
--- /dev/null
+++ b/tools/misc/testh5clear.sh.in
@@ -0,0 +1,130 @@
+#! /bin/sh
+#
+# 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.
+#
+# Tests for the h5clear tool
+#
+srcdir=@srcdir@
+TESTNAME=h5clear
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+H5CLEAR=h5clear
+H5CLEAR_BIN=`pwd`/$H5CLEAR # The path of the tool binary
+
+GENTEST=h5clear_gentest # Generate test files
+GENTEST_BIN=`pwd`/$GENTEST # The path to the binary
+
+OPENCHK=clear_open_chk # Try opening the test file
+OPENCHK_BIN=`pwd`/$OPENCHK # The path to the binary
+
+SUCCEED=0
+FAIL=1
+
+nerrors=0
+verbose=yes
+
+# Print a line-line message left justified in a field of 70 characters
+# beginning with the word "Testing".
+#
+TESTING() {
+ SPACES=" "
+ echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012'
+}
+
+# (1) Use "h5clear" to clear the status_flags in the test file
+# (2) Open the test file via "clear_open_chk"
+# $1 is the filename for testing
+TOOLTEST() {
+ TESTING $H5CLEAR $1
+ fname=$1
+ # Use "h5clear" to clear the status_flags in the test file
+ $RUNSERIAL $H5CLEAR_BIN $fname
+ if test $? -ne $SUCCEED; then
+ echo ".....$H5CLEAR: should succeed"
+ nerrors=`expr $nerrors + 1`
+ else
+ # Open the test file via "clear_open_chk"
+ $OPENCHK_BIN $fname
+ if test $? -ne $SUCCEED; then
+ echo "......$OPENCHK: should succeed"
+ nerrors=`expr $nerrors + 1`
+ else
+ echo "PASSED"
+ fi
+ fi
+}
+
+
+
+# Use "clear_open_chk" to check if the file open succeeds or fails
+# $1 is the filename to open
+# $2 is the expected return from "clear_open_chk"
+OPENCHK() {
+ fname=$1
+ expected=$2
+ #
+ $OPENCHK_BIN $fname 2>/dev/null
+ actual=$?
+ if test $actual -ne $expected; then
+ echo "Unexpected return from $OPENCHK"
+ nerrors=`expr $nerrors + 1`
+ fi
+}
+
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+#
+$GENTEST_BIN # Create HDF5 test files
+if test $? -ne 0; then # Error returned from generating test files
+ echo "$GENTEST: .....fail in generating test files"
+ nerrors=`expr $nerrors + 1`
+else
+ # Initial file open fails
+ # After "h5clear" the file, the subsequent file open succeeds
+ OPENCHK h5clear_sec2_v3.h5 $FAIL
+ TOOLTEST h5clear_sec2_v3.h5
+ #
+ OPENCHK h5clear_log_v3.h5 $FAIL
+ TOOLTEST h5clear_log_v3.h5
+ #
+ OPENCHK latest_h5clear_sec2_v3.h5 $FAIL
+ TOOLTEST latest_h5clear_sec2_v3.h5
+ #
+ OPENCHK latest_h5clear_log_v3.h5 $FAIL
+ TOOLTEST latest_h5clear_log_v3.h5
+fi
+#
+#
+# File open succeeds because the library does not check status_flags for file with < v3 superblock
+OPENCHK h5clear_sec2_v0.h5 $SUCCEED
+TOOLTEST h5clear_sec2_v0.h5
+OPENCHK h5clear_sec2_v2.h5 $SUCCEED
+TOOLTEST h5clear_sec2_v2.h5
+#
+# Clean up test files
+if test -z "$HDF5_NOCLEANUP"; then
+ rm -f h5clear_*.h5 latest_h5clear*.h5
+fi
+
+if test $nerrors -eq 0 ; then
+ echo "All $TESTNAME tests passed."
+ exit $EXIT_SUCCESS
+else
+ echo "$TESTNAME tests failed with $nerrors error(s)."
+ exit $EXIT_FAILURE
+fi
diff --git a/tools/testfiles/family_file00000.h5 b/tools/testfiles/family_file00000.h5
index 88f75ca..d86fb96 100644
--- a/tools/testfiles/family_file00000.h5
+++ b/tools/testfiles/family_file00000.h5
Binary files differ
diff --git a/tools/testfiles/taindices.h5 b/tools/testfiles/taindices.h5
index b482a21..c0e5a68 100644
--- a/tools/testfiles/taindices.h5
+++ b/tools/testfiles/taindices.h5
Binary files differ
diff --git a/tools/testfiles/tarray1.h5 b/tools/testfiles/tarray1.h5
index 90371f2..b39d966 100644
--- a/tools/testfiles/tarray1.h5
+++ b/tools/testfiles/tarray1.h5
Binary files differ
diff --git a/tools/testfiles/tarray2.h5 b/tools/testfiles/tarray2.h5
index e2e53e8..4c0b105 100644
--- a/tools/testfiles/tarray2.h5
+++ b/tools/testfiles/tarray2.h5
Binary files differ
diff --git a/tools/testfiles/tarray3.h5 b/tools/testfiles/tarray3.h5
index 580d846..dbc6031 100644
--- a/tools/testfiles/tarray3.h5
+++ b/tools/testfiles/tarray3.h5
Binary files differ
diff --git a/tools/testfiles/tarray4.h5 b/tools/testfiles/tarray4.h5
index b34efb8..142822b 100644
--- a/tools/testfiles/tarray4.h5
+++ b/tools/testfiles/tarray4.h5
Binary files differ
diff --git a/tools/testfiles/tarray5.h5 b/tools/testfiles/tarray5.h5
index 55ebf46..e597e3b 100644
--- a/tools/testfiles/tarray5.h5
+++ b/tools/testfiles/tarray5.h5
Binary files differ
diff --git a/tools/testfiles/tarray6.h5 b/tools/testfiles/tarray6.h5
index 7eb078c..d5ad021 100644
--- a/tools/testfiles/tarray6.h5
+++ b/tools/testfiles/tarray6.h5
Binary files differ
diff --git a/tools/testfiles/tarray7.h5 b/tools/testfiles/tarray7.h5
index 74089ea..a744ed5 100644
--- a/tools/testfiles/tarray7.h5
+++ b/tools/testfiles/tarray7.h5
Binary files differ
diff --git a/tools/testfiles/tattr.h5 b/tools/testfiles/tattr.h5
index d61def5..bceb228 100644
--- a/tools/testfiles/tattr.h5
+++ b/tools/testfiles/tattr.h5
Binary files differ
diff --git a/tools/testfiles/tattr2.h5 b/tools/testfiles/tattr2.h5
index c40f3f7..f062399 100644
--- a/tools/testfiles/tattr2.h5
+++ b/tools/testfiles/tattr2.h5
Binary files differ
diff --git a/tools/testfiles/tbigdims.h5 b/tools/testfiles/tbigdims.h5
index c54c2c3..50bf2fd 100644
--- a/tools/testfiles/tbigdims.h5
+++ b/tools/testfiles/tbigdims.h5
Binary files differ
diff --git a/tools/testfiles/tbitfields.h5 b/tools/testfiles/tbitfields.h5
index 11087f0..b1b7751 100644
--- a/tools/testfiles/tbitfields.h5
+++ b/tools/testfiles/tbitfields.h5
Binary files differ
diff --git a/tools/testfiles/tchar.h5 b/tools/testfiles/tchar.h5
index 4d23ea9..0391772 100644
--- a/tools/testfiles/tchar.h5
+++ b/tools/testfiles/tchar.h5
Binary files differ
diff --git a/tools/testfiles/tcompound.h5 b/tools/testfiles/tcompound.h5
index d1ec650..edef9d3 100644
--- a/tools/testfiles/tcompound.h5
+++ b/tools/testfiles/tcompound.h5
Binary files differ
diff --git a/tools/testfiles/tcompound2.h5 b/tools/testfiles/tcompound2.h5
index 98e80bd..482f9fd 100644
--- a/tools/testfiles/tcompound2.h5
+++ b/tools/testfiles/tcompound2.h5
Binary files differ
diff --git a/tools/testfiles/tcompound_complex.h5 b/tools/testfiles/tcompound_complex.h5
index 5c6274f..a0c90eb 100644
--- a/tools/testfiles/tcompound_complex.h5
+++ b/tools/testfiles/tcompound_complex.h5
Binary files differ
diff --git a/tools/testfiles/tdatareg.h5 b/tools/testfiles/tdatareg.h5
index 62a889f..631d6b0 100644
--- a/tools/testfiles/tdatareg.h5
+++ b/tools/testfiles/tdatareg.h5
Binary files differ
diff --git a/tools/testfiles/tdset.h5 b/tools/testfiles/tdset.h5
index 71dcb91..ae19cf4 100644
--- a/tools/testfiles/tdset.h5
+++ b/tools/testfiles/tdset.h5
Binary files differ
diff --git a/tools/testfiles/tdset2.h5 b/tools/testfiles/tdset2.h5
index 5e17cfd..f3e555b 100644
--- a/tools/testfiles/tdset2.h5
+++ b/tools/testfiles/tdset2.h5
Binary files differ
diff --git a/tools/testfiles/tdset_idx.ddl b/tools/testfiles/tdset_idx.ddl
new file mode 100644
index 0000000..65d9f44
--- /dev/null
+++ b/tools/testfiles/tdset_idx.ddl
@@ -0,0 +1,61 @@
+#############################
+Expected output for 'h5dump -p -H tdset_idx.h5'
+#############################
+HDF5 "tdset_idx.h5" {
+GROUP "/" {
+ DATASET "dset_btree" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 20, 10 ) / ( 200, 100 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 5, 5 )
+ SIZE 800
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE 0
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_INCR
+ }
+ }
+ DATASET "dset_filter" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 5, 5 )
+ SIZE 200 (4.000:1 COMPRESSION)
+ }
+ FILTERS {
+ COMPRESSION DEFLATE { LEVEL 9 }
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE 0
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_INCR
+ }
+ }
+ DATASET "dset_fixed" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 5, 5 )
+ SIZE 800
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE 0
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_INCR
+ }
+ }
+}
+}
diff --git a/tools/testfiles/tdset_idx.h5 b/tools/testfiles/tdset_idx.h5
new file mode 100644
index 0000000..314de9b
--- /dev/null
+++ b/tools/testfiles/tdset_idx.h5
Binary files differ
diff --git a/tools/testfiles/tdset_idx.ls b/tools/testfiles/tdset_idx.ls
new file mode 100644
index 0000000..daa14b2
--- /dev/null
+++ b/tools/testfiles/tdset_idx.ls
@@ -0,0 +1,36 @@
+dset_btree Dataset {20/200, 10/100}
+ Data:
+ (0,0) 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1,
+ (2,2) 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3,
+ (4,4) 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5,
+ (6,6) 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7,
+ (8,8) 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+ (11,0) 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1,
+ (13,2) 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3,
+ (15,4) 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5,
+ (17,6) 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7,
+ (19,8) 8, 9
+dset_filter Dataset {20, 10}
+ Data:
+ (0,0) 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1,
+ (2,2) 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3,
+ (4,4) 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5,
+ (6,6) 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7,
+ (8,8) 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+ (11,0) 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1,
+ (13,2) 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3,
+ (15,4) 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5,
+ (17,6) 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7,
+ (19,8) 8, 9
+dset_fixed Dataset {20, 10}
+ Data:
+ (0,0) 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1,
+ (2,2) 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3,
+ (4,4) 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5,
+ (6,6) 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7,
+ (8,8) 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+ (11,0) 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1,
+ (13,2) 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3,
+ (15,4) 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5,
+ (17,6) 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7,
+ (19,8) 8, 9
diff --git a/tools/testfiles/tempty.h5 b/tools/testfiles/tempty.h5
index d7d903f..f6d6b7a 100644
--- a/tools/testfiles/tempty.h5
+++ b/tools/testfiles/tempty.h5
Binary files differ
diff --git a/tools/testfiles/tenum.h5 b/tools/testfiles/tenum.h5
index b1300d8..5521fc4 100644
--- a/tools/testfiles/tenum.h5
+++ b/tools/testfiles/tenum.h5
Binary files differ
diff --git a/tools/testfiles/tfamily00000.h5 b/tools/testfiles/tfamily00000.h5
index a130bfd..70f6dcf 100644
--- a/tools/testfiles/tfamily00000.h5
+++ b/tools/testfiles/tfamily00000.h5
Binary files differ
diff --git a/tools/testfiles/tfcontents2.h5 b/tools/testfiles/tfcontents2.h5
index 1df0779..1514e28 100644
--- a/tools/testfiles/tfcontents2.h5
+++ b/tools/testfiles/tfcontents2.h5
Binary files differ
diff --git a/tools/testfiles/tfvalues.h5 b/tools/testfiles/tfvalues.h5
index a6af958..c238f44 100644
--- a/tools/testfiles/tfvalues.h5
+++ b/tools/testfiles/tfvalues.h5
Binary files differ
diff --git a/tools/testfiles/tgroup.h5 b/tools/testfiles/tgroup.h5
index 565fb67..7c5cd63 100644
--- a/tools/testfiles/tgroup.h5
+++ b/tools/testfiles/tgroup.h5
Binary files differ
diff --git a/tools/testfiles/thlink.h5 b/tools/testfiles/thlink.h5
index 6e0e7e1..0ad92d1 100644
--- a/tools/testfiles/thlink.h5
+++ b/tools/testfiles/thlink.h5
Binary files differ
diff --git a/tools/testfiles/thyperslab.h5 b/tools/testfiles/thyperslab.h5
index a730aa3..dc2c0db 100644
--- a/tools/testfiles/thyperslab.h5
+++ b/tools/testfiles/thyperslab.h5
Binary files differ
diff --git a/tools/testfiles/tlarge_objname.h5 b/tools/testfiles/tlarge_objname.h5
index 707d7b6..9e26283 100644
--- a/tools/testfiles/tlarge_objname.h5
+++ b/tools/testfiles/tlarge_objname.h5
Binary files differ
diff --git a/tools/testfiles/tlonglinks.h5 b/tools/testfiles/tlonglinks.h5
index f54e5f5..6c2cab4 100644
--- a/tools/testfiles/tlonglinks.h5
+++ b/tools/testfiles/tlonglinks.h5
Binary files differ
diff --git a/tools/testfiles/tloop.h5 b/tools/testfiles/tloop.h5
index d7a2f47..e54f91c 100644
--- a/tools/testfiles/tloop.h5
+++ b/tools/testfiles/tloop.h5
Binary files differ
diff --git a/tools/testfiles/tloop2.h5 b/tools/testfiles/tloop2.h5
index 995bfab..60d7ed2 100644
--- a/tools/testfiles/tloop2.h5
+++ b/tools/testfiles/tloop2.h5
Binary files differ
diff --git a/tools/testfiles/tmulti-s.h5 b/tools/testfiles/tmulti-s.h5
index 3feae49..bc2fafb 100644
--- a/tools/testfiles/tmulti-s.h5
+++ b/tools/testfiles/tmulti-s.h5
Binary files differ
diff --git a/tools/testfiles/tname-amp.h5 b/tools/testfiles/tname-amp.h5
index 27ab521..82f6316 100644
--- a/tools/testfiles/tname-amp.h5
+++ b/tools/testfiles/tname-amp.h5
Binary files differ
diff --git a/tools/testfiles/tname-apos.h5 b/tools/testfiles/tname-apos.h5
index 42d0fc3..9b49159 100644
--- a/tools/testfiles/tname-apos.h5
+++ b/tools/testfiles/tname-apos.h5
Binary files differ
diff --git a/tools/testfiles/tname-gt.h5 b/tools/testfiles/tname-gt.h5
index fabd154..1d2795e 100644
--- a/tools/testfiles/tname-gt.h5
+++ b/tools/testfiles/tname-gt.h5
Binary files differ
diff --git a/tools/testfiles/tname-lt.h5 b/tools/testfiles/tname-lt.h5
index 6b13375..e3dafe0 100644
--- a/tools/testfiles/tname-lt.h5
+++ b/tools/testfiles/tname-lt.h5
Binary files differ
diff --git a/tools/testfiles/tname-quot.h5 b/tools/testfiles/tname-quot.h5
index eb8d6cc..fd9e862 100644
--- a/tools/testfiles/tname-quot.h5
+++ b/tools/testfiles/tname-quot.h5
Binary files differ
diff --git a/tools/testfiles/tname-sp.h5 b/tools/testfiles/tname-sp.h5
index 0201efd..514eb8d 100644
--- a/tools/testfiles/tname-sp.h5
+++ b/tools/testfiles/tname-sp.h5
Binary files differ
diff --git a/tools/testfiles/tnestedcomp.h5 b/tools/testfiles/tnestedcomp.h5
index b777ee3..2912310 100644
--- a/tools/testfiles/tnestedcomp.h5
+++ b/tools/testfiles/tnestedcomp.h5
Binary files differ
diff --git a/tools/testfiles/tnodata.h5 b/tools/testfiles/tnodata.h5
index 8e0a89d..1e537f1 100644
--- a/tools/testfiles/tnodata.h5
+++ b/tools/testfiles/tnodata.h5
Binary files differ
diff --git a/tools/testfiles/tnullspace.h5 b/tools/testfiles/tnullspace.h5
index b5dac5d..d405061 100644
--- a/tools/testfiles/tnullspace.h5
+++ b/tools/testfiles/tnullspace.h5
Binary files differ
diff --git a/tools/testfiles/tobjref.h5 b/tools/testfiles/tobjref.h5
index ef42ff3..ecf3827 100644
--- a/tools/testfiles/tobjref.h5
+++ b/tools/testfiles/tobjref.h5
Binary files differ
diff --git a/tools/testfiles/topaque.h5 b/tools/testfiles/topaque.h5
index d56b594..669f4b7 100644
--- a/tools/testfiles/topaque.h5
+++ b/tools/testfiles/topaque.h5
Binary files differ
diff --git a/tools/testfiles/tref-escapes-at.h5 b/tools/testfiles/tref-escapes-at.h5
index 641513c..e3f0d6b 100644
--- a/tools/testfiles/tref-escapes-at.h5
+++ b/tools/testfiles/tref-escapes-at.h5
Binary files differ
diff --git a/tools/testfiles/tref-escapes.h5 b/tools/testfiles/tref-escapes.h5
index 6c7638b..766a840 100644
--- a/tools/testfiles/tref-escapes.h5
+++ b/tools/testfiles/tref-escapes.h5
Binary files differ
diff --git a/tools/testfiles/tref.h5 b/tools/testfiles/tref.h5
index 73b4be5..3a9899a 100644
--- a/tools/testfiles/tref.h5
+++ b/tools/testfiles/tref.h5
Binary files differ
diff --git a/tools/testfiles/tsaf.h5 b/tools/testfiles/tsaf.h5
index c84c5b6..75237ba 100644
--- a/tools/testfiles/tsaf.h5
+++ b/tools/testfiles/tsaf.h5
Binary files differ
diff --git a/tools/testfiles/tslink.h5 b/tools/testfiles/tslink.h5
index 753b62d..ab80d8f 100644
--- a/tools/testfiles/tslink.h5
+++ b/tools/testfiles/tslink.h5
Binary files differ
diff --git a/tools/testfiles/tsplit_file-m.h5 b/tools/testfiles/tsplit_file-m.h5
index a6eef73..d431c70 100644
--- a/tools/testfiles/tsplit_file-m.h5
+++ b/tools/testfiles/tsplit_file-m.h5
Binary files differ
diff --git a/tools/testfiles/tstr.h5 b/tools/testfiles/tstr.h5
index af5384f..ae6a012 100644
--- a/tools/testfiles/tstr.h5
+++ b/tools/testfiles/tstr.h5
Binary files differ
diff --git a/tools/testfiles/tstr2.h5 b/tools/testfiles/tstr2.h5
index d3b1588..b7d4802 100644
--- a/tools/testfiles/tstr2.h5
+++ b/tools/testfiles/tstr2.h5
Binary files differ
diff --git a/tools/testfiles/tstr3.h5 b/tools/testfiles/tstr3.h5
index 9f9112f..727dec5 100644
--- a/tools/testfiles/tstr3.h5
+++ b/tools/testfiles/tstr3.h5
Binary files differ
diff --git a/tools/testfiles/tstring-at.h5 b/tools/testfiles/tstring-at.h5
index aa17960..a477ee5 100644
--- a/tools/testfiles/tstring-at.h5
+++ b/tools/testfiles/tstring-at.h5
Binary files differ
diff --git a/tools/testfiles/tstring.h5 b/tools/testfiles/tstring.h5
index 667fe78..914a464 100644
--- a/tools/testfiles/tstring.h5
+++ b/tools/testfiles/tstring.h5
Binary files differ
diff --git a/tools/testfiles/tvldtypes1.h5 b/tools/testfiles/tvldtypes1.h5
index b5b2bd7..423dae8 100644
--- a/tools/testfiles/tvldtypes1.h5
+++ b/tools/testfiles/tvldtypes1.h5
Binary files differ
diff --git a/tools/testfiles/tvldtypes2.h5 b/tools/testfiles/tvldtypes2.h5
index 65bf63f..86ba20d 100644
--- a/tools/testfiles/tvldtypes2.h5
+++ b/tools/testfiles/tvldtypes2.h5
Binary files differ
diff --git a/tools/testfiles/tvldtypes3.h5 b/tools/testfiles/tvldtypes3.h5
index dd4aca7..66fd1d2 100644
--- a/tools/testfiles/tvldtypes3.h5
+++ b/tools/testfiles/tvldtypes3.h5
Binary files differ
diff --git a/tools/testfiles/tvldtypes4.h5 b/tools/testfiles/tvldtypes4.h5
index 70dc73e..016ad55 100644
--- a/tools/testfiles/tvldtypes4.h5
+++ b/tools/testfiles/tvldtypes4.h5
Binary files differ
diff --git a/tools/testfiles/tvldtypes5.h5 b/tools/testfiles/tvldtypes5.h5
index 776c020..71b924f 100644
--- a/tools/testfiles/tvldtypes5.h5
+++ b/tools/testfiles/tvldtypes5.h5
Binary files differ
diff --git a/tools/testfiles/tvms.h5 b/tools/testfiles/tvms.h5
index 9c243ff..d3b0b7c 100644
--- a/tools/testfiles/tvms.h5
+++ b/tools/testfiles/tvms.h5
Binary files differ