summaryrefslogtreecommitdiffstats
path: root/tools/h5dump/h5dumpgentest.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2005-04-21 06:55:42 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2005-04-21 06:55:42 (GMT)
commit0cf3f85ccec2776e4e6276cbc3b1b72f21536e0b (patch)
tree8e4ad75b45bddd06f1274abc9ceebfa3b1570e28 /tools/h5dump/h5dumpgentest.c
parent31fb2d13de02c9e7139abdb5f346a3f0b9f472e3 (diff)
downloadhdf5-0cf3f85ccec2776e4e6276cbc3b1b72f21536e0b.zip
hdf5-0cf3f85ccec2776e4e6276cbc3b1b72f21536e0b.tar.gz
hdf5-0cf3f85ccec2776e4e6276cbc3b1b72f21536e0b.tar.bz2
[svn-r10637] Purpose:
Bug fix/code cleanup Description: Add tests to determine that very long (64K+) object names are working. Fixed a couple of bugs in h5dump where they weren't... Platforms tested: FreeBSD 4.11 (sleipnir) Solaris 2.9 (shanti)
Diffstat (limited to 'tools/h5dump/h5dumpgentest.c')
-rw-r--r--tools/h5dump/h5dumpgentest.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c
index b01d87a..ab3b69e 100644
--- a/tools/h5dump/h5dumpgentest.c
+++ b/tools/h5dump/h5dumpgentest.c
@@ -77,6 +77,7 @@
#define FILE48 "tfvalues.h5"
#define FILE49 "tstr3.h5"
#define FILE50 "taindices.h5"
+#define FILE51 "tlonglinks.h5"
@@ -195,6 +196,9 @@ typedef struct s1_t {
/* Name of dataset to create in datafile */
#define F43_DSETNAME "Dataset"
+/* "File 51" macros */
+#define F51_MAX_NAME_LEN ((64*1024)+1024)
+
static void gent_group(void)
{
hid_t fid, group;
@@ -5310,6 +5314,56 @@ static void gent_aindices(void)
assert(ret>=0);
}
+/*-------------------------------------------------------------------------
+ * Function: gent_longlinks
+ *
+ * Purpose: make file with very long names for objects
+ *
+ *-------------------------------------------------------------------------
+ */
+static void gent_longlinks(void)
+{
+ hid_t fid = (-1); /* File ID */
+ hid_t gid = (-1); /* Group ID */
+ hid_t gid2 = (-1); /* Datatype ID */
+ char *objname = NULL; /* Name of object [Long] */
+ size_t u; /* Local index variable */
+
+ /* Create files */
+ fid = H5Fcreate(FILE51, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ assert(fid >= 0);
+
+ /* Create group with short name in file (used as target for hard links) */
+ gid=H5Gcreate(fid, "grp1", (size_t)0);
+ assert(gid >= 0);
+
+ /* Construct very long file name */
+ objname = HDmalloc((size_t)(F51_MAX_NAME_LEN + 1));
+ assert(objname);
+ for(u = 0; u < F51_MAX_NAME_LEN; u++)
+ objname[u] = 'a';
+ objname[F51_MAX_NAME_LEN] = '\0';
+
+ /* Create hard link to existing object */
+ assert(H5Glink2(fid, "grp1", H5G_LINK_HARD, fid, objname) >= 0);
+
+ /* Create soft link to existing object */
+ objname[0] = 'b';
+ assert(H5Glink2(fid, "grp1", H5G_LINK_SOFT, fid, objname) >= 0);
+
+ /* Create group with long name in existing group */
+ gid2=H5Gcreate(gid, objname, (size_t)0);
+ assert(gid2 >= 0);
+
+ /* Close objects */
+ assert(H5Gclose(gid2) >= 0);
+ assert(H5Gclose(gid) >= 0);
+ assert(H5Fclose(fid) >= 0);
+
+ /* Release memory */
+ HDfree(objname);
+}
+
/*-------------------------------------------------------------------------
* Function: main
@@ -5369,6 +5423,7 @@ int main(void)
gent_fcontents();
gent_string();
gent_aindices();
+ gent_longlinks();
return 0;
}