mirror of
https://github.com/HDFGroup/hdf5.git
synced 2024-11-27 02:10:55 +08:00
[svn-r5006] Purpose:
Test Addition Description: Added tests to the h5dumper for split and family file drivers. Platforms tested: Linux
This commit is contained in:
parent
bf543b4edb
commit
4263340afa
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
23
tools/testfiles/tfamily.ddl
Normal file
23
tools/testfiles/tfamily.ddl
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
BIN
tools/testfiles/tfamily00000.h5
Normal file
BIN
tools/testfiles/tfamily00000.h5
Normal file
Binary file not shown.
BIN
tools/testfiles/tfamily00001.h5
Normal file
BIN
tools/testfiles/tfamily00001.h5
Normal file
Binary file not shown.
BIN
tools/testfiles/tfamily00002.h5
Normal file
BIN
tools/testfiles/tfamily00002.h5
Normal file
Binary file not shown.
BIN
tools/testfiles/tfamily00003.h5
Normal file
BIN
tools/testfiles/tfamily00003.h5
Normal file
Binary file not shown.
BIN
tools/testfiles/tfamily00004.h5
Normal file
BIN
tools/testfiles/tfamily00004.h5
Normal file
Binary file not shown.
BIN
tools/testfiles/tfamily00005.h5
Normal file
BIN
tools/testfiles/tfamily00005.h5
Normal file
Binary file not shown.
BIN
tools/testfiles/tfamily00006.h5
Normal file
BIN
tools/testfiles/tfamily00006.h5
Normal file
Binary file not shown.
BIN
tools/testfiles/tfamily00007.h5
Normal file
BIN
tools/testfiles/tfamily00007.h5
Normal file
Binary file not shown.
BIN
tools/testfiles/tfamily00008.h5
Normal file
BIN
tools/testfiles/tfamily00008.h5
Normal file
Binary file not shown.
BIN
tools/testfiles/tfamily00009.h5
Normal file
BIN
tools/testfiles/tfamily00009.h5
Normal file
Binary file not shown.
BIN
tools/testfiles/tfamily00010.h5
Normal file
BIN
tools/testfiles/tfamily00010.h5
Normal file
Binary file not shown.
BIN
tools/testfiles/tsplit_file-m.h5
Normal file
BIN
tools/testfiles/tsplit_file-m.h5
Normal file
Binary file not shown.
BIN
tools/testfiles/tsplit_file-r.h5
Normal file
BIN
tools/testfiles/tsplit_file-r.h5
Normal file
Binary file not shown.
35
tools/testfiles/tsplit_file.ddl
Normal file
35
tools/testfiles/tsplit_file.ddl
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user