summaryrefslogtreecommitdiffstats
path: root/test/lheap.c
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2010-07-16 16:32:49 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2010-07-16 16:32:49 (GMT)
commitc22b8a94f2b6920e03f8390415269f9333eeb077 (patch)
tree44da189a5048fd7a9de087049e4f80119e0451ab /test/lheap.c
parent0dce71a0a30314da545f1f90a26f537c467b043a (diff)
downloadhdf5-c22b8a94f2b6920e03f8390415269f9333eeb077.zip
hdf5-c22b8a94f2b6920e03f8390415269f9333eeb077.tar.gz
hdf5-c22b8a94f2b6920e03f8390415269f9333eeb077.tar.bz2
[svn-r19076] Purpose: Fix bug 1951
Description: A bug introduced in 1.8.5 causes local heap data blocks to be mis-aligned when sizeof_offsets + 2*sizeof_lengths is not a multiple of 8. In this case, the address of the data block as stored in the heap prefix is aligned but the actual data block is not. This causes files created with these sizes to be corrupted, and prevents uncorrupted files with these sizes to be unreadable. Modified local heap code to account for alignment. Tested: jam, amani, linew (h5committest)
Diffstat (limited to 'test/lheap.c')
-rw-r--r--test/lheap.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/lheap.c b/test/lheap.c
index 1d98fc4..9f78a15 100644
--- a/test/lheap.c
+++ b/test/lheap.c
@@ -20,6 +20,7 @@
* Purpose: Test local heaps used by symbol tables (groups).
*/
#include "h5test.h"
+#include "H5srcdir.h"
#include "H5ACprivate.h"
#include "H5HLprivate.h"
#include "H5Iprivate.h"
@@ -29,6 +30,8 @@ const char *FILENAME[] = {
NULL
};
+#define TESTFILE "tsizeslheap.h5"
+
#define NOBJS 40
@@ -170,6 +173,29 @@ main(void)
if (H5Fclose(file)<0) goto error;
PASSED();
+
+ /* Check opening existing file non-default sizes of lengths and addresses */
+ TESTING("opening pre-created file with non-default sizes");
+ {
+ const char *testfile = H5_get_srcdir_filename(TESTFILE); /* Corrected test file name */
+ hid_t dset = -1;
+
+ file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT);
+ if(file >= 0){
+ if((dset = H5Dopen2(file, "/Dataset1", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if(H5Dclose(dset) < 0) TEST_ERROR
+ if(H5Fclose(file) < 0) TEST_ERROR
+ }
+ else {
+ H5_FAILED();
+ printf("***cannot open the pre-created non-default sizes test file (%s)\n",
+ testfile);
+ goto error;
+ } /* end else */
+ }
+ PASSED();
+
puts("All local heap tests passed.");
h5_cleanup(FILENAME, fapl);