diff options
author | Patrick Lu <ptlu@hawkwind.ncsa.uiuc.edu> | 2000-05-09 14:57:18 (GMT) |
---|---|---|
committer | Patrick Lu <ptlu@hawkwind.ncsa.uiuc.edu> | 2000-05-09 14:57:18 (GMT) |
commit | 18f506c63621b16271c687dfea028323c074f22d (patch) | |
tree | 368d2a9fcfb3c33025950e4c3b062b8afe5cd83c | |
parent | 1d12b5b4bcbd159ee9f947dca87ce82bea2e1407 (diff) | |
download | hdf5-18f506c63621b16271c687dfea028323c074f22d.zip hdf5-18f506c63621b16271c687dfea028323c074f22d.tar.gz hdf5-18f506c63621b16271c687dfea028323c074f22d.tar.bz2 |
[svn-r2224] this is the dev version of the external test. fixes a problem on win98
where it is reading garbage in the part of the file that is not written to.
-rw-r--r-- | test/external.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/test/external.c b/test/external.c index 7e07554..6ccc8b0 100644 --- a/test/external.c +++ b/test/external.c @@ -582,6 +582,7 @@ test_2 (hid_t fapl) hid_t hs_space; /*hyperslab data space */ hssize_t hs_start = 30; /*hyperslab starting offset */ hsize_t hs_count = 25; /*hyperslab size */ + int temparray[10] = {0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f}; TESTING("read external dataset"); @@ -593,7 +594,9 @@ test_2 (hid_t fapl) sprintf (filename, "extern_%lua.raw", (unsigned long)i+1); fd = HDopen (filename, O_RDWR|O_CREAT|O_TRUNC, 0666); assert (fd>=0); - n = lseek (fd, (off_t)(i*10), SEEK_SET); +/* n = lseek (fd, (off_t)(i*10), SEEK_SET); +*/ + n = write(fd,temparray,i*10); assert (n>=0 && (size_t)n==i*10); n = write (fd, part, sizeof(part)); assert (n==sizeof(part)); @@ -606,8 +609,9 @@ test_2 (hid_t fapl) * output looks like. */ h5_fixname(FILENAME[1], fapl, filename, sizeof filename); - if ((file=H5Fcreate(filename, H5F_ACC_TRUNC|H5F_ACC_DEBUG, - H5P_DEFAULT, fapl))<0) goto error; + if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) { + goto error; + } if ((grp=H5Gcreate(file, "emit-diagnostics", 8))<0) goto error; if (H5Gclose(grp)<0) goto error; @@ -705,13 +709,15 @@ test_3 (hid_t fapl) hssize_t hs_start=100; /*hyperslab starting offset */ hsize_t hs_count=100; /*hyperslab size */ char filename[1024]; /*file name */ + int temparray[10] = {0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f}; TESTING("write external dataset"); /* Create another file */ h5_fixname(FILENAME[2], fapl, filename, sizeof filename); - if ((file=H5Fcreate(filename, H5F_ACC_TRUNC|H5F_ACC_DEBUG, H5P_DEFAULT, - fapl))<0) goto error; + if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) { + goto error; + } /* Create the external file list */ if ((dcpl=H5Pcreate(H5P_DATASET_CREATE))<0) goto error; @@ -729,6 +735,8 @@ test_3 (hid_t fapl) printf(" cannot open %s: %s\n", filename, strerror(errno)); goto error; } + + write(fd, temparray, (i-1)*10); close (fd); } @@ -814,8 +822,9 @@ main (void) h5_reset(); fapl = h5_fileaccess(); h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if ((file=H5Fcreate(filename, H5F_ACC_TRUNC|H5F_ACC_DEBUG, H5P_DEFAULT, - fapl))<0) goto error; + if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) { + goto error; + } if ((grp=H5Gcreate(file, "emit-diagnostics", 8))<0) goto error; if (H5Gclose (grp)<0) goto error; |