diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/.distdep | 141 | ||||
-rw-r--r-- | test/Makefile.in | 4 | ||||
-rw-r--r-- | test/gheap.c | 7 | ||||
-rw-r--r-- | test/istore.c | 4 | ||||
-rw-r--r-- | test/mtime.c | 28 | ||||
-rw-r--r-- | test/ragged.c | 31 |
6 files changed, 119 insertions, 96 deletions
diff --git a/test/.distdep b/test/.distdep index 217d2b7..b5d511d 100644 --- a/test/.distdep +++ b/test/.distdep @@ -178,34 +178,6 @@ th5s.o: \ ../src/H5Tpublic.h \ ../src/H5Zprivate.h \ ../src/H5Zpublic.h -istore.o: \ - istore.c \ - ../src/H5private.h \ - ../src/H5public.h \ - ../src/H5config.h \ - ../src/H5Iprivate.h \ - ../src/H5Ipublic.h \ - ../src/H5Pprivate.h \ - ../src/H5Ppublic.h \ - ../src/H5Dpublic.h \ - ../src/H5Fpublic.h \ - ../src/H5Zpublic.h \ - ../src/H5Fprivate.h \ - ../src/H5Gprivate.h \ - ../src/H5Gpublic.h \ - ../src/H5Bprivate.h \ - ../src/H5Bpublic.h \ - ../src/H5MMprivate.h \ - ../src/H5MMpublic.h \ - ../src/H5Oprivate.h \ - ../src/H5Opublic.h \ - ../src/H5HGprivate.h \ - ../src/H5HGpublic.h \ - ../src/H5Tprivate.h \ - ../src/H5Tpublic.h \ - ../src/H5Sprivate.h \ - ../src/H5Spublic.h \ - ../src/H5Zprivate.h external.o: \ external.c \ ../src/hdf5.h \ @@ -228,25 +200,6 @@ external.o: \ ../src/H5Zpublic.h \ ../src/H5Spublic.h \ ../src/H5Tpublic.h -gheap.o: \ - gheap.c \ - ../src/H5private.h \ - ../src/H5public.h \ - ../src/H5config.h \ - ../src/H5Eprivate.h \ - ../src/H5Epublic.h \ - ../src/H5Ipublic.h \ - ../src/H5Fprivate.h \ - ../src/H5Fpublic.h \ - ../src/H5Dpublic.h \ - ../src/H5Gprivate.h \ - ../src/H5Gpublic.h \ - ../src/H5Bprivate.h \ - ../src/H5Bpublic.h \ - ../src/H5HGprivate.h \ - ../src/H5HGpublic.h \ - ../src/H5Pprivate.h \ - ../src/H5Ppublic.h shtype.o: \ shtype.c \ ../src/hdf5.h \ @@ -363,29 +316,6 @@ extend.o: \ ../src/H5Ppublic.h \ ../src/H5Zpublic.h \ ../src/H5Spublic.h -mtime.o: \ - mtime.c \ - ../src/hdf5.h \ - ../src/H5public.h \ - ../src/H5config.h \ - ../src/H5Ipublic.h \ - ../src/H5Apublic.h \ - ../src/H5ACpublic.h \ - ../src/H5Bpublic.h \ - ../src/H5Dpublic.h \ - ../src/H5Epublic.h \ - ../src/H5Fpublic.h \ - ../src/H5Gpublic.h \ - ../src/H5HGpublic.h \ - ../src/H5HLpublic.h \ - ../src/H5MFpublic.h \ - ../src/H5MMpublic.h \ - ../src/H5Opublic.h \ - ../src/H5Ppublic.h \ - ../src/H5Zpublic.h \ - ../src/H5Spublic.h \ - ../src/H5Tpublic.h \ - ../src/H5private.h links.o: \ links.c \ ../src/hdf5.h \ @@ -496,6 +426,77 @@ bittests.o: \ ../src/H5Tpublic.h \ ../src/H5Gprivate.h \ ../src/H5Gpublic.h +istore.o: \ + istore.c \ + ../src/H5private.h \ + ../src/H5public.h \ + ../src/H5config.h \ + ../src/H5Iprivate.h \ + ../src/H5Ipublic.h \ + ../src/H5Pprivate.h \ + ../src/H5Ppublic.h \ + ../src/H5Dpublic.h \ + ../src/H5Fpublic.h \ + ../src/H5Zpublic.h \ + ../src/H5Fprivate.h \ + ../src/H5Gprivate.h \ + ../src/H5Gpublic.h \ + ../src/H5Bprivate.h \ + ../src/H5Bpublic.h \ + ../src/H5MMprivate.h \ + ../src/H5MMpublic.h \ + ../src/H5Oprivate.h \ + ../src/H5Opublic.h \ + ../src/H5HGprivate.h \ + ../src/H5HGpublic.h \ + ../src/H5Tprivate.h \ + ../src/H5Tpublic.h \ + ../src/H5Sprivate.h \ + ../src/H5Spublic.h \ + ../src/H5Zprivate.h +gheap.o: \ + gheap.c \ + ../src/H5private.h \ + ../src/H5public.h \ + ../src/H5config.h \ + ../src/H5Eprivate.h \ + ../src/H5Epublic.h \ + ../src/H5Ipublic.h \ + ../src/H5Fprivate.h \ + ../src/H5Fpublic.h \ + ../src/H5Dpublic.h \ + ../src/H5Gprivate.h \ + ../src/H5Gpublic.h \ + ../src/H5Bprivate.h \ + ../src/H5Bpublic.h \ + ../src/H5HGprivate.h \ + ../src/H5HGpublic.h \ + ../src/H5Pprivate.h \ + ../src/H5Ppublic.h +mtime.o: \ + mtime.c \ + ../src/hdf5.h \ + ../src/H5public.h \ + ../src/H5config.h \ + ../src/H5Ipublic.h \ + ../src/H5Apublic.h \ + ../src/H5ACpublic.h \ + ../src/H5Bpublic.h \ + ../src/H5Dpublic.h \ + ../src/H5Epublic.h \ + ../src/H5Fpublic.h \ + ../src/H5Gpublic.h \ + ../src/H5HGpublic.h \ + ../src/H5HLpublic.h \ + ../src/H5MFpublic.h \ + ../src/H5MMpublic.h \ + ../src/H5Opublic.h \ + ../src/H5Ppublic.h \ + ../src/H5Zpublic.h \ + ../src/H5Rpublic.h \ + ../src/H5Spublic.h \ + ../src/H5Tpublic.h \ + ../src/H5private.h ragged.o: \ ragged.c \ ../src/hdf5.h \ diff --git a/test/Makefile.in b/test/Makefile.in index f4024b5..3fb99cd 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -12,8 +12,8 @@ CPPFLAGS=-I. -I../src @CPPFLAGS@ # These are our main targets. They should be listed in the order to be # executed, generally most specific tests to least specific tests. TESTS=testhdf5 gheap hyperslab istore bittests dtypes dsets cmpd_dset extend \ - external shtype links big mtime ragged -TIMINGS=iopipe chunk + external shtype links big mtime +TIMINGS=iopipe chunk ragged # Temporary files MOSTLYCLEAN=cmpd_dset.h5 dataset.h5 extend.h5 istore.h5 tfile1.h5 tfile2.h5 \ diff --git a/test/gheap.c b/test/gheap.c index d6c6768..d4d4633 100644 --- a/test/gheap.c +++ b/test/gheap.c @@ -40,7 +40,7 @@ * Function: emit_diagnostics * * Purpose: If debugging is turned on then this function will cause the - * library to emit it's diagnostic messages now instead of when + * library to emit its diagnostic messages now instead of when * we're trying to make the output look nice. * * Return: void @@ -55,9 +55,10 @@ static void emit_diagnostics (void) { - H5F_t *f = H5F_open (TEST_FILE_NAME0, H5F_ACC_CREAT|H5F_ACC_RDWR|H5F_ACC_TRUNC, + H5F_t *f = H5F_open (TEST_FILE_NAME0, + H5F_ACC_CREAT|H5F_ACC_RDWR|H5F_ACC_TRUNC, NULL, NULL); - H5G_t *g = H5G_create (f->shared->root_grp, "emit", 0); + H5G_t *g = H5G_create (H5G_entof(f->shared->root_grp), "emit", 0); H5G_close (g); H5F_close (f); } diff --git a/test/istore.c b/test/istore.c index 24c5cd7..5af8075 100644 --- a/test/istore.c +++ b/test/istore.c @@ -134,7 +134,7 @@ new_object(H5F_t *f, const char *name, intn ndims, H5G_entry_t *ent/*out*/) return -1; } /* Give the object header a name */ - if (H5G_insert(H5G_getcwg(f), name, ent) < 0) { + if (H5G_insert(H5G_entof(H5G_getcwg(f)), name, ent) < 0) { printf("*FAILED*\n"); if (!isatty(1)) { AT(); @@ -638,7 +638,7 @@ main(int argc, char *argv[]) * By creating a group we cause the library to emit it's debugging * diagnostic messages before we begin testing... */ - dir = H5G_create(H5G_getcwg(f), "flushing_diagnostics", 0); + dir = H5G_create(H5G_entof(H5G_getcwg(f)), "flushing_diagnostics", 0); H5G_close(dir); dir = NULL; diff --git a/test/mtime.c b/test/mtime.c index 6f5327a..91d7400 100644 --- a/test/mtime.c +++ b/test/mtime.c @@ -101,7 +101,7 @@ main(void) hsize_t size[1] = {2}; time_t now; struct tm *tm; - H5G_stat_t sb; + H5G_stat_t sb1, sb2; char buf1[32], buf2[32]; H5Eset_auto(display_error_cb, NULL); @@ -118,21 +118,37 @@ main(void) if (H5Sclose(space)<0) return 1; if (H5Fclose(file)<0) return 1; - /* Open the file and get the modification time */ + /* + * Open the file and get the modification time. We'll test the new + * H5Gstat() arguments too: being able to stat something without knowing + * its name. + */ if ((file = H5Fopen(FILE_NAME_1, H5F_ACC_RDONLY, H5P_DEFAULT))<0) return 1; - if (H5Gstat(file, "dset", TRUE, &sb)<0) return 1; + if (H5Gstat(file, "dset", TRUE, &sb1)<0) return 1; + if ((dset=H5Dopen(file, "dset"))<0) return 1; + if (H5Gstat(dset, ".", TRUE, &sb2)<0) return 1; + if (H5Dclose(dset)<0) return 1; if (H5Fclose(file)<0) return 1; + /* Compare times from the two ways of calling H5Gstat() */ + if (sb1.objno[0]!=sb2.objno[0] || sb1.objno[1]!=sb2.objno[1] || + sb1.mtime!=sb2.mtime) { + puts("*FAILED*"); + puts(" Calling H5Gstat() with the dataset ID returned different"); + puts(" values than calling it with a file and dataset name."); + return 1; + } + /* Compare times -- they must be within 60 seconds of one another */ - if (0==sb.mtime) { + if (0==sb1.mtime) { puts("--SKIP--"); puts(" The modification time could not be decoded on this OS."); puts(" Modification times will be mantained in the file bug cannot"); puts(" be queried on this system. See H5O_mtime_decode()."); return 1; - } else if (fabs(HDdifftime(now, sb.mtime))>60.0) { + } else if (fabs(HDdifftime(now, sb1.mtime))>60.0) { puts("*FAILED*"); - tm = localtime(&(sb.mtime)); + tm = localtime(&(sb1.mtime)); strftime(buf1, sizeof buf1, "%Y-%m-%d %H:%M:%S", tm); tm = localtime(&now); strftime(buf2, sizeof buf2, "%Y-%m-%d %H:%M:%S", tm); diff --git a/test/ragged.c b/test/ragged.c index f5ba2f4..1e2d6ea 100644 --- a/test/ragged.c +++ b/test/ragged.c @@ -138,7 +138,7 @@ rand_nelmts(int reset_counters) { double p = (rand() % 1000000)/1000000.0; double total = 0.0; - size_t size, i; + size_t size=0, i; static size_t ncalls=0; if (reset_counters) { @@ -174,9 +174,9 @@ rand_nelmts(int reset_counters) /*------------------------------------------------------------------------- - * Function: ragged_append + * Function: ragged_write_all * - * Purpose: Writes rows to the end of ragged array RA. + * Purpose: Writes rows to the ragged array RA. * * Return: Success: 0 * @@ -190,7 +190,7 @@ rand_nelmts(int reset_counters) *------------------------------------------------------------------------- */ static int -ragged_append(hid_t ra, hsize_t rows_at_once) +ragged_write_all(hid_t ra, hsize_t rows_at_once) { int *dd, total_nelmts=0; hssize_t row; /*current row number */ @@ -203,7 +203,7 @@ ragged_append(hid_t ra, hsize_t rows_at_once) char s[64]; /*tempory string buffer */ char testname[80]; - sprintf(testname, "Testing append, units of %lu", + sprintf(testname, "Testing write all, units of %lu", (unsigned long)rows_at_once); printf("%s...\n", testname); fflush(stdout); @@ -276,7 +276,7 @@ ragged_append(hid_t ra, hsize_t rows_at_once) /*------------------------------------------------------------------------- - * Function: ragged_readall + * Function: ragged_read_all * * Purpose: Reads all rows of a ragged array in row order a few rows at a * time. @@ -293,7 +293,7 @@ ragged_append(hid_t ra, hsize_t rows_at_once) *------------------------------------------------------------------------- */ static int -ragged_readall(hid_t ra, hsize_t rows_at_once) +ragged_read_all(hid_t ra, hsize_t rows_at_once) { int total_nelmts=0; hsize_t i, j; /*counters */ @@ -403,7 +403,7 @@ ragged_readall(hid_t ra, hsize_t rows_at_once) /*------------------------------------------------------------------------- - * Function: ragged_readshort + * Function: ragged_read_short * * Purpose: Reads all the data but only the part that is in the `raw' * dataset. We should see a nice speed increase because we @@ -422,7 +422,7 @@ ragged_readall(hid_t ra, hsize_t rows_at_once) *------------------------------------------------------------------------- */ static int -ragged_readshort(hid_t ra, hsize_t rows_at_once, hsize_t width) +ragged_read_short(hid_t ra, hsize_t rows_at_once, hsize_t width) { int total_nelmts=0; hsize_t i, j; @@ -545,7 +545,7 @@ ragged_readshort(hid_t ra, hsize_t rows_at_once, hsize_t width) printf("%-70s*FAILED*\n\n", testname); return -1; } - + /*------------------------------------------------------------------------- * Function: main @@ -600,9 +600,14 @@ main(int argc, char *argv[]) if (H5Pclose(dcpl)<0) goto error; /* The tests */ - if (ragged_append(ra, rows_at_once)<0) goto error; - if (ragged_readall(ra, rows_at_once)<0) goto error; - if (ragged_readshort(ra, rows_at_once, ch_size[1])<0) goto error; + if (ragged_write_all(ra, rows_at_once)<0) goto error; + if (ragged_read_all(ra, rows_at_once)<0) goto error; + if (ragged_read_short(ra, rows_at_once, ch_size[1])<0) goto error; + + /* The tests again */ + if (ragged_write_all(ra, rows_at_once)<0) goto error; + if (ragged_read_all(ra, rows_at_once)<0) goto error; + if (ragged_read_short(ra, rows_at_once, ch_size[1])<0) goto error; /* Conclusions */ printf("\n\nDistribution of row lengths:\n"); |