summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2003-01-21 20:20:13 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2003-01-21 20:20:13 (GMT)
commit127dc2f80db940c9bd7b69bedf7383ad55ed8d81 (patch)
tree19834c9f8bf8288ddaa943b7bb79cbeaddd36fea /test
parentba63879ea20145e9778c4ba2c7d9ec8134f1b7d0 (diff)
downloadhdf5-127dc2f80db940c9bd7b69bedf7383ad55ed8d81.zip
hdf5-127dc2f80db940c9bd7b69bedf7383ad55ed8d81.tar.gz
hdf5-127dc2f80db940c9bd7b69bedf7383ad55ed8d81.tar.bz2
[svn-r6308] Purpose:
Bug fix Description: Currently, when the library encounters an object header message that isn't know, it fails to open that object in the file. Solution: Allow the library to skip over the unknown object header message and continue to process the remaining messages, in the hope that the skipped message isn't important later. If it is important, it will be caught at a higher level of the library. Platforms tested: FreeBSD 4.7 (sleipnir)
Diffstat (limited to 'test')
-rw-r--r--test/ohdr.c31
-rw-r--r--test/tbogus.h5bin0 -> 2052 bytes
2 files changed, 31 insertions, 0 deletions
diff --git a/test/ohdr.c b/test/ohdr.c
index ddd4ed6..3884e1a 100644
--- a/test/ohdr.c
+++ b/test/ohdr.c
@@ -20,6 +20,11 @@ const char *FILENAME[] = {
NULL
};
+/* The tbogus.h5 is generated from gen_bogus.c in HDF5 'test' directory.
+ * To get this data file, define H5O_ENABLE_BOGUS in src/H5Oprivate, rebuild
+ * the library and simply compile gen_bogus.c with that HDF5 library and run it. */
+#define FILE_BOGUS "tbogus.h5"
+
/*-------------------------------------------------------------------------
* Function: main
@@ -41,6 +46,7 @@ int
main(void)
{
hid_t fapl=-1, file=-1;
+ hid_t dset=-1;
H5F_t *f=NULL;
char filename[1024];
H5G_entry_t oh_ent;
@@ -267,6 +273,31 @@ main(void)
if (H5Fclose(file)<0) goto error;
PASSED();
+ /* Test reading dataset with undefined object header message */
+ TESTING("reading object with unknown header message");
+ {
+ char testfile[512]="";
+ char *srcdir = getenv("srcdir");
+
+ /* Build path to test file */
+ if (srcdir && ((HDstrlen(srcdir) + HDstrlen(FILE_BOGUS) + 1) < sizeof(testfile))){
+ HDstrcpy(testfile, srcdir);
+ HDstrcat(testfile, "/");
+ }
+ HDstrcat(testfile, FILE_BOGUS);
+
+ if ((file=H5Fopen(testfile, H5F_ACC_RDONLY, fapl))<0)
+ goto error;
+
+ /* Open the dataset with the unknown header message (generated with gen_bogus.c) */
+ if((dset=H5Dopen(file,"/Dataset1"))<0)
+ goto error;
+ if (H5Dclose(dset)<0) goto error;
+
+ if (H5Fclose(file)<0) goto error;
+ }
+ PASSED();
+
puts("All object header tests passed.");
h5_cleanup(FILENAME, fapl);
return 0;
diff --git a/test/tbogus.h5 b/test/tbogus.h5
new file mode 100644
index 0000000..ddc3b65
--- /dev/null
+++ b/test/tbogus.h5
Binary files differ