diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2011-03-31 20:39:18 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2011-03-31 20:39:18 (GMT) |
commit | f4e7559bd2d8bbd59535cbcafab78e162a6bffb6 (patch) | |
tree | b4339300a7d08fe64266ad183213da8a38fb986e /test | |
parent | 9c0a2b214519c6f0508964981be19bf2e3054e35 (diff) | |
download | hdf5-f4e7559bd2d8bbd59535cbcafab78e162a6bffb6.zip hdf5-f4e7559bd2d8bbd59535cbcafab78e162a6bffb6.tar.gz hdf5-f4e7559bd2d8bbd59535cbcafab78e162a6bffb6.tar.bz2 |
[svn-r20383] Description:
Bring r19714:20382 from trunk to revise_chunks branch
Tested:
Linux 2.6/64 (chicago)
Diffstat (limited to 'test')
-rw-r--r-- | test/CMakeLists.txt | 22 | ||||
-rw-r--r-- | test/H5srcdir.h | 13 | ||||
-rw-r--r-- | test/fheap.c | 2 | ||||
-rw-r--r-- | test/getname.c | 2 | ||||
-rw-r--r-- | test/h5test.c | 15 | ||||
-rw-r--r-- | test/h5test.h | 5 | ||||
-rw-r--r-- | test/lheap.c | 5 | ||||
-rw-r--r-- | test/stab.c | 4 | ||||
-rw-r--r-- | test/tfile.c | 116 |
9 files changed, 164 insertions, 20 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 8fb93b5..ca975f9 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -146,7 +146,7 @@ SET (testhdf5_SRCS #-- Adding test for testhdf5 ADD_EXECUTABLE (testhdf5 ${testhdf5_SRCS}) -H5_NAMING (testhdf5 ${LIB_TYPE}) +TARGET_NAMING (testhdf5 ${LIB_TYPE}) TARGET_LINK_LIBRARIES (testhdf5 ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) ADD_TEST (NAME testhdf5 COMMAND $<TARGET_FILE:testhdf5>) @@ -159,7 +159,7 @@ ADD_TEST (NAME testhdf5 COMMAND $<TARGET_FILE:testhdf5>) MACRO (ADD_H5_TEST file) ADD_EXECUTABLE (${file} ${HDF5_TEST_SOURCE_DIR}/${file}.c) - H5_NAMING (${file} ${LIB_TYPE}) + TARGET_NAMING (${file} ${LIB_TYPE}) TARGET_LINK_LIBRARIES (${file} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) ADD_TEST (NAME ${file} COMMAND $<TARGET_FILE:${file}>) @@ -311,7 +311,7 @@ SET_TESTS_PROPERTIES(flush2 PROPERTIES DEPENDS flush1) #-- Adding test for cache ADD_EXECUTABLE (cache ${HDF5_TEST_SOURCE_DIR}/cache.c ${HDF5_TEST_SOURCE_DIR}/cache_common.c) -H5_NAMING (cache ${LIB_TYPE}) +TARGET_NAMING (cache ${LIB_TYPE}) TARGET_LINK_LIBRARIES (cache ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) ADD_TEST (NAME cache COMMAND $<TARGET_FILE:cache>) @@ -319,14 +319,14 @@ SET_TESTS_PROPERTIES(cache PROPERTIES DEPENDS h5test-clear-objects) #-- Adding test for cache_api ADD_EXECUTABLE (cache_api ${HDF5_TEST_SOURCE_DIR}/cache_api.c ${HDF5_TEST_SOURCE_DIR}/cache_common.c) -H5_NAMING (cache_api ${LIB_TYPE}) +TARGET_NAMING (cache_api ${LIB_TYPE}) TARGET_LINK_LIBRARIES (cache_api ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) ADD_TEST (NAME cache_api COMMAND $<TARGET_FILE:cache_api>) #-- Adding test for cache_tagging ADD_EXECUTABLE (cache_tagging ${HDF5_TEST_SOURCE_DIR}/cache_tagging.c ${HDF5_TEST_SOURCE_DIR}/cache_common.c) -H5_NAMING (cache_tagging ${LIB_TYPE}) +TARGET_NAMING (cache_tagging ${LIB_TYPE}) TARGET_LINK_LIBRARIES (cache_tagging ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) ADD_TEST (NAME cache_tagging COMMAND $<TARGET_FILE:cache_tagging>) @@ -338,7 +338,7 @@ ADD_EXECUTABLE (ttsafe ${HDF5_TEST_SOURCE_DIR}/ttsafe_cancel.c ${HDF5_TEST_SOURCE_DIR}/ttsafe_acreate.c ) -H5_NAMING (ttsafe ${LIB_TYPE}) +TARGET_NAMING (ttsafe ${LIB_TYPE}) TARGET_LINK_LIBRARIES (ttsafe ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) ADD_TEST (NAME ttsafe COMMAND $<TARGET_FILE:ttsafe>) @@ -346,7 +346,7 @@ ADD_TEST (NAME ttsafe COMMAND $<TARGET_FILE:ttsafe>) #-- Adding test for err_compat IF (HDF5_ENABLE_DEPRECATED_SYMBOLS) ADD_EXECUTABLE (err_compat ${HDF5_TEST_SOURCE_DIR}/err_compat.c) - H5_NAMING (err_compat ${LIB_TYPE}) + TARGET_NAMING (err_compat ${LIB_TYPE}) TARGET_LINK_LIBRARIES (err_compat ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) ADD_TEST (NAME err_compat COMMAND "${CMAKE_COMMAND}" @@ -363,7 +363,7 @@ ENDIF (HDF5_ENABLE_DEPRECATED_SYMBOLS) #-- Adding test for error_test ADD_EXECUTABLE (error_test ${HDF5_TEST_SOURCE_DIR}/error_test.c) -H5_NAMING (error_test ${LIB_TYPE}) +TARGET_NAMING (error_test ${LIB_TYPE}) TARGET_LINK_LIBRARIES (error_test ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) ADD_TEST (NAME error_test COMMAND "${CMAKE_COMMAND}" @@ -379,7 +379,7 @@ ADD_TEST (NAME error_test COMMAND "${CMAKE_COMMAND}" #-- Adding test for links_env ADD_EXECUTABLE (links_env ${HDF5_TEST_SOURCE_DIR}/links_env.c) -H5_NAMING (links_env ${LIB_TYPE}) +TARGET_NAMING (links_env ${LIB_TYPE}) TARGET_LINK_LIBRARIES (links_env ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) ADD_TEST (NAME links_env COMMAND "${CMAKE_COMMAND}" @@ -508,7 +508,7 @@ ENDIF (HDF5_TEST_VFD) IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) MACRO (ADD_H5_GENERATOR genfile) ADD_EXECUTABLE (${genfile} ${HDF5_TEST_SOURCE_DIR}/${genfile}.c) - H5_NAMING (${genfile} ${LIB_TYPE}) + TARGET_NAMING (${genfile} ${LIB_TYPE}) TARGET_LINK_LIBRARIES (${genfile} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) ENDMACRO (ADD_H5_GENERATOR genfile) @@ -535,7 +535,7 @@ IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) FOREACH (gen ${H5_GENERATORS}) ADD_EXECUTABLE (${gen} ${HDF5_TEST_SOURCE_DIR}/${gen}.c) - H5_NAMING (${gen} ${LIB_TYPE}) + TARGET_NAMING (${gen} ${LIB_TYPE}) TARGET_LINK_LIBRARIES (${gen} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) ENDFOREACH (gen ${H5_GENERATORS}) diff --git a/test/H5srcdir.h b/test/H5srcdir.h index 55700cb..8bc8780 100644 --- a/test/H5srcdir.h +++ b/test/H5srcdir.h @@ -32,7 +32,11 @@ static char srcdir_path[1024] = ""; static char srcdir_testpath[1024] = ""; /* Append the test file name to the srcdir path and return the whole string */ +#ifdef H5_VMS +static const char *H5_get_srcdir_filename(char *filename) +#else static const char *H5_get_srcdir_filename(const char *filename) +#endif { const char *srcdir = HDgetenv("srcdir"); @@ -43,8 +47,17 @@ static const char *H5_get_srcdir_filename(const char *filename) /* Build path to test file */ if((HDstrlen(srcdir) + HDstrlen(filename) + 2) < sizeof(srcdir_testpath)) { HDstrcpy(srcdir_testpath, srcdir); +#ifdef H5_VMS + if(filename[0] == '[') { + char *tmp = filename; + srcdir_testpath[strlen(srcdir)-1] = '\0'; + strcat(srcdir_testpath, ++tmp); + } else + strcat(srcdir_testpath, filename); +#else HDstrcat(srcdir_testpath, "/"); HDstrcat(srcdir_testpath, filename); +#endif return(srcdir_testpath); } /* end if */ else diff --git a/test/fheap.c b/test/fheap.c index 3d8e69d..afbe56c 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -16298,7 +16298,9 @@ curr_test = FHEAP_TEST_NORMAL; nerrors += test_id_limits(fapl, &small_cparam); nerrors += test_filtered_create(fapl, &small_cparam); nerrors += test_size(fapl, &small_cparam); +#ifndef H5_CANNOT_OPEN_TWICE nerrors += test_reopen_hdr(fapl, &small_cparam); +#endif /*H5_CANNOT_OPEN_TWICE*/ #else /* QAK */ HDfprintf(stderr, "Uncomment tests!\n"); #endif /* QAK */ diff --git a/test/getname.c b/test/getname.c index bef4756..bbaaa04 100644 --- a/test/getname.c +++ b/test/getname.c @@ -2927,7 +2927,9 @@ main(void) nerrors += test_main(file_id, fapl); nerrors += test_obj_ref(fapl); nerrors += test_reg_ref(fapl); +#ifndef H5_CANNOT_OPEN_TWICE nerrors += test_elinks(fapl); +#endif /*H5_CANNOT_OPEN_TWICE*/ /* Close file */ H5Fclose(file_id); diff --git a/test/h5test.c b/test/h5test.c index 25b751f..8762f90 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -1115,10 +1115,22 @@ getenv_all(MPI_Comm comm, int root, const char* name) hid_t h5_make_local_copy(char *origfilename, char *local_copy_name) { - const char *filename = H5_get_srcdir_filename(origfilename); /* Corrected test file name */ int fd_old = (-1), fd_new = (-1); /* File descriptors for copying data */ ssize_t nread; /* Number of bytes read in */ char buf[READ_BUF_SIZE]; /* Buffer for copying data */ + char filename[FILENAME_BUF_SIZE] = ""; +#ifdef H5_VMS + HDstrcat(filename, origfilename); +#else + char * srcdir = HDgetenv("srcdir"); /* The source directory */ + + if(srcdir && ((HDstrlen(srcdir) + + HDstrlen(origfilename) + 6) < FILENAME_BUF_SIZE)) { + HDstrcpy(filename, srcdir); + HDstrcat(filename, "/"); + } + HDstrcat(filename, origfilename); +#endif /* Copy old file into temporary file */ if((fd_old = HDopen(filename, O_RDONLY, 0666)) < 0) return -1; @@ -1135,4 +1147,3 @@ h5_make_local_copy(char *origfilename, char *local_copy_name) return 0; } - diff --git a/test/h5test.h b/test/h5test.h index 0467cd7..7994f72 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -25,11 +25,6 @@ #include "hdf5.h" #include "H5private.h" -#ifdef H5_STDC_HEADERS -# include <signal.h> -# include <stdarg.h> -#endif - /* * Predefined test verbosity levels. * diff --git a/test/lheap.c b/test/lheap.c index 9f78a15..ab6ee9f 100644 --- a/test/lheap.c +++ b/test/lheap.c @@ -179,8 +179,11 @@ main(void) { const char *testfile = H5_get_srcdir_filename(TESTFILE); /* Corrected test file name */ hid_t dset = -1; - +#ifdef H5_VMS + file = H5Fopen(TESTFILE, H5F_ACC_RDONLY, H5P_DEFAULT); +#else file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); +#endif if(file >= 0){ if((dset = H5Dopen2(file, "/Dataset1", H5P_DEFAULT)) < 0) TEST_ERROR diff --git a/test/stab.c b/test/stab.c index e8ffec3..d897899 100644 --- a/test/stab.c +++ b/test/stab.c @@ -57,8 +57,10 @@ const char *FILENAME[] = { /* The group_old.h5 is generated from gen_old_fill.c in HDF5 'test' directory * for version 1.6. To get this data file, simply compile gen_old_group.c with * the HDF5 library in that branch and run it. */ +/* I changed the name "group_old.h5.copy" to "group_old_copy.h5" because OpenVMS + * doesn't like any file name with more than one ".". SLU 2010/12/13 */ #define FILE_OLD_GROUPS "group_old.h5" -#define FILE_OLD_GROUPS_COPY "group_old.h5.copy" +#define FILE_OLD_GROUPS_COPY "group_old_copy.h5" /* Definitions for 'no_compact' test */ #define NO_COMPACT_TOP_GROUP "top" diff --git a/test/tfile.c b/test/tfile.c index 041522f..6c3746c 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -109,6 +109,9 @@ #define FILE5 "tfile5.h5" /* Test file */ #define TEST_THRESHOLD10 10 /* Free space section threshold */ +/* Declaration for test_libver_macros2() */ +#define FILE6 "tfile6.h5" /* Test file */ + const char *OLD_FILENAME[] = { /* Files created under 1.6 branch and 1.8 branch */ "filespace_1_6.h5", /* 1.6 HDF5 file */ "filespace_1_8.h5" /* 1.8 HDF5 file */ @@ -3114,6 +3117,117 @@ test_libver_bounds(void) /**************************************************************** ** +** test_libver_macros(): +** Verify that H5_VERSION_GE and H5_VERSION_LE work correactly. +** +****************************************************************/ +static void +test_libver_macros(void) +{ + unsigned major = H5_VERS_MAJOR; + unsigned minor = H5_VERS_MINOR; + unsigned release = H5_VERS_RELEASE; + + /* Output message about test being performed */ + MESSAGE(5, ("Testing macros for library version comparison\n")); + + VERIFY(H5_VERSION_GE(major,minor,release), TRUE, "H5_VERSION_GE"); + VERIFY(H5_VERSION_GE(major-1,minor,release), TRUE, "H5_VERSION_GE"); + VERIFY(H5_VERSION_GE(major-1,minor+1,release), TRUE, "H5_VERSION_GE"); + VERIFY(H5_VERSION_GE(major-1,minor,release+1), TRUE, "H5_VERSION_GE"); + VERIFY(H5_VERSION_GE(major,minor-1,release), TRUE, "H5_VERSION_GE"); + VERIFY(H5_VERSION_GE(major,minor-1,release+1), TRUE, "H5_VERSION_GE"); + VERIFY(H5_VERSION_GE(major,minor,release-1), TRUE, "H5_VERSION_GE"); + + VERIFY(H5_VERSION_GE(major+1,minor,release), FALSE, "H5_VERSION_GE"); + VERIFY(H5_VERSION_GE(major+1,minor-1,release), FALSE, "H5_VERSION_GE"); + VERIFY(H5_VERSION_GE(major+1,minor-1,release-1), FALSE, "H5_VERSION_GE"); + VERIFY(H5_VERSION_GE(major,minor+1,release), FALSE, "H5_VERSION_GE"); + VERIFY(H5_VERSION_GE(major,minor+1,release-1), FALSE, "H5_VERSION_GE"); + VERIFY(H5_VERSION_GE(major,minor,release+1), FALSE, "H5_VERSION_GE"); + + VERIFY(H5_VERSION_LE(major,minor,release), TRUE, "H5_VERSION_LE"); + VERIFY(H5_VERSION_LE(major+1,minor,release), TRUE, "H5_VERSION_LE"); + VERIFY(H5_VERSION_LE(major+1,minor-1,release), TRUE, "H5_VERSION_LE"); + VERIFY(H5_VERSION_LE(major+1,minor-1,release-1), TRUE, "H5_VERSION_LE"); + VERIFY(H5_VERSION_LE(major,minor+1,release), TRUE, "H5_VERSION_LE"); + VERIFY(H5_VERSION_LE(major,minor+1,release-1), TRUE, "H5_VERSION_LE"); + VERIFY(H5_VERSION_LE(major,minor,release+1), TRUE, "H5_VERSION_LE"); + + VERIFY(H5_VERSION_LE(major-1,minor,release), FALSE, "H5_VERSION_LE"); + VERIFY(H5_VERSION_LE(major-1,minor+1,release), FALSE, "H5_VERSION_LE"); + VERIFY(H5_VERSION_LE(major-1,minor+1,release+1), FALSE, "H5_VERSION_LE"); + VERIFY(H5_VERSION_LE(major,minor-1,release), FALSE, "H5_VERSION_LE"); + VERIFY(H5_VERSION_LE(major,minor-1,release+1), FALSE, "H5_VERSION_LE"); + VERIFY(H5_VERSION_LE(major,minor,release-1), FALSE, "H5_VERSION_LE"); +} /* test_libver_macros() */ + +/**************************************************************** +** +** test_libver_macros2(): +** Verify that H5_VERSION_GE works correactly and show how +** to use it. +** +****************************************************************/ +static void +test_libver_macros2(void) +{ + hid_t file; + hid_t grp; + htri_t status; + herr_t ret; /* Return value */ + + /* Output message about test being performed */ + MESSAGE(5, ("Testing macros for library version comparison with a file\n")); + + /* + * Create a file. + */ + file = H5Fcreate(FILE6, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + CHECK(file, FAIL, "H5Fcreate"); + + /* + * Create a group in the file. + */ + grp = H5Gcreate2(file, "Group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(file, FAIL, "H5Gcreate"); + + /* + * Close the group + */ + ret = H5Gclose(grp); + CHECK(ret, FAIL, "H5Gclose"); + + /* + * Delete the group using different function based on the library version. + * And verify the action. + */ +#if H5_VERSION_GE(1,8,0) + ret = H5Ldelete(file, "Group", H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lunlink"); + + status = H5Lexists(file, "Group", H5P_DEFAULT); + VERIFY(status, FALSE, "H5Lexists"); +#else + ret = H5Gunlink(file, "Group"); + CHECK(ret, FAIL, "H5Gunlink"); + + H5E_BEGIN_TRY { + grp = H5Gopen(file, "Group"); + } H5E_END_TRY; + VERIFY(grp, FAIL, "H5Gopen"); +#endif + + /* + * Close the file. + */ + ret = H5Fclose(file); + CHECK(ret, FAIL, "H5Fclose"); + +} /* test_libver_macros2() */ + +/**************************************************************** +** ** test_swmr_write(): low-level file test routine. ** This test checks that the H5F_ACC_SWMR_WRITE access flag is ** working properly. @@ -3488,6 +3602,8 @@ test_file(void) test_filespace_info(); /* Test file creation public routines:H5Pget/set_file_space */ test_filespace_compatible();/* Test compatibility for file space management */ test_libver_bounds(); /* Test compatibility for file space management */ + test_libver_macros(); /* Test the macros for library version comparison */ + test_libver_macros2(); /* Test the macros for library version comparison */ test_swmr_write(); /* Tests for SWMR write access flag */ test_swmr_read(); /* Tests for SWMR read access flag */ #ifndef H5_NO_DEPRECATED_SYMBOLS |