summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/h5copy/h5copygentest.c90
-rw-r--r--tools/h5copy/testh5copy.sh27
-rw-r--r--tools/testfiles/h5copytst.a.out.ls144
-rw-r--r--tools/testfiles/h5copytst.b.out.ls185
-rw-r--r--tools/testfiles/h5copytst.h5bin13696 -> 22072 bytes
5 files changed, 415 insertions, 31 deletions
diff --git a/tools/h5copy/h5copygentest.c b/tools/h5copy/h5copygentest.c
index 79f43ef..c9dc01f 100644
--- a/tools/h5copy/h5copygentest.c
+++ b/tools/h5copy/h5copygentest.c
@@ -19,16 +19,16 @@
#include <stdlib.h>
#include "hdf5.h"
-#define FILENAME "h5copytst.h5"
-#define DATASET_SIMPLE "simple"
-#define DATASET_CHUNK "chunk"
-#define DATASET_COMPACT "compact"
-#define DATASET_COMPOUND "compound"
-#define DATASET_COMPRESSED "compressed"
-#define DATASET_NAMED_VL "named_vl"
-#define DATASET_NESTED_VL "nested_vl"
-
-
+#define FILENAME "h5copytst.h5"
+#define DATASET_SIMPLE "simple"
+#define DATASET_CHUNK "chunk"
+#define DATASET_COMPACT "compact"
+#define DATASET_COMPOUND "compound"
+#define DATASET_COMPRESSED "compressed"
+#define DATASET_NAMED_VL "named_vl"
+#define DATASET_NESTED_VL "nested_vl"
+#define GROUP_EMPTY "grp_empty"
+#define GROUP_DATASETS "grp_dsets"
/*-------------------------------------------------------------------------
@@ -306,6 +306,64 @@ static void gent_nested_vl(hid_t loc_id)
/*-------------------------------------------------------------------------
+ * Function: gent_datasets
+ *
+ * Purpose: Generate all datasets in a particular location
+ *
+ *-------------------------------------------------------------------------
+ */
+static void gent_datasets(hid_t loc_id)
+{
+ gent_simple(loc_id);
+ gent_chunked(loc_id);
+ gent_compact(loc_id);
+ gent_compound(loc_id);
+ gent_compressed(loc_id);
+ gent_named_vl(loc_id);
+ gent_nested_vl(loc_id);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gent_empty_group
+ *
+ * Purpose: Generate an empty group in a location
+ *
+ *-------------------------------------------------------------------------
+ */
+static void gent_empty_group(hid_t loc_id)
+{
+ hid_t gid;
+
+ /* Create group in location */
+ gid = H5Gcreate(loc_id, GROUP_EMPTY, (size_t)0);
+
+ /* Release resources */
+ H5Gclose(gid);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gent_nested_datasets
+ *
+ * Purpose: Generate a group in a location and populate it with the "standard"
+ * datasets
+ *
+ *-------------------------------------------------------------------------
+ */
+static void gent_nested_datasets(hid_t loc_id)
+{
+ hid_t gid;
+
+ /* Create group in location */
+ gid = H5Gcreate(loc_id, GROUP_DATASETS, (size_t)0);
+
+ /* Add datasets to group created */
+ gent_datasets(gid);
+
+ /* Release resources */
+ H5Gclose(gid);
+}
+
+/*-------------------------------------------------------------------------
* Function: main
*
*-------------------------------------------------------------------------
@@ -317,17 +375,11 @@ int main(void)
/* Create source file */
fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- gent_simple(fid);
- gent_chunked(fid);
- gent_compact(fid);
- gent_compound(fid);
- gent_compressed(fid);
- gent_named_vl(fid);
- gent_nested_vl(fid);
+ gent_datasets(fid);
+ gent_empty_group(fid);
+ gent_nested_datasets(fid);
H5Fclose(fid);
- /* Create destination file with all datasets in root group */
-
return 0;
}
diff --git a/tools/h5copy/testh5copy.sh b/tools/h5copy/testh5copy.sh
index e0056ac..a905148 100644
--- a/tools/h5copy/testh5copy.sh
+++ b/tools/h5copy/testh5copy.sh
@@ -164,14 +164,14 @@ H5LSTEST()
fi
}
-# Copy single datasets of various forms from one root group to another,
-# adding new object to the destination file each time
+# Copy single datasets of various forms from one group to another,
+# adding object copied to the destination file each time
#
# Assumed arguments:
-# $1 is test "variation"
+# $1 is test "variation" (a single letter, normally)
# $2 is group within source file
# $3 is group within destination file
-SIMPLETEST()
+COPYOBJECTS()
{
TESTFILE=$srcdir/../testfiles/$SRCFILE
FILEOUT="../testfiles/`basename $SRCFILE .h5`.$1.out.h5"
@@ -179,6 +179,7 @@ SIMPLETEST()
# Remove any output file left over from previous test run
rm -f $FILEOUT
+ # Test copying various forms of datasets
TOOLTEST -i $TESTFILE -o $FILEOUT -v -s "$2"simple -d "$3"simple
TOOLTEST -i $TESTFILE -o $FILEOUT -v -s "$2"chunk -d "$3"chunk
TOOLTEST -i $TESTFILE -o $FILEOUT -v -s "$2"compact -d "$3"compact
@@ -187,6 +188,16 @@ SIMPLETEST()
TOOLTEST -i $TESTFILE -o $FILEOUT -v -s "$2"named_vl -d "$3"named_vl
TOOLTEST -i $TESTFILE -o $FILEOUT -v -s "$2"nested_vl -d "$3"nested_vl
+ # Test copying & renaming dataset
+ TOOLTEST -i $TESTFILE -o $FILEOUT -v -s "$2"compound -d "$3"rename
+
+ # Test copying empty & "full" groups
+ TOOLTEST -i $TESTFILE -o $FILEOUT -v -s "$2"grp_empty -d "$3"grp_empty
+ TOOLTEST -i $TESTFILE -o $FILEOUT -v -s "$2"grp_dsets -d "$3"grp_dsets
+
+ # Test copying & renaming group
+ TOOLTEST -i $TESTFILE -o $FILEOUT -v -s "$2"grp_dsets -d "$3"grp_rename
+
# Verify that the file created above is correct
H5LSTEST $FILEOUT
@@ -201,7 +212,13 @@ SIMPLETEST()
### T H E T E S T S ###
##############################################################################
-SIMPLETEST a "" ""
+# Copy objects from root group of source file to root of destination file
+# (with implicit root group paths)
+COPYOBJECTS a "" ""
+
+# Copy objects from root group of source file to root of destination file
+# (with explicit root group paths)
+COPYOBJECTS b "/" "/"
if test $nerrors -eq 0 ; then
diff --git a/tools/testfiles/h5copytst.a.out.ls b/tools/testfiles/h5copytst.a.out.ls
index 90b5dba..73c67d6 100644
--- a/tools/testfiles/h5copytst.a.out.ls
+++ b/tools/testfiles/h5copytst.a.out.ls
@@ -5,20 +5,20 @@ Opened "../testfiles/h5copytst.a.out.h5" with sec2 driver.
/chunk Dataset {6/6}
Location: 1:6216
Links: 1
- Modified: 2006-10-17 15:55:17 CDT
+ Modified: 2007-02-13 18:36:15 CST
Chunks: {2} 8 bytes
Storage: 24 logical bytes, 24 allocated bytes, 100.00% utilization
Type: native int
/compact Dataset {6/6}
Location: 1:6344
Links: 1
- Modified: 2006-10-17 15:55:17 CDT
+ Modified: 2007-02-13 18:36:15 CST
Storage: 24 logical bytes, 24 allocated bytes, 100.00% utilization
Type: native int
/compound Dataset {2/2}
Location: 1:8528
Links: 1
- Modified: 2006-10-17 15:55:17 CDT
+ Modified: 2007-02-13 18:36:15 CST
Storage: 80 logical bytes, 80 allocated bytes, 100.00% utilization
Type: struct {
"str1" +0 20-byte null-terminated ASCII string
@@ -27,29 +27,159 @@ Opened "../testfiles/h5copytst.a.out.h5" with sec2 driver.
/compressed Dataset {6/6}
Location: 1:12888
Links: 1
- Modified: 2006-10-17 15:55:17 CDT
+ Modified: 2007-02-13 18:36:15 CST
Chunks: {2} 8 bytes
Storage: 24 logical bytes, 42 allocated bytes, 57.14% utilization
Filter-0: deflate-1 OPT {1}
Type: native int
+/grp_dsets Group
+ Location: 1:31584
+ Links: 1
+/grp_dsets/chunk Dataset {6/6}
+ Location: 1:33720
+ Links: 1
+ Modified: 2007-02-13 18:36:15 CST
+ Chunks: {2} 8 bytes
+ Storage: 24 logical bytes, 24 allocated bytes, 100.00% utilization
+ Type: native int
+/grp_dsets/compact Dataset {6/6}
+ Location: 1:34176
+ Links: 1
+ Modified: 2007-02-13 18:36:15 CST
+ Storage: 24 logical bytes, 24 allocated bytes, 100.00% utilization
+ Type: native int
+/grp_dsets/compound Dataset {2/2}
+ Location: 1:34312
+ Links: 1
+ Modified: 2007-02-13 18:36:15 CST
+ Storage: 80 logical bytes, 80 allocated bytes, 100.00% utilization
+ 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:34528
+ Links: 1
+ Modified: 2007-02-13 18:36:15 CST
+ Chunks: {2} 8 bytes
+ Storage: 24 logical bytes, 42 allocated bytes, 57.14% utilization
+ Filter-0: deflate-1 OPT {1}
+ Type: native int
+/grp_dsets/named_vl Dataset {2/2}
+ Location: 1:34744
+ Links: 1
+ Modified: 2007-02-13 18:36:15 CST
+ Storage: 16 logical bytes, 32 allocated bytes, 50.00% utilization
+ Type: shared-1:34696 variable length of
+ native int
+/grp_dsets/nested_vl Dataset {2/2}
+ Location: 1:43216
+ Links: 1
+ Modified: 2007-02-13 18:36:15 CST
+ Storage: 16 logical bytes, 32 allocated bytes, 50.00% utilization
+ Type: variable length of
+ variable length of
+ native int
+/grp_dsets/simple Dataset {6/6}
+ Location: 1:43360
+ Links: 1
+ Modified: 2007-02-13 18:36:15 CST
+ Storage: 24 logical bytes, 24 allocated bytes, 100.00% utilization
+ Type: native int
+/grp_dsets/vl Type
+ Location: 1:34696
+ Links: 2
+ Type: shared-1:34696 variable length of
+ native int
+/grp_empty Group
+ Location: 1:30464
+ Links: 1
+/grp_rename Group
+ Location: 1:44240
+ Links: 1
+/grp_rename/chunk Dataset {6/6}
+ Location: 1:46376
+ Links: 1
+ Modified: 2007-02-13 18:36:15 CST
+ Chunks: {2} 8 bytes
+ Storage: 24 logical bytes, 24 allocated bytes, 100.00% utilization
+ Type: native int
+/grp_rename/compact Dataset {6/6}
+ Location: 1:46832
+ Links: 1
+ Modified: 2007-02-13 18:36:15 CST
+ Storage: 24 logical bytes, 24 allocated bytes, 100.00% utilization
+ Type: native int
+/grp_rename/compound Dataset {2/2}
+ Location: 1:46968
+ Links: 1
+ Modified: 2007-02-13 18:36:15 CST
+ Storage: 80 logical bytes, 80 allocated bytes, 100.00% utilization
+ 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:47184
+ Links: 1
+ Modified: 2007-02-13 18:36:15 CST
+ Chunks: {2} 8 bytes
+ Storage: 24 logical bytes, 42 allocated bytes, 57.14% utilization
+ Filter-0: deflate-1 OPT {1}
+ Type: native int
+/grp_rename/named_vl Dataset {2/2}
+ Location: 1:47400
+ Links: 1
+ Modified: 2007-02-13 18:36:15 CST
+ Storage: 16 logical bytes, 32 allocated bytes, 50.00% utilization
+ Type: shared-1:47352 variable length of
+ native int
+/grp_rename/nested_vl Dataset {2/2}
+ Location: 1:55872
+ Links: 1
+ Modified: 2007-02-13 18:36:15 CST
+ Storage: 16 logical bytes, 32 allocated bytes, 50.00% utilization
+ Type: variable length of
+ variable length of
+ native int
+/grp_rename/simple Dataset {6/6}
+ Location: 1:56016
+ Links: 1
+ Modified: 2007-02-13 18:36:15 CST
+ Storage: 24 logical bytes, 24 allocated bytes, 100.00% utilization
+ Type: native int
+/grp_rename/vl Type
+ Location: 1:47352
+ Links: 2
+ Type: shared-1:47352 variable length of
+ native int
/named_vl Dataset {2/2}
Location: 1:13104
Links: 1
- Modified: 2006-10-17 15:55:17 CDT
+ Modified: 2007-02-13 18:36:15 CST
Storage: 16 logical bytes, 32 allocated bytes, 50.00% utilization
Type: shared-1:13056 variable length of
native int
/nested_vl Dataset {2/2}
Location: 1:27392
Links: 1
- Modified: 2006-10-17 15:55:17 CDT
+ Modified: 2007-02-13 18:36:15 CST
Storage: 16 logical bytes, 32 allocated bytes, 50.00% utilization
Type: variable length of
variable length of
native int
+/rename Dataset {2/2}
+ Location: 1:29584
+ Links: 1
+ Modified: 2007-02-13 18:36:15 CST
+ Storage: 80 logical bytes, 80 allocated bytes, 100.00% utilization
+ 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:808
Links: 1
- Modified: 2006-10-17 15:55:17 CDT
+ Modified: 2007-02-13 18:36:15 CST
Storage: 24 logical bytes, 24 allocated bytes, 100.00% utilization
Type: native int
diff --git a/tools/testfiles/h5copytst.b.out.ls b/tools/testfiles/h5copytst.b.out.ls
new file mode 100644
index 0000000..df18eac
--- /dev/null
+++ b/tools/testfiles/h5copytst.b.out.ls
@@ -0,0 +1,185 @@
+#############################
+Expected output for 'h5ls ../testfiles/h5copytst.b.out.h5'
+#############################
+Opened "../testfiles/h5copytst.b.out.h5" with sec2 driver.
+/chunk Dataset {6/6}
+ Location: 1:6216
+ Links: 1
+ Modified: 2007-02-13 18:36:15 CST
+ Chunks: {2} 8 bytes
+ Storage: 24 logical bytes, 24 allocated bytes, 100.00% utilization
+ Type: native int
+/compact Dataset {6/6}
+ Location: 1:6344
+ Links: 1
+ Modified: 2007-02-13 18:36:15 CST
+ Storage: 24 logical bytes, 24 allocated bytes, 100.00% utilization
+ Type: native int
+/compound Dataset {2/2}
+ Location: 1:8528
+ Links: 1
+ Modified: 2007-02-13 18:36:15 CST
+ Storage: 80 logical bytes, 80 allocated bytes, 100.00% utilization
+ 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:12888
+ Links: 1
+ Modified: 2007-02-13 18:36:15 CST
+ Chunks: {2} 8 bytes
+ Storage: 24 logical bytes, 42 allocated bytes, 57.14% utilization
+ Filter-0: deflate-1 OPT {1}
+ Type: native int
+/grp_dsets Group
+ Location: 1:31584
+ Links: 1
+/grp_dsets/chunk Dataset {6/6}
+ Location: 1:33720
+ Links: 1
+ Modified: 2007-02-13 18:36:15 CST
+ Chunks: {2} 8 bytes
+ Storage: 24 logical bytes, 24 allocated bytes, 100.00% utilization
+ Type: native int
+/grp_dsets/compact Dataset {6/6}
+ Location: 1:34176
+ Links: 1
+ Modified: 2007-02-13 18:36:15 CST
+ Storage: 24 logical bytes, 24 allocated bytes, 100.00% utilization
+ Type: native int
+/grp_dsets/compound Dataset {2/2}
+ Location: 1:34312
+ Links: 1
+ Modified: 2007-02-13 18:36:15 CST
+ Storage: 80 logical bytes, 80 allocated bytes, 100.00% utilization
+ 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:34528
+ Links: 1
+ Modified: 2007-02-13 18:36:15 CST
+ Chunks: {2} 8 bytes
+ Storage: 24 logical bytes, 42 allocated bytes, 57.14% utilization
+ Filter-0: deflate-1 OPT {1}
+ Type: native int
+/grp_dsets/named_vl Dataset {2/2}
+ Location: 1:34744
+ Links: 1
+ Modified: 2007-02-13 18:36:15 CST
+ Storage: 16 logical bytes, 32 allocated bytes, 50.00% utilization
+ Type: shared-1:34696 variable length of
+ native int
+/grp_dsets/nested_vl Dataset {2/2}
+ Location: 1:43216
+ Links: 1
+ Modified: 2007-02-13 18:36:15 CST
+ Storage: 16 logical bytes, 32 allocated bytes, 50.00% utilization
+ Type: variable length of
+ variable length of
+ native int
+/grp_dsets/simple Dataset {6/6}
+ Location: 1:43360
+ Links: 1
+ Modified: 2007-02-13 18:36:15 CST
+ Storage: 24 logical bytes, 24 allocated bytes, 100.00% utilization
+ Type: native int
+/grp_dsets/vl Type
+ Location: 1:34696
+ Links: 2
+ Type: shared-1:34696 variable length of
+ native int
+/grp_empty Group
+ Location: 1:30464
+ Links: 1
+/grp_rename Group
+ Location: 1:44240
+ Links: 1
+/grp_rename/chunk Dataset {6/6}
+ Location: 1:46376
+ Links: 1
+ Modified: 2007-02-13 18:36:15 CST
+ Chunks: {2} 8 bytes
+ Storage: 24 logical bytes, 24 allocated bytes, 100.00% utilization
+ Type: native int
+/grp_rename/compact Dataset {6/6}
+ Location: 1:46832
+ Links: 1
+ Modified: 2007-02-13 18:36:15 CST
+ Storage: 24 logical bytes, 24 allocated bytes, 100.00% utilization
+ Type: native int
+/grp_rename/compound Dataset {2/2}
+ Location: 1:46968
+ Links: 1
+ Modified: 2007-02-13 18:36:15 CST
+ Storage: 80 logical bytes, 80 allocated bytes, 100.00% utilization
+ 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:47184
+ Links: 1
+ Modified: 2007-02-13 18:36:15 CST
+ Chunks: {2} 8 bytes
+ Storage: 24 logical bytes, 42 allocated bytes, 57.14% utilization
+ Filter-0: deflate-1 OPT {1}
+ Type: native int
+/grp_rename/named_vl Dataset {2/2}
+ Location: 1:47400
+ Links: 1
+ Modified: 2007-02-13 18:36:15 CST
+ Storage: 16 logical bytes, 32 allocated bytes, 50.00% utilization
+ Type: shared-1:47352 variable length of
+ native int
+/grp_rename/nested_vl Dataset {2/2}
+ Location: 1:55872
+ Links: 1
+ Modified: 2007-02-13 18:36:15 CST
+ Storage: 16 logical bytes, 32 allocated bytes, 50.00% utilization
+ Type: variable length of
+ variable length of
+ native int
+/grp_rename/simple Dataset {6/6}
+ Location: 1:56016
+ Links: 1
+ Modified: 2007-02-13 18:36:15 CST
+ Storage: 24 logical bytes, 24 allocated bytes, 100.00% utilization
+ Type: native int
+/grp_rename/vl Type
+ Location: 1:47352
+ Links: 2
+ Type: shared-1:47352 variable length of
+ native int
+/named_vl Dataset {2/2}
+ Location: 1:13104
+ Links: 1
+ Modified: 2007-02-13 18:36:15 CST
+ Storage: 16 logical bytes, 32 allocated bytes, 50.00% utilization
+ Type: shared-1:13056 variable length of
+ native int
+/nested_vl Dataset {2/2}
+ Location: 1:27392
+ Links: 1
+ Modified: 2007-02-13 18:36:15 CST
+ Storage: 16 logical bytes, 32 allocated bytes, 50.00% utilization
+ Type: variable length of
+ variable length of
+ native int
+/rename Dataset {2/2}
+ Location: 1:29584
+ Links: 1
+ Modified: 2007-02-13 18:36:15 CST
+ Storage: 80 logical bytes, 80 allocated bytes, 100.00% utilization
+ 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:808
+ Links: 1
+ Modified: 2007-02-13 18:36:15 CST
+ Storage: 24 logical bytes, 24 allocated bytes, 100.00% utilization
+ Type: native int
diff --git a/tools/testfiles/h5copytst.h5 b/tools/testfiles/h5copytst.h5
index b0a04df..09f2bb9 100644
--- a/tools/testfiles/h5copytst.h5
+++ b/tools/testfiles/h5copytst.h5
Binary files differ