diff options
author | Neil Fortner <nfortne2@hdfgroup.org> | 2011-04-15 22:14:32 (GMT) |
---|---|---|
committer | Neil Fortner <nfortne2@hdfgroup.org> | 2011-04-15 22:14:32 (GMT) |
commit | 4ad6d32bfe310ba8d2a57c813791cf4652909286 (patch) | |
tree | d20dfdfc115cfaad4321a94d7caeb6e67c3a3191 /test | |
parent | 27a7f563f1d199bb6f38c12978981518ad445f92 (diff) | |
download | hdf5-4ad6d32bfe310ba8d2a57c813791cf4652909286.zip hdf5-4ad6d32bfe310ba8d2a57c813791cf4652909286.tar.gz hdf5-4ad6d32bfe310ba8d2a57c813791cf4652909286.tar.bz2 |
[svn-r20531] Purpose: Add testing for bug 1864
Description:
Added internal tesitng routines to traverse a file and verify that symbol table
information is *always* cached, whenever possible. Added this check to the end
of many tests to check all the test files, right before the call to h5_cleanup.
Tested: jam, amani, heiwa (h5committest)
Diffstat (limited to 'test')
-rw-r--r-- | test/btree2.c | 3 | ||||
-rw-r--r-- | test/cmpd_dset.c | 3 | ||||
-rw-r--r-- | test/dsets.c | 3 | ||||
-rw-r--r-- | test/efc.c | 3 | ||||
-rw-r--r-- | test/enum.c | 3 | ||||
-rw-r--r-- | test/extend.c | 3 | ||||
-rw-r--r-- | test/external.c | 4 | ||||
-rw-r--r-- | test/fheap.c | 3 | ||||
-rw-r--r-- | test/fillval.c | 3 | ||||
-rw-r--r-- | test/filter_fail.c | 3 | ||||
-rw-r--r-- | test/freespace.c | 3 | ||||
-rw-r--r-- | test/getname.c | 3 | ||||
-rw-r--r-- | test/gheap.c | 4 | ||||
-rw-r--r-- | test/h5test.c | 94 | ||||
-rw-r--r-- | test/h5test.h | 1 | ||||
-rw-r--r-- | test/istore.c | 3 | ||||
-rw-r--r-- | test/lheap.c | 3 | ||||
-rw-r--r-- | test/links.c | 3 | ||||
-rw-r--r-- | test/links_env.c | 3 | ||||
-rw-r--r-- | test/mount.c | 3 | ||||
-rw-r--r-- | test/mtime.c | 3 | ||||
-rw-r--r-- | test/ntypes.c | 4 | ||||
-rwxr-xr-x | test/objcopy.c | 3 | ||||
-rw-r--r-- | test/ohdr.c | 3 | ||||
-rw-r--r-- | test/set_extent.c | 3 | ||||
-rw-r--r-- | test/stab.c | 3 | ||||
-rw-r--r-- | test/unlink.c | 3 |
27 files changed, 173 insertions, 0 deletions
diff --git a/test/btree2.c b/test/btree2.c index eabd208..43d3d13 100644 --- a/test/btree2.c +++ b/test/btree2.c @@ -7652,6 +7652,9 @@ main(void) nerrors += test_modify(fapl, &cparam, &tparam); } /* end for */ + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + if(nerrors) goto error; diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index 08890a8..d7f7842 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -2208,6 +2208,9 @@ main (int argc, char *argv[]) puts("Testing compound member ordering:"); nerrors += test_ooo_order(fname); + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl_id) < 0 ? 1 : 0); + if (nerrors) { printf("***** %u FAILURE%s! *****\n", nerrors, 1==nerrors?"":"S"); diff --git a/test/dsets.c b/test/dsets.c index 627fdae..902048b 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -8274,6 +8274,9 @@ main(void) /* Close 2nd FAPL */ if(H5Pclose(fapl2) < 0) TEST_ERROR + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + if(nerrors) goto error; printf("All dataset tests passed.\n"); @@ -3192,6 +3192,9 @@ main(void) if(H5Pclose(fcpl_id) < 0) TEST_ERROR + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl_id) < 0 ? 1 : 0); + if(nerrors) goto error; diff --git a/test/enum.c b/test/enum.c index c627af1..e9f607d 100644 --- a/test/enum.c +++ b/test/enum.c @@ -583,6 +583,9 @@ main(void) H5Fclose(file); + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + if (nerrors) goto error; puts("All enum tests passed."); h5_cleanup(FILENAME, fapl); diff --git a/test/extend.c b/test/extend.c index 3ffcadc..5951e69 100644 --- a/test/extend.c +++ b/test/extend.c @@ -287,6 +287,9 @@ main (void) if(H5Sclose(mem_space) < 0) TEST_ERROR; if(H5Fclose(file) < 0) TEST_ERROR; + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + if(nerrors) { printf("***** %d FAILURE%s! *****\n", nerrors, (1 == nerrors) ? "" : "S"); exit(1); diff --git a/test/external.c b/test/external.c index 484236a..df72263 100644 --- a/test/external.c +++ b/test/external.c @@ -966,6 +966,10 @@ main (void) nerrors += test_2(fapl); nerrors += test_3(fapl); nerrors += test_4(fapl); + + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + if (nerrors>0) goto error; if (H5Fclose(file) < 0) goto error; diff --git a/test/fheap.c b/test/fheap.c index 2963e4c..a6992f1 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -16332,6 +16332,9 @@ HDfprintf(stderr, "Uncomment tests!\n"); HDfprintf(stderr, "Uncomment tests!\n"); #endif /* QAK */ + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + if(nerrors) goto error; puts("All fractal heap tests passed."); diff --git a/test/fillval.c b/test/fillval.c index 697fe5f..16247b5 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -2186,6 +2186,9 @@ main(int argc, char *argv[]) /* Close 2nd FAPL */ H5Pclose(fapl2); + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + if(nerrors) goto error; puts("All fill value tests passed."); diff --git a/test/filter_fail.c b/test/filter_fail.c index 9576567..67e1dda 100644 --- a/test/filter_fail.c +++ b/test/filter_fail.c @@ -390,6 +390,9 @@ int main(void) nerrors += (test_filter_write(filename, fapl, FALSE) < 0 ? 1 : 0); nerrors += (test_filter_read(filename, fapl) < 0 ? 1 : 0); + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + h5_cleanup(FILENAME, fapl); /* Make sure we can close the library */ diff --git a/test/freespace.c b/test/freespace.c index b4a774f..6960e6d 100644 --- a/test/freespace.c +++ b/test/freespace.c @@ -2854,6 +2854,9 @@ main(void) nerrors += test_fs_sect_extend(fapl); nerrors += test_fs_sect_iterate(fapl); + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + if(nerrors) goto error; puts("All free-space tests passed."); diff --git a/test/getname.c b/test/getname.c index bbaaa04..1e50dcc 100644 --- a/test/getname.c +++ b/test/getname.c @@ -2934,6 +2934,9 @@ main(void) /* Close file */ H5Fclose(file_id); + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + if(nerrors) goto error; puts("All getname tests passed."); diff --git a/test/gheap.c b/test/gheap.c index 2829e34..f30935a 100644 --- a/test/gheap.c +++ b/test/gheap.c @@ -545,6 +545,10 @@ main (void) nerrors += test_3(fapl); nerrors += test_4(fapl); nerrors += test_ooo_indices(fapl); + + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + if (nerrors) goto error; puts("All global heap tests passed."); diff --git a/test/h5test.c b/test/h5test.c index ecc7bf8..02bbf22 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -27,6 +27,11 @@ #include "h5test.h" #include "H5srcdir.h" +/* Necessary for h5_verify_cached_stabs() */ +#define H5G_PACKAGE +#define H5G_TESTING +#include "H5Gpkg.h" + #ifdef _WIN32 #include <process.h> #include <direct.h> @@ -1147,3 +1152,92 @@ h5_make_local_copy(char *origfilename, char *local_copy_name) return 0; } + + +/*------------------------------------------------------------------------- + * Function: h5_verify_cached_stabs_cb + * + * Purpose: Callback function for h5_verify_cached_stabs. + * + * Return: Success: 0 + * + * Failure: -1 + * + * Programmer: Neil Fortner + * Tuesday, April 12, 2011 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +h5_verify_cached_stabs_cb(hid_t oid, const char UNUSED *name, + const H5O_info_t *oinfo, void UNUSED *udata) +{ + if(oinfo->type == H5O_TYPE_GROUP) + return(H5G_verify_cached_stabs_test(oid)); + else + return(0); +} /* end h5_verify_cached_stabs_cb() */ + + +/*------------------------------------------------------------------------- + * Function: h5_verify_cached_stabs + * + * Purpose: Verify that all groups in every file in base_name have + * their symbol table information cached (if present, and if + * the parent group also uses a symbol table). Does not + * check that the root group's symbol table information is + * cached in the superblock. + * + * Return: Success: 0 + * + * Failure: -1 + * + * Programmer: Neil Fortner + * Tuesday, April 12, 2011 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +h5_verify_cached_stabs(const char *base_name[], hid_t fapl) +{ + hid_t file = -1; + char filename[1024]; + int i = 0; + + while(base_name[i]) { + if (h5_fixname(base_name[i], fapl, filename, sizeof(filename)) == NULL) + continue; + + H5E_BEGIN_TRY { + file = H5Fopen(filename, H5F_ACC_RDONLY, fapl); + } H5E_END_TRY + if(file < 0) { + i++; + continue; + } /* end if */ + + if(H5Ovisit(file, H5_INDEX_NAME, H5_ITER_NATIVE, + h5_verify_cached_stabs_cb, NULL) < 0) + goto error; + + if(H5Fclose(file) < 0) + goto error; + file = -1; + + i++; + } /* end while */ + + return 0; + +error: + H5E_BEGIN_TRY { + H5Fclose(file); + } H5E_END_TRY; + + return -1; +} + diff --git a/test/h5test.h b/test/h5test.h index 76bcdb4..465bb97 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -151,6 +151,7 @@ H5TEST_DLL void h5_show_hostname(void); H5TEST_DLL h5_stat_size_t h5_get_file_size(const char *filename, hid_t fapl); H5TEST_DLL int print_func(const char *format, ...); H5TEST_DLL int h5_make_local_copy(char *origfilename, char *local_copy_name); +H5TEST_DLL herr_t h5_verify_cached_stabs(const char *base_name[], hid_t fapl); /* Routines for operating on the list of tests (for the "all in one" tests) */ H5TEST_DLL void TestUsage(void); diff --git a/test/istore.c b/test/istore.c index fb0f3fc..3ae8da7 100644 --- a/test/istore.c +++ b/test/istore.c @@ -665,6 +665,9 @@ main(int argc, char *argv[]) H5Pclose(fcpl); H5Fclose(file); + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + if (nerrors) { printf("***** %d I-STORE TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); diff --git a/test/lheap.c b/test/lheap.c index 1a4ca20..ab6fb11 100644 --- a/test/lheap.c +++ b/test/lheap.c @@ -189,6 +189,9 @@ main(void) } PASSED(); + /* Verify symbol table messages are cached */ + if(h5_verify_cached_stabs(FILENAME, fapl) < 0) TEST_ERROR + puts("All local heap tests passed."); h5_cleanup(FILENAME, fapl); diff --git a/test/links.c b/test/links.c index 25ecb23..f9c6b6a 100644 --- a/test/links.c +++ b/test/links.c @@ -14486,6 +14486,9 @@ main(void) /* Close 2nd FAPL */ H5Pclose(fapl2); + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + h5_cleanup(FILENAME, fapl); /* Test that external links can be used after a library reset. MUST be diff --git a/test/links_env.c b/test/links_env.c index c792386..2da5e64 100644 --- a/test/links_env.c +++ b/test/links_env.c @@ -171,6 +171,9 @@ main(void) nerrors += external_link_env(fapl, TRUE) < 0 ? 1 : 0; + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + h5_cleanup(FILENAME, fapl); /* Results */ diff --git a/test/mount.c b/test/mount.c index f358634..f63404d 100644 --- a/test/mount.c +++ b/test/mount.c @@ -4383,6 +4383,9 @@ main(void) nerrors += test_sharedclose(fapl); nerrors += test_multisharedclose(fapl); + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + if (nerrors) goto error; puts("All mount tests passed."); diff --git a/test/mtime.c b/test/mtime.c index 9001925..8b1bf3e 100644 --- a/test/mtime.c +++ b/test/mtime.c @@ -196,6 +196,9 @@ main(void) } PASSED(); + /* Verify symbol table messages are cached */ + if(h5_verify_cached_stabs(FILENAME, fapl) < 0) TEST_ERROR + /* All looks good */ puts("All modification time tests passed."); h5_cleanup(FILENAME, fapl); diff --git a/test/ntypes.c b/test/ntypes.c index fa208e3..3310a82 100644 --- a/test/ntypes.c +++ b/test/ntypes.c @@ -2892,6 +2892,10 @@ main(void) if(H5Fclose(file) < 0) goto error; + + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + if(nerrors) goto error; diff --git a/test/objcopy.c b/test/objcopy.c index f4fee13..0f56f99 100755 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -8439,6 +8439,9 @@ main(void) /* Reset file address checking info */ addr_reset(); + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + /* Results */ if(nerrors) { printf("***** %d OBJECT COPY TEST%s FAILED! *****\n", diff --git a/test/ohdr.c b/test/ohdr.c index 5db7a84..1151101 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -794,6 +794,9 @@ main(void) TEST_ERROR } /* end for */ + /* Verify symbol table messages are cached */ + if(h5_verify_cached_stabs(FILENAME, fapl) < 0) TEST_ERROR + puts("All object header tests passed."); h5_cleanup(FILENAME, fapl); return(0); diff --git a/test/set_extent.c b/test/set_extent.c index 391407d..aaa6516 100644 --- a/test/set_extent.c +++ b/test/set_extent.c @@ -185,6 +185,9 @@ int main( void ) /* Close 2nd FAPL */ if(H5Pclose(fapl2) < 0) TEST_ERROR + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + h5_cleanup(FILENAME, fapl); HDremove(EXT_FILE_NAME1); diff --git a/test/stab.c b/test/stab.c index d897899..b460d90 100644 --- a/test/stab.c +++ b/test/stab.c @@ -1198,6 +1198,9 @@ main(void) /* Close 2nd FAPL */ H5Pclose(fapl2); + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + /* Check for test errors */ if(nerrors) goto error; diff --git a/test/unlink.c b/test/unlink.c index 9bd6f42..604b014 100644 --- a/test/unlink.c +++ b/test/unlink.c @@ -2549,6 +2549,9 @@ main(void) /* Close 2nd FAPL */ H5Pclose(fapl2); + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + if (nerrors) { printf("***** %d FAILURE%s! *****\n", nerrors, 1==nerrors?"":"S"); exit(1); |