From 0653325f0d4a92164842bb30b797f130e44cbc68 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 19 Sep 2013 11:38:08 -0500 Subject: [svn-r24167] HDFFV-8513, HDFFV-8522 Plugin testing in h5repack, h5dump. Add more usage info for UserMacros. Add new option information about the Plugin default path. Tested: local linux, jam --- UserMacros.cmake | 5 +++ config/cmake/ConfigureChecks.cmake | 8 ++-- config/cmake/H5pubconf.h.in | 2 +- config/cmake/UserMacros/Windows_MT.cmake | 2 + configure | 64 ++++++++++++++++---------------- configure.ac | 42 ++++++++++----------- release_docs/INSTALL_CMake.txt | 23 +++++++++++- release_docs/RELEASE.txt | 16 ++++---- src/H5PL.c | 6 ++- src/H5Z.c | 4 -- src/H5config.h.in | 2 +- test/testfiles/error_test_1 | 3 ++ tools/h5dump/errfiles/filter_fail.err | 3 ++ tools/h5repack/h5repack_main.c | 37 +++++++++++------- 14 files changed, 130 insertions(+), 87 deletions(-) diff --git a/UserMacros.cmake b/UserMacros.cmake index d7d3ef9..4c680ed 100644 --- a/UserMacros.cmake +++ b/UserMacros.cmake @@ -3,6 +3,8 @@ ######################################################## #----------------------------------------------------------------------------- +#------------------- E X A M P L E B E G I N-------------------------------- +#----------------------------------------------------------------------------- # Option to Build with User Defined Values #----------------------------------------------------------------------------- MACRO (MACRO_USER_DEFINED_LIBS) @@ -14,4 +16,7 @@ OPTION (BUILD_USER_DEFINED_LIBS "Build With User Defined Values" OFF) IF (BUILD_USER_DEFINED_LIBS) MACRO_USER_DEFINED_LIBS () ENDIF (BUILD_USER_DEFINED_LIBS) +#----------------------------------------------------------------------------- +#------------------- E X A M P L E E N D ----------------------------------- +#----------------------------------------------------------------------------- \ No newline at end of file diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index e495d9b..58c790d 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -152,13 +152,13 @@ ENDIF (WIN32) # SET (H5_DEFAULT_VFD H5FD_SEC2) -IF (NOT DEFINED "H5_DEFAULT_PLUGIN") +IF (NOT DEFINED "H5_DEFAULT_PLUGINDIR") IF (WINDOWS) - SET (H5_DEFAULT_PLUGIN "%ALLUSERSPROFILE%/hdf5/lib/plugin") + SET (H5_DEFAULT_PLUGINDIR "%ALLUSERSPROFILE%/hdf5/lib/plugin") ELSE (WINDOWS) - SET (H5_DEFAULT_PLUGIN "/usr/local/hdf5/lib/plugin") + SET (H5_DEFAULT_PLUGINDIR "/usr/local/hdf5/lib/plugin") ENDIF (WINDOWS) -ENDIF (NOT DEFINED "H5_DEFAULT_PLUGIN") +ENDIF (NOT DEFINED "H5_DEFAULT_PLUGINDIR") IF (WINDOWS) SET (H5_HAVE_WINDOWS 1) diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 2160ee8..ede2ffd 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -55,7 +55,7 @@ #cmakedefine H5_CYGWIN_ULLONG_TO_LDOUBLE_ROUND_PROBLEM @H5_CYGWIN_ULLONG_TO_LDOUBLE_ROUND_PROBLEM@ /* Define the default plugins path to compile */ -#cmakedefine H5_DEFAULT_PLUGIN "@H5_DEFAULT_PLUGIN@" +#cmakedefine H5_DEFAULT_PLUGINDIR "@H5_DEFAULT_PLUGINDIR@" /* Define the default virtual file driver to compile */ #cmakedefine H5_DEFAULT_VFD @H5_DEFAULT_VFD@ diff --git a/config/cmake/UserMacros/Windows_MT.cmake b/config/cmake/UserMacros/Windows_MT.cmake index 9be5404..175c420 100644 --- a/config/cmake/UserMacros/Windows_MT.cmake +++ b/config/cmake/UserMacros/Windows_MT.cmake @@ -4,6 +4,8 @@ # To use this option, copy both the macro and option code # into the root UserMacros.cmake file. +# OR add an include to the root UserMacros.cmake file: +# INCLUDE(path_to_file/WINDOWS_MT.cmake) #----------------------------------------------------------------------------- # Option to Build with Static CRT libraries on Windows diff --git a/configure b/configure index f8c182f..1628989 100755 --- a/configure +++ b/configure @@ -923,8 +923,8 @@ with_mpe enable_mpi_size enable_filters with_default_vfd -with_default_plugin enable_direct_vfd +with_default_plugindir enable_dconv_exception enable_dconv_accuracy enable_hl @@ -1670,7 +1670,7 @@ Optional Packages: --with-mpe=DIR Use MPE instrumentation [default=no] --with-default-vfd=driver Specify default file driver [default=sec2] - --with-default-plugin=location + --with-default-plugindir=location Specify default location for plugins [default="/usr/local/hdf5/lib/plugin"] --with-default-api-version=(v16|v18|v110) @@ -29287,36 +29287,6 @@ _ACEOF fi ## ---------------------------------------------------------------------- -## Enable custom plugin default path for library. It requires SHARED support. -## -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Custom Plugin Default Path definition" >&5 -$as_echo_n "checking for Custom Plugin Default Path definition... " >&6; } - -# Check whether --with-default-plugin was given. -if test "${with_default_plugin+set}" = set; then : - withval=$with_default_plugin; -else - withval="/usr/local/hdf5/lib/plugin" -fi - - -if test "X$withval" = "X"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: default" >&5 -$as_echo "default" >&6; } - default_plugin="/usr/local/hdf5/lib/plugin" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $withval" >&5 -$as_echo "$withval" >&6; } - default_plugin=$withval -fi - - -cat >>confdefs.h <<_ACEOF -#define DEFAULT_PLUGIN "$default_plugin" -_ACEOF - - -## ---------------------------------------------------------------------- ## Check if Direct I/O driver is enabled by --enable-direct-vfd ## @@ -29420,6 +29390,36 @@ fi ## ---------------------------------------------------------------------- +## Enable custom plugin default path for library. It requires SHARED support. +## +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for custom plugin default path definition" >&5 +$as_echo_n "checking for custom plugin default path definition... " >&6; } + +# Check whether --with-default-plugindir was given. +if test "${with_default_plugindir+set}" = set; then : + withval=$with_default_plugindir; +else + withval="/usr/local/hdf5/lib/plugin" +fi + + +if test "X$withval" = "X"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: default" >&5 +$as_echo "default" >&6; } + default_plugindir="/usr/local/hdf5/lib/plugin" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $withval" >&5 +$as_echo "$withval" >&6; } + default_plugindir=$withval +fi + + +cat >>confdefs.h <<_ACEOF +#define DEFAULT_PLUGINDIR "$default_plugindir" +_ACEOF + + +## ---------------------------------------------------------------------- ## Decide whether the presence of user's exception handling functions is ## checked and data conversion exceptions are returned. This is mainly ## for the speed optimization of hard conversions. Soft conversions can diff --git a/configure.ac b/configure.ac index be0d635..9eee22d 100644 --- a/configure.ac +++ b/configure.ac @@ -3055,27 +3055,6 @@ if test "X$default_vfd" = "Xyes"; then fi ## ---------------------------------------------------------------------- -## Enable custom plugin default path for library. It requires SHARED support. -## -AC_MSG_CHECKING([for Custom Plugin Default Path definition]) -AC_ARG_WITH([default-plugin], - [AS_HELP_STRING([--with-default-plugin=location], - [Specify default location for plugins - [default="/usr/local/hdf5/lib/plugin"]])],, - withval="/usr/local/hdf5/lib/plugin") - -if test "X$withval" = "X"; then - AC_MSG_RESULT([default]) - default_plugin="/usr/local/hdf5/lib/plugin" -else - AC_MSG_RESULT([$withval]) - default_plugin=$withval -fi - -AC_DEFINE_UNQUOTED([DEFAULT_PLUGIN], ["$default_plugin"], - [Define the default plugins path to compile]) - -## ---------------------------------------------------------------------- ## Check if Direct I/O driver is enabled by --enable-direct-vfd ## @@ -3118,6 +3097,27 @@ fi AM_CONDITIONAL([DIRECT_VFD_CONDITIONAL], [test "X$DIRECT_VFD" = "Xyes"]) ## ---------------------------------------------------------------------- +## Enable custom plugin default path for library. It requires SHARED support. +## +AC_MSG_CHECKING([for custom plugin default path definition]) +AC_ARG_WITH([default-plugindir], + [AS_HELP_STRING([--with-default-plugindir=location], + [Specify default location for plugins + [default="/usr/local/hdf5/lib/plugin"]])],, + withval="/usr/local/hdf5/lib/plugin") + +if test "X$withval" = "X"; then + AC_MSG_RESULT([default]) + default_plugindir="/usr/local/hdf5/lib/plugin" +else + AC_MSG_RESULT([$withval]) + default_plugindir=$withval +fi + +AC_DEFINE_UNQUOTED([DEFAULT_PLUGINDIR], ["$default_plugindir"], + [Define the default plugins path to compile]) + +## ---------------------------------------------------------------------- ## Decide whether the presence of user's exception handling functions is ## checked and data conversion exceptions are returned. This is mainly ## for the speed optimization of hard conversions. Soft conversions can diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index 5594610..80a13f7 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -8,7 +8,8 @@ Section I: Quick Step Building HDF5 Libraries with CMake Section II: Preconditions Section III: Building HDF5 C/C++ Libraries with CMake Section IV: All Options for HDF5 C/C++ Libraries with CMake -Section V: APPENDIX +Section V: User Defined Options for HDF5 Libraries with CMake +Section VI: APPENDIX ************************************************************************ @@ -445,11 +446,29 @@ HDF5_USE_FILTER_SCALEOFFSET "Use the SCALEOFFSET Filter" ON HDF5_USE_FILTER_SHUFFLE "Use the SHUFFLE Filter" ON IF (HDF5_ENABLE_SZIP_SUPPORT) HDF5_ENABLE_SZIP_ENCODING "Use SZip Encoding" OFF +IF (WINDOWS) + H5_DEFAULT_PLUGINDIR "%ALLUSERSPROFILE%/hdf5/lib/plugin" +ELSE (WINDOWS) + H5_DEFAULT_PLUGINDIR "/usr/local/hdf5/lib/plugin" +ENDIF (WINDOWS) ======================================================================== -V. APPENDIX +V. User Defined Options for HDF5 Libraries with CMake +======================================================================== + +Support for User Defined macros and options has been added. The file +UserMacros.cmake has an example of the technique. In the folder, +config/cmake/UserMacros, is an implementation for Windows Visual Studio +users for linking libraries to the static CRT - Windows_MT.cmake. + +Copy the contents of the file, both macro and option, into the +UserMacros.cmake file. Then enable the option to the CMake configuration, +build and test process. + +======================================================================== +VI. APPENDIX ======================================================================== Below are examples of the ctest scripts used by The HDF Group. diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 9a27d02..92a6ce4 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -43,7 +43,7 @@ New Features ------------- - New configuration option added to change the default plugin path. configure option is --with-default-plugin=location - cmake option is -DH5_DEFAULT_PLUGIN:PATH=location + cmake option is -DH5_DEFAULT_PLUGINDIR:PATH=location HDFFV-8513. (ADB 2013/09/04) - CMake minimum is now 2.8.10. (ADB 2013/01/14) - A new tool, cmakehdf5, which is a build command script similar to @@ -1218,7 +1218,7 @@ Platform C F90/ F90 C++ zlib SZIP Solaris2.11 32-bit n y/y n y y y Solaris2.11 64-bit n y/n n y y y Windows 7 y y/y n y y y -Windows 7 x64 y y/y n y y y +Windows 7 x64 y y/y n y y y Windows 7 Cygwin n y/n n y y y Windows 7 x64 Cygwin n y/n n y y y Windows 8 y y/y n y y y @@ -1298,14 +1298,14 @@ The following platforms are not supported but have been tested for this release. GNU Fortran (GCC) 4.8.1 20130603 (Red Hat 4.8.1-1) (cmake and autotools) - SUSE 12.3 3.4.6-2.10-desktop #1 SMP PREEMPT i686 i686 i386 GNU/Linux - gcc (SUSE Linux) 4.7.1 - GNU Fortran (SUSE Linux) 4.7.1 + SUSE 12.3 3.7.10-1.1-desktop #1 SMP PREEMPT i686 i686 i386 GNU/Linux + gcc (SUSE Linux) 4.7.2 + GNU Fortran (SUSE Linux) 4.7.2 (cmake and autotools) - SUSE 12.3 3.4.6-2.10-desktop #1 SMP PREEMPT x86_64 x86_64 x86_64 GNU/Linux - gcc (SUSE Linux) 4.7.1 - GNU Fortran (SUSE Linux) 4.7.1 + SUSE 12.3 3.7.10-1.1-desktop #1 SMP PREEMPT x86_64 x86_64 x86_64 GNU/Linux + gcc (SUSE Linux) 4.7.2 + GNU Fortran (SUSE Linux) 4.7.2 (cmake and autotools) Ubuntu 13.04 3.8.0-26-generic #38-Ubuntu SMP i686 GNU/Linux diff --git a/src/H5PL.c b/src/H5PL.c index 1c4b355..21bc0f2 100644 --- a/src/H5PL.c +++ b/src/H5PL.c @@ -85,7 +85,7 @@ typedef const void *(__cdecl *H5PL_get_plugin_info_t)(void); typedef const void *(*H5PL_get_plugin_info_t)(void); #endif /* H5_HAVE_WIN32_API */ -#define H5PL_DEFAULT_PATH H5_DEFAULT_PLUGIN +#define H5PL_DEFAULT_PATH H5_DEFAULT_PLUGINDIR /* Special symbol to indicate no plugin loading */ #define H5PL_NO_PLUGIN "::" @@ -273,6 +273,10 @@ H5PL_load(H5PL_type_t type, int id) FUNC_ENTER_NOAPI(NULL) + /* Check for "no plugins" indicated" */ + if(H5PL_no_plugin_g) + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "required dynamically loaded plugin filter '%d' is not available", id) + /* Initialize the location paths for dynamic libraries, if they aren't * already set up. */ diff --git a/src/H5Z.c b/src/H5Z.c index d415060..901b506 100644 --- a/src/H5Z.c +++ b/src/H5Z.c @@ -1326,9 +1326,6 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, hbool_t issue_error = FALSE; /* Check for "no plugins" indicated" */ - if(H5PL_no_plugin()) - issue_error = TRUE; - else { const H5Z_class2_t *filter_info; /* Try loading the filter */ @@ -1343,7 +1340,6 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, } /* end if */ else issue_error = TRUE; - } /* end else */ /* Check for error */ if(issue_error) { diff --git a/src/H5config.h.in b/src/H5config.h.in index a86970a..02bafd8 100644 --- a/src/H5config.h.in +++ b/src/H5config.h.in @@ -18,7 +18,7 @@ #undef CXX_HAVE_OFFSETOF /* Define the default plugins path to compile */ -#undef DEFAULT_PLUGIN +#undef DEFAULT_PLUGINDIR /* Define the default virtual file driver to compile */ #undef DEFAULT_VFD diff --git a/test/testfiles/error_test_1 b/test/testfiles/error_test_1 index b322460..ddc995e 100644 --- a/test/testfiles/error_test_1 +++ b/test/testfiles/error_test_1 @@ -56,5 +56,8 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #004: (file name) line (number) in H5Z_pipeline(): required filter 'bogus' is not registered major: Data filters minor: Read failed + #005: (file name) line (number) in H5PL_load(): required dynamically loaded plugin filter '305' is not available + major: Plugin for dynamically loaded library + minor: Unable to load metadata into cache All error API tests passed. diff --git a/tools/h5dump/errfiles/filter_fail.err b/tools/h5dump/errfiles/filter_fail.err index 8f0f990..db21044 100644 --- a/tools/h5dump/errfiles/filter_fail.err +++ b/tools/h5dump/errfiles/filter_fail.err @@ -14,6 +14,9 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #004: (file name) line (number) in H5Z_pipeline(): required filter 'filter_fail_test' is not registered major: Data filters minor: Read failed + #005: (file name) line (number) in H5PL_load(): required dynamically loaded plugin filter '312' is not available + major: Plugin for dynamically loaded library + minor: Unable to load metadata into cache h5dump error: unable to print data H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): #000: (file name) line (number) in h5tools_dump_simple_dset(): H5Dread failed diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c index 4c512a4..7d92e4b 100644 --- a/tools/h5repack/h5repack_main.c +++ b/tools/h5repack/h5repack_main.c @@ -32,19 +32,30 @@ const char *outfile = NULL; * parameters. */ static const char *s_opts = "hVvf:l:m:e:nLc:d:s:u:b:M:t:a:i:o:S:T:"; -static struct long_options l_opts[] = { { "help", no_arg, 'h' }, { "version", - no_arg, 'V' }, { "verbose", no_arg, 'v' }, - { "filter", require_arg, 'f' }, { "layout", require_arg, 'l' }, { - "minimum", require_arg, 'm' }, { "file", require_arg, 'e' }, { - "native", no_arg, 'n' }, { "latest", no_arg, 'L' }, { "compact", - require_arg, 'c' }, { "indexed", require_arg, 'd' }, { "ssize", - require_arg, 's' }, { "ublock", require_arg, 'u' }, { "block", - require_arg, 'b' }, { "metadata_block_size", require_arg, 'M' }, - { "threshold", require_arg, 't' }, { "alignment", require_arg, 'a' }, { - "infile", require_arg, 'i' }, /* -i for backward compability */ - { "outfile", require_arg, 'o' }, /* -o for backward compability */ - { "fs_strategy", require_arg, 'S' }, - { "fs_threshold", require_arg, 'T' }, { NULL, 0, '\0' } }; +static struct long_options l_opts[] = { + { "help", no_arg, 'h' }, + { "version", no_arg, 'V' }, + { "verbose", no_arg, 'v' }, + { "filter", require_arg, 'f' }, + { "layout", require_arg, 'l' }, + { "minimum", require_arg, 'm' }, + { "file", require_arg, 'e' }, + { "native", no_arg, 'n' }, + { "latest", no_arg, 'L' }, + { "compact", require_arg, 'c' }, + { "indexed", require_arg, 'd' }, + { "ssize", require_arg, 's' }, + { "ublock", require_arg, 'u' }, + { "block", require_arg, 'b' }, + { "metadata_block_size", require_arg, 'M' }, + { "threshold", require_arg, 't' }, + { "alignment", require_arg, 'a' }, + { "infile", require_arg, 'i' }, /* -i for backward compability */ + { "outfile", require_arg, 'o' }, /* -o for backward compability */ + { "fs_strategy", require_arg, 'S' }, + { "fs_threshold", require_arg, 'T' }, + { NULL, 0, '\0' } +}; /*------------------------------------------------------------------------- * Function: usage -- cgit v0.12