summaryrefslogtreecommitdiffstats
path: root/test/tarray.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2002-04-17 16:47:47 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2002-04-17 16:47:47 (GMT)
commitfa314a767ea91db101f8e36e97d89e7bb589bcf5 (patch)
treebfb90a313c5e86aa9dc73faccd9973489a7e0675 /test/tarray.c
parentee56e5272c4151a4a41cae16b46b97e817071548 (diff)
downloadhdf5-fa314a767ea91db101f8e36e97d89e7bb589bcf5.zip
hdf5-fa314a767ea91db101f8e36e97d89e7bb589bcf5.tar.gz
hdf5-fa314a767ea91db101f8e36e97d89e7bb589bcf5.tar.bz2
[svn-r5191] Purpose:
Bug fix Description: When several level deep nested compound & VL datatypes are used, the data in the nested compound datatypes is incorrectly sharing the same "background buffer", causing data corruption when the data is written to the file. Solution: Allocate a separate background buffer for each level of the nested types to convert. (Also allocate temporary background buffers for array datatypes, where this sort of problem could occur also) Added more regression tests to check for these errors. Platforms tested: FreeBSD 4.5 (sleipnir) & Solaris 2.6 (baldric)
Diffstat (limited to 'test/tarray.c')
-rw-r--r--test/tarray.c39
1 files changed, 36 insertions, 3 deletions
diff --git a/test/tarray.c b/test/tarray.c
index 6b5e556..05bc8e0 100644
--- a/test/tarray.c
+++ b/test/tarray.c
@@ -1684,6 +1684,7 @@ test_array_bkg(void)
status = H5Dwrite (dataset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, fld);
CHECK(status, FAIL, "H5Dwrite");
+ /* Read just the field changed */
status = H5Dread (dataset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, fldr);
CHECK(status, FAIL, "H5Dread");
@@ -1695,15 +1696,47 @@ test_array_bkg(void)
continue;
}
- status = H5Dclose(dataset);
- CHECK(status, FAIL, "H5Dclose");
-
status = H5Tclose (type);
CHECK(status, FAIL, "H5Tclose");
status = H5Tclose (array_dt);
CHECK(status, FAIL, "H5Tclose");
+ type = H5Dget_type(dataset);
+ CHECK(type, FAIL, "H5Dget_type");
+
+ /* Read the entire dataset again */
+ status = H5Dread(dataset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, cfr);
+ CHECK(status, FAIL, "H5Dread");
+
+ /* Verify correct data */
+ /* ------------------- */
+ for (i = 0; i < LENGTH; i++) {
+ for (j = 0; j < ALEN; j++) {
+ if(cf[i].a[j]!=cfr[i].a[j]) {
+ num_errs++;
+ printf("Field a data doesn't match, cf[%d].a[%d]=%d, cfr[%d].a[%d]=%d\n",(int)i,(int)j,(int)cf[i].a[j],(int)i,(int)j,(int)cfr[i].a[j]);
+ continue;
+ }
+ if(cf[i].b[j]!=cfr[i].b[j]) {
+ num_errs++;
+ printf("Field b data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(float)cf[i].b[j],(int)i,(int)j,(float)cfr[i].b[j]);
+ continue;
+ }
+ if(cf[i].c[j]!=cfr[i].c[j]) {
+ num_errs++;
+ printf("Field c data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(float)cf[i].c[j],(int)i,(int)j,(float)cfr[i].c[j]);
+ continue;
+ }
+ }
+ }
+
+ status = H5Dclose(dataset);
+ CHECK(status, FAIL, "H5Dclose");
+
+ status = H5Tclose (type);
+ CHECK(status, FAIL, "H5Tclose");
+
status = H5Fclose(fid);
CHECK(status, FAIL, "H5Fclose");