From 4263340afa72cd23454fbddd5913531f84d44473 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Mon, 25 Feb 2002 17:38:47 -0500 Subject: [svn-r5006] Purpose: Test Addition Description: Added tests to the h5dumper for split and family file drivers. Platforms tested: Linux --- tools/h5dump/h5dumptst.c | 78 +++++++++++++++++++++++++++++++++++++++ tools/h5dump/testh5dump.sh | 4 ++ tools/testfiles/tfamily.ddl | 23 ++++++++++++ tools/testfiles/tfamily00000.h5 | Bin 0 -> 256 bytes tools/testfiles/tfamily00001.h5 | Bin 0 -> 256 bytes tools/testfiles/tfamily00002.h5 | Bin 0 -> 256 bytes tools/testfiles/tfamily00003.h5 | Bin 0 -> 256 bytes tools/testfiles/tfamily00004.h5 | Bin 0 -> 256 bytes tools/testfiles/tfamily00005.h5 | Bin 0 -> 256 bytes tools/testfiles/tfamily00006.h5 | Bin 0 -> 256 bytes tools/testfiles/tfamily00007.h5 | Bin 0 -> 256 bytes tools/testfiles/tfamily00008.h5 | Bin 0 -> 256 bytes tools/testfiles/tfamily00009.h5 | Bin 0 -> 256 bytes tools/testfiles/tfamily00010.h5 | Bin 0 -> 88 bytes tools/testfiles/tsplit_file-m.h5 | Bin 0 -> 2048 bytes tools/testfiles/tsplit_file-r.h5 | Bin 0 -> 600 bytes tools/testfiles/tsplit_file.ddl | 35 ++++++++++++++++++ 17 files changed, 140 insertions(+) create mode 100644 tools/testfiles/tfamily.ddl create mode 100644 tools/testfiles/tfamily00000.h5 create mode 100644 tools/testfiles/tfamily00001.h5 create mode 100644 tools/testfiles/tfamily00002.h5 create mode 100644 tools/testfiles/tfamily00003.h5 create mode 100644 tools/testfiles/tfamily00004.h5 create mode 100644 tools/testfiles/tfamily00005.h5 create mode 100644 tools/testfiles/tfamily00006.h5 create mode 100644 tools/testfiles/tfamily00007.h5 create mode 100644 tools/testfiles/tfamily00008.h5 create mode 100644 tools/testfiles/tfamily00009.h5 create mode 100644 tools/testfiles/tfamily00010.h5 create mode 100644 tools/testfiles/tsplit_file-m.h5 create mode 100644 tools/testfiles/tsplit_file-r.h5 create mode 100644 tools/testfiles/tsplit_file.ddl diff --git a/tools/h5dump/h5dumptst.c b/tools/h5dump/h5dumptst.c index ac08c2f..0eff5d2 100644 --- a/tools/h5dump/h5dumptst.c +++ b/tools/h5dump/h5dumptst.c @@ -45,6 +45,8 @@ #define FILE31 "tarray7.h5" #define FILE32 "tempty.h5" #define FILE33 "tgrp_comments.h5" +#define FILE34 "tsplit_file" +#define FILE35 "tfamily%05d.h5" #define LENSTR 50 #define LENSTR2 11 @@ -2673,6 +2675,80 @@ static void test_group_comments(void) H5Fclose(fid); } +static +void test_split_file(void) +{ + hid_t fapl, fid, root, attr, space, dataset, atype; + char meta[] = "this is some metadata on this file"; + hsize_t dims[2]; + int i, j, dset[10][15]; + + fapl = H5Pcreate(H5P_FILE_ACCESS); + H5Pset_fapl_split(fapl, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT); + fid = H5Fcreate(FILE34, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + root = H5Gopen(fid, "/"); + + atype = H5Tcopy(H5T_C_S1); + H5Tset_size(atype, strlen(meta) + 1); + H5Tset_strpad(atype, H5T_STR_NULLTERM); + + dims[0] = 1; + space = H5Screate_simple(1, dims, NULL); + attr = H5Acreate(root, "Metadata", atype, space, H5P_DEFAULT); + H5Awrite(attr, atype, meta); + H5Tclose(atype); + H5Sclose(space); + H5Aclose(attr); + + /* create dataset */ + dims[0] = 10; + dims[1] = 15; + space = H5Screate_simple(2, dims, NULL); + dataset = H5Dcreate(fid, "/dset1", H5T_STD_I32BE, space, H5P_DEFAULT); + + for (i = 0; i < 10; i++) + for (j = 0; j < 15; j++) + dset[i][j] = i + j; + + H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset); + H5Sclose(space); + H5Dclose(dataset); + H5Gclose(root); + H5Fclose(fid); + H5Pclose(fapl); +} + +static +void test_family(void) +{ + hid_t fapl, fid, space, dataset; + hsize_t dims[2]; + int i, j, dset[10][15]; + +#define FAMILY_SIZE 256 + + fapl = H5Pcreate(H5P_FILE_ACCESS); + H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT); + + fid = H5Fcreate(FILE35, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + + /* create dataset */ + dims[0] = 10; + dims[1] = 15; + space = H5Screate_simple(2, dims, NULL); + dataset = H5Dcreate(fid, "/dset1", H5T_STD_I32BE, space, H5P_DEFAULT); + + for (i = 0; i < 10; i++) + for (j = 0; j < 15; j++) + dset[i][j] = i + j; + + H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset); + H5Sclose(space); + H5Dclose(dataset); + H5Fclose(fid); + H5Pclose(fapl); +} + int main(void) { test_group(); @@ -2718,6 +2794,8 @@ int main(void) test_empty(); test_group_comments(); + test_split_file(); + test_family(); return 0; } diff --git a/tools/h5dump/testh5dump.sh b/tools/h5dump/testh5dump.sh index 3c532ef..18f72d8 100755 --- a/tools/h5dump/testh5dump.sh +++ b/tools/h5dump/testh5dump.sh @@ -153,6 +153,10 @@ TOOLTEST tall-5s.ddl -d "/g1/g1.1/dset1.1.2[0;2;10;]" tall.h5 TOOLTEST tdset-3s.ddl -d "/dset1[1,1;;;]" tdset.h5 TOOLTEST tdset2-1s.ddl -d "/dset1[;3 2;4 4;1 4]" tdset2.h5 +# test the --filedriver flag +TOOLTEST tsplit_file.ddl --filedriver=split tsplit_file +TOOLTEST tfamily.ddl --filedriver=family tfamily%05d.h5 + # test XML TOOLTEST tall.h5.xml --xml tall.h5 TOOLTEST tattr.h5.xml --xml tattr.h5 diff --git a/tools/testfiles/tfamily.ddl b/tools/testfiles/tfamily.ddl new file mode 100644 index 0000000..1267e51 --- /dev/null +++ b/tools/testfiles/tfamily.ddl @@ -0,0 +1,23 @@ +############################# +Expected output for 'h5dump --filedriver=family tfamily%05d.h5' +############################# +HDF5 "tfamily%05d.h5" { +GROUP "/" { + DATASET "dset1" { + DATATYPE H5T_STD_I32BE + DATASPACE SIMPLE { ( 10, 15 ) / ( 10, 15 ) } + DATA { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 + } + } +} +} diff --git a/tools/testfiles/tfamily00000.h5 b/tools/testfiles/tfamily00000.h5 new file mode 100644 index 0000000..a130bfd Binary files /dev/null and b/tools/testfiles/tfamily00000.h5 differ diff --git a/tools/testfiles/tfamily00001.h5 b/tools/testfiles/tfamily00001.h5 new file mode 100644 index 0000000..83119d8 Binary files /dev/null and b/tools/testfiles/tfamily00001.h5 differ diff --git a/tools/testfiles/tfamily00002.h5 b/tools/testfiles/tfamily00002.h5 new file mode 100644 index 0000000..65f57c2 Binary files /dev/null and b/tools/testfiles/tfamily00002.h5 differ diff --git a/tools/testfiles/tfamily00003.h5 b/tools/testfiles/tfamily00003.h5 new file mode 100644 index 0000000..2917a8a Binary files /dev/null and b/tools/testfiles/tfamily00003.h5 differ diff --git a/tools/testfiles/tfamily00004.h5 b/tools/testfiles/tfamily00004.h5 new file mode 100644 index 0000000..a583474 Binary files /dev/null and b/tools/testfiles/tfamily00004.h5 differ diff --git a/tools/testfiles/tfamily00005.h5 b/tools/testfiles/tfamily00005.h5 new file mode 100644 index 0000000..65f57c2 Binary files /dev/null and b/tools/testfiles/tfamily00005.h5 differ diff --git a/tools/testfiles/tfamily00006.h5 b/tools/testfiles/tfamily00006.h5 new file mode 100644 index 0000000..65f57c2 Binary files /dev/null and b/tools/testfiles/tfamily00006.h5 differ diff --git a/tools/testfiles/tfamily00007.h5 b/tools/testfiles/tfamily00007.h5 new file mode 100644 index 0000000..65f57c2 Binary files /dev/null and b/tools/testfiles/tfamily00007.h5 differ diff --git a/tools/testfiles/tfamily00008.h5 b/tools/testfiles/tfamily00008.h5 new file mode 100644 index 0000000..fb35a9c Binary files /dev/null and b/tools/testfiles/tfamily00008.h5 differ diff --git a/tools/testfiles/tfamily00009.h5 b/tools/testfiles/tfamily00009.h5 new file mode 100644 index 0000000..fd2920a Binary files /dev/null and b/tools/testfiles/tfamily00009.h5 differ diff --git a/tools/testfiles/tfamily00010.h5 b/tools/testfiles/tfamily00010.h5 new file mode 100644 index 0000000..3bf308f Binary files /dev/null and b/tools/testfiles/tfamily00010.h5 differ diff --git a/tools/testfiles/tsplit_file-m.h5 b/tools/testfiles/tsplit_file-m.h5 new file mode 100644 index 0000000..09db115 Binary files /dev/null and b/tools/testfiles/tsplit_file-m.h5 differ diff --git a/tools/testfiles/tsplit_file-r.h5 b/tools/testfiles/tsplit_file-r.h5 new file mode 100644 index 0000000..eb08e79 Binary files /dev/null and b/tools/testfiles/tsplit_file-r.h5 differ diff --git a/tools/testfiles/tsplit_file.ddl b/tools/testfiles/tsplit_file.ddl new file mode 100644 index 0000000..b733181 --- /dev/null +++ b/tools/testfiles/tsplit_file.ddl @@ -0,0 +1,35 @@ +############################# +Expected output for 'h5dump --filedriver=split tsplit_file' +############################# +HDF5 "tsplit_file" { +GROUP "/" { + ATTRIBUTE "Metadata" { + DATATYPE H5T_STRING { + STRSIZE 35; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } + DATASPACE SIMPLE { ( 1 ) / ( 1 ) } + DATA { + "this is some metadata on this file" + } + } + DATASET "dset1" { + DATATYPE H5T_STD_I32BE + DATASPACE SIMPLE { ( 10, 15 ) / ( 10, 15 ) } + DATA { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 + } + } +} +} -- cgit v0.12