From 46c3b32c0142397a1a2d0862fb7267409cfd7b61 Mon Sep 17 00:00:00 2001 From: John Mainzer Date: Fri, 30 Jan 2009 07:18:29 -0500 Subject: [svn-r16383] A number of items, mostly related to the use of the core file driver in metadata cache tests. 1) Fixed the core file driver failures previously observed on some platforms when running the cache2 tests with the core file driver enabled. This was done by allocating all needed memory on file open. 2) Added code to cache2.c to allow the use of the core file driver to be forced via the HDF5_DRIVER environment variable. 3) Added code to try to figure out whether using the core file driver in cache2 makes sense, and then use it or not as seems appropriate unless overridden via the HDF5_DRIVER environment variable. This code only works under Linux and BSD (including MacOS). For now at least, we use regular files in all other cases unless directed otherwise. Note that this required a fair bit of configuration code massage. 4) Updated Makefile.am in examples to run the new mdj_api_example.c example. Forgot to "svn add mdj_api_example.c" before this checkin, but will do so shortly. Tested on: Duty (serial), Liberty (serial), tejeda (serial), jam (serial and parallel), and Phoenix (serial and parallel). Note that Phoenix is now 64 bit AMD64 Linux. --- MANIFEST | 1 + config/freebsd | 9 +- configure | 1037 +++++++++++++++++++++++++++++++++++++++++++++++++ configure.in | 26 ++ examples/Makefile.am | 5 +- examples/Makefile.in | 5 +- src/H5config.h.in | 9 + src/H5private.h | 6 + src/H5system.c | 305 +++++++++++++++ test/cache2.c | 459 +++++++++++++++++++++- test/cache2_common.c | 174 +++++++-- test/cache2_common.h | 6 +- test/cache2_journal.c | 88 ++++- 13 files changed, 2078 insertions(+), 52 deletions(-) diff --git a/MANIFEST b/MANIFEST index f74f913..070a0b7 100644 --- a/MANIFEST +++ b/MANIFEST @@ -141,6 +141,7 @@ ./examples/h5_ref2reg.c ./examples/h5_shared_mesg.c ./examples/ph5example.c +./examples/mdj_api_example.c ./examples/testh5cc.sh.in diff --git a/config/freebsd b/config/freebsd index 8f2e5e4..e047730 100644 --- a/config/freebsd +++ b/config/freebsd @@ -29,9 +29,12 @@ fi # Add "_XOPEN_SOURCE" define to cpp flags, to quiet warnings # from /usr/include/sys/cdefs.h # (Unless we are using g++ as a C compiler) -if test "X-g++" != "X-$CC"; then - H5_CPPFLAGS="$H5_CPPFLAGS -D_XOPEN_SOURCE=600" -fi +# +# JRM -- comment this out as it seems to be keeping me from using sysctl() +# +#if test "X-g++" != "X-$CC"; then +# H5_CPPFLAGS="$H5_CPPFLAGS -D_XOPEN_SOURCE=600" +#fi # Figure out C compiler flags . $srcdir/config/gnu-flags diff --git a/configure b/configure index 901a8a7..8fc02f4 100755 --- a/configure +++ b/configure @@ -22793,6 +22793,1043 @@ fi done ;; + *linux*) + +for ac_header in sys/sysinfo.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## -------------------------------- ## +## Report this to help@hdfgroup.org ## +## -------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_func in sysinfo +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +#ifdef FC_DUMMY_MAIN +#ifndef FC_DUMMY_MAIN_EQ_F77 +# ifdef __cplusplus + extern "C" +# endif + int FC_DUMMY_MAIN() { return 1; } +#endif +#endif +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + ;; + *freebsd*) + +for ac_header in sys/types.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## -------------------------------- ## +## Report this to help@hdfgroup.org ## +## -------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in sys/sysctl.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## -------------------------------- ## +## Report this to help@hdfgroup.org ## +## -------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_func in sysctl +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +#ifdef FC_DUMMY_MAIN +#ifndef FC_DUMMY_MAIN_EQ_F77 +# ifdef __cplusplus + extern "C" +# endif + int FC_DUMMY_MAIN() { return 1; } +#endif +#endif +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + ;; + *apple-darwin*) + +for ac_header in sys/types.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## -------------------------------- ## +## Report this to help@hdfgroup.org ## +## -------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in sys/sysctl.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## -------------------------------- ## +## Report this to help@hdfgroup.org ## +## -------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_func in sysctl +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +#ifdef FC_DUMMY_MAIN +#ifndef FC_DUMMY_MAIN_EQ_F77 +# ifdef __cplusplus + extern "C" +# endif + int FC_DUMMY_MAIN() { return 1; } +#endif +#endif +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + ;; mips*-sgi*-irix*) for ac_header in sys/fpu.h diff --git a/configure.in b/configure.in index 0fba4cb..1843240 100644 --- a/configure.in +++ b/configure.in @@ -1201,6 +1201,32 @@ case "$host" in dnl many problems with including them. AC_CHECK_HEADERS([sys/sysinfo.h sys/proc.h]) ;; + *linux*) + dnl The header file and the sysinfo() library call + dnl are needed on linux boxes to determine whether the system has + dnl sufficient physical RAM to permit running some of the metadata + dnl cache tests with the core file driver. Thus we test for the + dnl header despite the problems mentioned above. + dnl JRM -- 1/15/09 + AC_CHECK_HEADERS([sys/sysinfo.h]) + AC_CHECK_FUNCS([sysinfo]) + ;; + *freebsd*) + dnl On freebsd, to determine the amount of physical memory on the host + dnl machine, we need the and header files, + dnl and the sysctl() function. + dnl JRM -- 1/15/09 + AC_CHECK_HEADERS([sys/types.h]) + AC_CHECK_HEADERS([sys/sysctl.h]) + AC_CHECK_FUNCS([sysctl]) + ;; + *apple-darwin*) + dnl MacOS X is basically BSD, so run the same checks as above. + dnl JRM -- 1/27/09 + AC_CHECK_HEADERS([sys/types.h]) + AC_CHECK_HEADERS([sys/sysctl.h]) + AC_CHECK_FUNCS([sysctl]) + ;; mips*-sgi*-irix*) dnl The is needed on the SGI machines to turn off dnl denormalized floating-point values going to zero. We do *not* diff --git a/examples/Makefile.am b/examples/Makefile.am index c81213b..012c502 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -31,7 +31,7 @@ endif # Use the boilerplate in config/examples.am instead. TEST_PROG = h5_write h5_read h5_extend_write h5_chunk_read h5_compound \ h5_group h5_select h5_attribute h5_mount h5_reference h5_drivers \ - h5_ref2reg h5_extlink h5_elink_unix2win h5_shared_mesg + h5_ref2reg h5_extlink h5_elink_unix2win h5_shared_mesg mdj_api_example TEST_SCRIPT=testh5cc.sh # Install files @@ -39,7 +39,7 @@ TEST_SCRIPT=testh5cc.sh INSTALL_FILES = h5_write.c h5_read.c h5_extend_write.c h5_chunk_read.c \ h5_compound.c h5_group.c h5_select.c h5_attribute.c h5_mount.c \ h5_reference.c h5_drivers.c h5_extlink.c h5_elink_unix2win.c \ - h5_ref2reg.c h5_shared_mesg.c ph5example.c + h5_ref2reg.c h5_shared_mesg.c ph5example.c mdj_api_example.c # How to build examples, using installed version of h5cc if BUILD_PARALLEL_CONDITIONAL @@ -90,6 +90,7 @@ h5_dtransform: $(srcdir)/h5_dtransform.c h5_extlink: $(srcdir)/h5_extlink.c $(EXTLINK_DIRS) h5_elink_unix2win: $(srcdir)/h5_elink_unix2win.c $(EXTLINK_DIRS) h5_shared_mesg: $(srcdir)/h5_shared_mesg.c +mdj_api_example: $(srcdir)/mdj_api_example.c include $(top_srcdir)/config/examples.am include $(top_srcdir)/config/conclude.am diff --git a/examples/Makefile.in b/examples/Makefile.in index 9e4dfc3..6fc4e3e 100644 --- a/examples/Makefile.in +++ b/examples/Makefile.in @@ -323,7 +323,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog $(EXTLINK_DIRS) *.h5 # Use the boilerplate in config/examples.am instead. TEST_PROG = h5_write h5_read h5_extend_write h5_chunk_read h5_compound \ h5_group h5_select h5_attribute h5_mount h5_reference h5_drivers \ - h5_ref2reg h5_extlink h5_elink_unix2win h5_shared_mesg + h5_ref2reg h5_extlink h5_elink_unix2win h5_shared_mesg mdj_api_example TEST_SCRIPT = testh5cc.sh @@ -332,7 +332,7 @@ TEST_SCRIPT = testh5cc.sh INSTALL_FILES = h5_write.c h5_read.c h5_extend_write.c h5_chunk_read.c \ h5_compound.c h5_group.c h5_select.c h5_attribute.c h5_mount.c \ h5_reference.c h5_drivers.c h5_extlink.c h5_elink_unix2win.c \ - h5_ref2reg.c h5_shared_mesg.c ph5example.c + h5_ref2reg.c h5_shared_mesg.c ph5example.c mdj_api_example.c # The external link examples demonstrate how to use paths; they need @@ -589,6 +589,7 @@ h5_dtransform: $(srcdir)/h5_dtransform.c h5_extlink: $(srcdir)/h5_extlink.c $(EXTLINK_DIRS) h5_elink_unix2win: $(srcdir)/h5_elink_unix2win.c $(EXTLINK_DIRS) h5_shared_mesg: $(srcdir)/h5_shared_mesg.c +mdj_api_example: $(srcdir)/mdj_api_example.c # How to create EXAMPLEDIR if it doesn't already exist $(EXAMPLEDIR): diff --git a/src/H5config.h.in b/src/H5config.h.in index 429b613..9fa1a55 100644 --- a/src/H5config.h.in +++ b/src/H5config.h.in @@ -291,6 +291,12 @@ /* Define if `struct videoconfig' is defined */ #undef HAVE_STRUCT_VIDEOCONFIG +/* Define to 1 if you have the `sysctl' function. */ +#undef HAVE_SYSCTL + +/* Define to 1 if you have the `sysinfo' function. */ +#undef HAVE_SYSINFO + /* Define to 1 if you have the `system' function. */ #undef HAVE_SYSTEM @@ -312,6 +318,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SYSCTL_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SYSINFO_H diff --git a/src/H5private.h b/src/H5private.h index 53ef5c1..d5c412a 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -1980,5 +1980,11 @@ H5_DLL uint32_t H5_hash_string(const char *str); H5_DLL herr_t H5_buffer_dump(FILE *stream, int indent, uint8_t *buf, uint8_t *marker, size_t buf_offset, size_t buf_size); +/* function to obtain data about the host system */ +/* Note that these function don't always work -- on failure they return 0 */ +H5_DLL unsigned long long H5_get_free_ram(void); +H5_DLL unsigned long long H5_get_free_swap(void); +H5_DLL unsigned long long H5_get_physical_ram(void); + #endif /* _H5private_H */ diff --git a/src/H5system.c b/src/H5system.c index 6a8a91a..8b35e63 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -33,6 +33,18 @@ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ + +#ifdef H5_HAVE_SYS_TYPES_H +#ifdef H5_HAVE_SYS_SYSCTL_H +#include +#include +#endif /* H5_HAVE_SYS_SYSCTL_H */ +#endif /* H5_HAVE_SYS_TYPES_H */ + +#ifdef H5_HAVE_SYS_SYSINFO_H +#include +#endif /* H5_HAVE_SYS_SYSINFO_H */ + #include "H5Fprivate.h" /* File access */ #include "H5MMprivate.h" /* Memory management */ #include "H5Eprivate.h" @@ -677,3 +689,296 @@ done: H5MM_xfree(new_name); FUNC_LEAVE_NOAPI(ret_value) } /* H5_build_extpath() */ + + +/* + *------------------------------------------------------------------------- + * + * Function: H5_get_free_ram + * + * Purpose: Determine how much free ram the host system contains, and + * return that value in bytes. If this data is not available, + * return 0. + * + * Return: Number of bytes of free ram on the host system, or + * zero if unable to determine this value. + * + * Programmer: John Mainzer + * 1/22/09 + *------------------------------------------------------------------------- + */ + +unsigned long long +H5_get_free_ram(void) +{ + const char * fcn_name = "H5_get_free_ram()"; + hbool_t verbose = FALSE; + unsigned long long free_ram = 0; + +#ifdef H5_HAVE_SYS_SYSINFO_H /* LINUX */ +#ifdef H5_HAVE_SYSINFO /* LINUX */ + { + struct sysinfo info; + + if ( sysinfo(&info) != 0 ) { + + if ( verbose ) { + + HDfprintf(stdout, "%s: sysinfo() failed with errno = %d (%s)\n", + fcn_name, errno, strerror(errno)); + + } + } else { + + if ( verbose ) { + + HDfprintf(stdout, "%s: mem_unit = %u\n", + fcn_name, info.mem_unit); + HDfprintf(stdout, "%s: RAM: total = %lu, free = %lu\n", + fcn_name, info.totalram, info.freeram); + HDfprintf(stdout, "%s: RAM: shared = %lu, buffer = %lu\n", + fcn_name, info.sharedram, info.bufferram); + HDfprintf(stdout, "%s: SWAP: total = %lu, free = %lu\n", + fcn_name, info.totalswap, info.freeswap); + } + + free_ram = ((unsigned long long)(info.freeram)) * + ((unsigned long long)(info.mem_unit)); + } + } +#endif /* H5_HAVE_SYSINFO -- LINUX */ +#endif /* H5_HAVE_SYS_SYSINFO_H -- LINUX */ + + if ( verbose ) { + + HDfprintf(stdout, "%s: free ram = %lld.\n", + fcn_name, (long long)free_ram); + } + + return(free_ram); + +} /* H5_get_free_ram() */ + + +/* + *------------------------------------------------------------------------- + * + * Function: H5_get_free_swap + * + * Purpose: Determine how much free swap the host system contains, and + * return that value in bytes. If this data is not available, + * return 0. + * + * Return: Number of bytes of free swap on the host system, or + * zero if unable to determine this value. + * + * Programmer: John Mainzer + * 1/22/09 + *------------------------------------------------------------------------- + */ + +unsigned long long +H5_get_free_swap(void) +{ + const char * fcn_name = "H5_get_free_swap()"; + hbool_t verbose = FALSE; + unsigned long long free_swap = 0; + +#ifdef H5_HAVE_SYS_SYSINFO_H /* LINUX */ +#ifdef H5_HAVE_SYSINFO /* LINUX */ + { + struct sysinfo info; + + if ( sysinfo(&info) != 0 ) { + + if ( verbose ) { + + HDfprintf(stdout, "%s: sysinfo() failed with errno = %d (%s)\n", + fcn_name, errno, strerror(errno)); + + } + } else { + + if ( verbose ) { + + HDfprintf(stdout, "%s: mem_unit = %u\n", + fcn_name, info.mem_unit); + HDfprintf(stdout, "%s: RAM: total = %lu, free = %lu\n", + fcn_name, info.totalram, info.freeram); + HDfprintf(stdout, "%s: RAM: shared = %lu, buffer = %lu\n", + fcn_name, info.sharedram, info.bufferram); + HDfprintf(stdout, "%s: SWAP: total = %lu, free = %lu\n", + fcn_name, info.totalswap, info.freeswap); + } + + free_swap = ((unsigned long long)(info.freeswap)) * + ((unsigned long long)(info.mem_unit)); + } + } +#endif /* H5_HAVE_SYSINFO -- LINUX */ +#endif /* H5_HAVE_SYS_SYSINFO_H -- LINUX */ + + if ( verbose ) { + + HDfprintf(stdout, "%s: free swap = %lld.\n", + fcn_name, (long long)free_swap); + } + + return(free_swap); + +} /* H5_get_free_swap() */ + + +/* + *------------------------------------------------------------------------- + * + * Function: H5_get_physical_ram + * + * Purpose: Determine how much physical ram the host system contains, and + * return that value in bytes. If this data is not available, + * return 0. + * + * Return: Number of bytes of physical ram on the host system, or + * zero if unable to determine this value. + * + * Programmer: John Mainzer + * 1/22/09 + *------------------------------------------------------------------------- + */ + +unsigned long long +H5_get_physical_ram(void) +{ + const char * fcn_name = "H5_get_physical_ram()"; + hbool_t verbose = FALSE; + unsigned long long physical_ram = 0; + +#ifdef H5_HAVE_SYS_SYSINFO_H /* LINUX */ +#ifdef H5_HAVE_SYSINFO /* LINUX */ + { + struct sysinfo info; + + if ( sysinfo(&info) != 0 ) { + + if ( verbose ) { + + HDfprintf(stdout, "%s: sysinfo() failed with errno = %d (%s)\n", + fcn_name, errno, strerror(errno)); + + } + } else { + + if ( verbose ) { + + HDfprintf(stdout, "%s: mem_unit = %u\n", + fcn_name, info.mem_unit); + HDfprintf(stdout, "%s: RAM: total = %lu, free = %lu\n", + fcn_name, info.totalram, info.freeram); + HDfprintf(stdout, "%s: RAM: shared = %lu, buffer = %lu\n", + fcn_name, info.sharedram, info.bufferram); + HDfprintf(stdout, "%s: SWAP: total = %lu, free = %lu\n", + fcn_name, info.totalswap, info.freeswap); + } + + physical_ram = ((unsigned long long)(info.totalram)) * + ((unsigned long long)(info.mem_unit)); + } + } +#endif /* H5_HAVE_SYSINFO -- LINUX */ +#endif /* H5_HAVE_SYS_SYSINFO_H -- LINUX */ + +#ifdef H5_HAVE_SYS_TYPES_H /* BSD */ +#ifdef H5_HAVE_SYS_SYSCTL_H /* BSD */ +#ifdef H5_HAVE_SYSCTL /* BSD */ + { + size_t len; + int pm_mib[2] = {CTL_HW, HW_PHYSMEM}; + unsigned long l_physical_mem; + unsigned long long ll_physical_mem; + + if ( sysctl(pm_mib, 2, NULL, &len, NULL, (size_t)0) == -1 ) { + + if ( verbose ) { + + HDfprintf(stdout, "%s: sysctl(1) failed with errno = %d (%s)\n", + fcn_name, errno, strerror(errno)); + } + + } else { + + if ( verbose ) { + + HDfprintf(stdout, "%s: len = %d.\n", fcn_name, (int)len); + + } + + if ( len == sizeof(l_physical_mem) ) { + + if ( sysctl(pm_mib, 2, &l_physical_mem, &len, NULL, (size_t)0) + == -1 ) { + + if ( verbose ) { + + HDfprintf(stdout, + "%s: sysctl(2) failed with errno = %d (%s)\n", + fcn_name, errno, strerror(errno)); + + } + } else { + + if ( verbose ) { + + HDfprintf(stdout, "%s: l_physical memory = %ld\n", + fcn_name, l_physical_mem); + } + + physical_ram = (unsigned long long)l_physical_mem; + } + } else if ( len == sizeof(ll_physical_mem) ) { + + if ( sysctl(pm_mib, 2, &ll_physical_mem, &len, NULL, (size_t)0) + == -1 ) { + + if ( verbose ) { + + HDfprintf(stdout, + "%s: sysctl(3) failed with errno = %d (%s)\n", + fcn_name, errno, strerror(errno)); + + } + } else { + + if ( verbose ) { + + HDfprintf(stdout, "%s: ll_physical memory = %lld\n", + fcn_name, ll_physical_mem); + } + + physical_ram = (unsigned long long)ll_physical_mem; + } + + } else { + + if ( verbose ) { + + HDfprintf(stdout, "%s: unexpected len.\n", fcn_name); + } + } + } + } +#endif /* H5_HAVE_SYSCTL -- BSD */ +#endif /* H5_HAVE_SYS_SYSCTL_H -- BSD */ +#endif /* H5_HAVE_SYS_TYPES_H -- BSD */ + + if ( verbose ) { + + HDfprintf(stdout, "%s: physical ram = %lld.\n", + fcn_name, (long long)physical_ram); + } + + + return(physical_ram); + +} /* H5_get_physical_ram() */ + + diff --git a/test/cache2.c b/test/cache2.c index a8f99a8..6f817f6 100644 --- a/test/cache2.c +++ b/test/cache2.c @@ -164,6 +164,8 @@ smoke_check_1(void) int mile_stone = 1; H5F_t * file_ptr = NULL; + core_file_driver_failed = FALSE; + TESTING("smoke check #1 -- all clean, ins, dest, ren, 4/2 MB cache"); switch ( express_test2 ) @@ -335,6 +337,13 @@ smoke_check_1(void) fcn_name, failure_mssg2); } + if ( core_file_driver_failed ) { + + HDfprintf(stdout, + "%s(): Unable to open test file with core file driver.\n", + fcn_name); + } + return !pass2; } /* smoke_check_1() */ @@ -378,6 +387,8 @@ smoke_check_2(void) TESTING("smoke check #2 -- ~1/2 dirty, ins, dest, ren, 4/2 MB cache"); + core_file_driver_failed = FALSE; + switch ( express_test2 ) { case 0: @@ -547,6 +558,13 @@ smoke_check_2(void) fcn_name, failure_mssg2); } + if ( core_file_driver_failed ) { + + HDfprintf(stdout, + "%s(): Unable to open test file with core file driver.\n", + fcn_name); + } + return !pass2; } /* smoke_check_2() */ @@ -589,6 +607,8 @@ smoke_check_3(void) TESTING("smoke check #3 -- all clean, ins, dest, ren, 2/1 KB cache"); + core_file_driver_failed = FALSE; + switch ( express_test2 ) { case 0: @@ -758,6 +778,13 @@ smoke_check_3(void) fcn_name, failure_mssg2); } + if ( core_file_driver_failed ) { + + HDfprintf(stdout, + "%s(): Unable to open test file with core file driver.\n", + fcn_name); + } + return !pass2; } /* smoke_check_3() */ @@ -801,6 +828,8 @@ smoke_check_4(void) TESTING("smoke check #4 -- ~1/2 dirty, ins, dest, ren, 2/1 KB cache"); + core_file_driver_failed = FALSE; + switch ( express_test2 ) { case 0: @@ -841,21 +870,21 @@ smoke_check_4(void) HDfprintf(stdout, "%s() - %0d -- pass2 = %d\n", fcn_name, mile_stone++, (int)pass2); - row_major_scan_forward2(/* file_ptr */ file_ptr, + row_major_scan_forward2(/* file_ptr */ file_ptr, /* max_index */ max_index, - /* lag */ lag, - /* verbose */ FALSE, - /* reset_stats */ TRUE, - /* display_stats */ display_stats, - /* display_detailed_stats */ TRUE, - /* do_inserts */ TRUE, - /* dirty_inserts */ dirty_inserts, - /* do_renames */ TRUE, - /* rename_to_main_addr */ FALSE, - /* do_destroys */ TRUE, - /* do_mult_ro_protects */ TRUE, - /* dirty_destroys */ dirty_destroys, - /* dirty_unprotects */ dirty_unprotects); + /* lag */ lag, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ TRUE, + /* do_inserts */ TRUE, + /* dirty_inserts */ dirty_inserts, + /* do_renames */ TRUE, + /* rename_to_main_addr */ FALSE, + /* do_destroys */ TRUE, + /* do_mult_ro_protects */ TRUE, + /* dirty_destroys */ dirty_destroys, + /* dirty_unprotects */ dirty_unprotects); if ( show_progress ) /* 4 */ HDfprintf(stdout, "%s() - %0d -- pass2 = %d\n", @@ -968,6 +997,13 @@ smoke_check_4(void) HDfprintf(stdout, "%s(): failure_mssg2 = \"%s\".\n", fcn_name, failure_mssg2); + } + + if ( core_file_driver_failed ) { + + HDfprintf(stdout, + "%s(): Unable to open test file with core file driver.\n", + fcn_name); } return !pass2; @@ -1060,6 +1096,8 @@ smoke_check_5(void) TESTING("smoke check #5 -- all clean, ins, prot, unprot, AR cache 1"); + core_file_driver_failed = FALSE; + switch ( express_test2 ) { case 0: @@ -1217,6 +1255,13 @@ smoke_check_5(void) fcn_name, failure_mssg2); } + if ( core_file_driver_failed ) { + + HDfprintf(stdout, + "%s(): Unable to open test file with core file driver.\n", + fcn_name); + } + return !pass2; } /* smoke_check_5() */ @@ -1307,6 +1352,8 @@ smoke_check_6(void) TESTING("smoke check #6 -- ~1/2 dirty, ins, prot, unprot, AR cache 1"); + core_file_driver_failed = FALSE; + pass2 = TRUE; switch ( express_test2 ) @@ -1464,6 +1511,13 @@ smoke_check_6(void) fcn_name, failure_mssg2); } + if ( core_file_driver_failed ) { + + HDfprintf(stdout, + "%s(): Unable to open test file with core file driver.\n", + fcn_name); + } + return !pass2; } /* smoke_check_6() */ @@ -1555,6 +1609,8 @@ smoke_check_7(void) TESTING("smoke check #7 -- all clean, ins, prot, unprot, AR cache 2"); + core_file_driver_failed = FALSE; + switch ( express_test2 ) { case 0: @@ -1712,6 +1768,13 @@ smoke_check_7(void) fcn_name, failure_mssg2); } + if ( core_file_driver_failed ) { + + HDfprintf(stdout, + "%s(): Unable to open test file with core file driver.\n", + fcn_name); + } + return !pass2; } /* smoke_check_7() */ @@ -1803,6 +1866,8 @@ smoke_check_8(void) TESTING("smoke check #8 -- ~1/2 dirty, ins, prot, unprot, AR cache 2"); + core_file_driver_failed = FALSE; + switch ( express_test2 ) { case 0: @@ -1960,6 +2025,13 @@ smoke_check_8(void) fcn_name, failure_mssg2); } + if ( core_file_driver_failed ) { + + HDfprintf(stdout, + "%s(): Unable to open test file with core file driver.\n", + fcn_name); + } + return !pass2; } /* smoke_check_8() */ @@ -2006,6 +2078,8 @@ smoke_check_9(void) TESTING("smoke check #9 -- all clean, ins, dest, ren, 4/2 MB, corked"); + core_file_driver_failed = FALSE; + switch ( express_test2 ) { case 0: @@ -2285,6 +2359,13 @@ smoke_check_9(void) fcn_name, failure_mssg2); } + if ( core_file_driver_failed ) { + + HDfprintf(stdout, + "%s(): Unable to open test file with core file driver.\n", + fcn_name); + } + return !pass2; } /* smoke_check_9() */ @@ -2331,6 +2412,8 @@ smoke_check_10(void) TESTING("smoke check #10 -- ~1/2 dirty, ins, dest, ren, 4/2 MB, corked"); + core_file_driver_failed = FALSE; + switch ( express_test2 ) { case 0: @@ -2605,6 +2688,13 @@ smoke_check_10(void) fcn_name, failure_mssg2); } + if ( core_file_driver_failed ) { + + HDfprintf(stdout, + "%s(): Unable to open test file with core file driver.\n", + fcn_name); + } + return !pass2; } /* smoke_check_10() */ @@ -2647,6 +2737,8 @@ write_permitted_check(void) TESTING("write permitted check -- 1/0 MB cache"); + core_file_driver_failed = FALSE; + #if H5C2_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS switch ( express_test2 ) @@ -2815,6 +2907,13 @@ write_permitted_check(void) fcn_name, failure_mssg2); } + if ( core_file_driver_failed ) { + + HDfprintf(stdout, + "%s(): Unable to open test file with core file driver.\n", + fcn_name); + } + #else /* H5C2_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ SKIPPED(); @@ -2873,6 +2972,8 @@ check_insert_entry(void) TESTING("H5C2_insert_entry() functionality"); + core_file_driver_failed = FALSE; + pass2 = TRUE; if ( show_progress ) { @@ -3206,6 +3307,13 @@ check_insert_entry(void) fcn_name, failure_mssg2); } + if ( core_file_driver_failed ) { + + HDfprintf(stdout, + "%s(): Unable to open test file with core file driver.\n", + fcn_name); + } + return !pass2; } /* check_insert_entry() */ @@ -3237,6 +3345,8 @@ check_flush_cache(void) TESTING("H5C2_flush_cache() functionality"); + core_file_driver_failed = FALSE; + pass2 = TRUE; if ( show_progress ) { /* 0 */ @@ -3321,6 +3431,13 @@ check_flush_cache(void) fcn_name, failure_mssg2); } + if ( core_file_driver_failed ) { + + HDfprintf(stdout, + "%s(): Unable to open test file with core file driver.\n", + fcn_name); + } + return !pass2; } /* check_flush_cache() */ @@ -13409,6 +13526,8 @@ check_get_entry_status(void) TESTING("H5C2_get_entry_status() functionality"); + core_file_driver_failed = FALSE; + pass2 = TRUE; if ( pass2 ) { @@ -13571,6 +13690,13 @@ check_get_entry_status(void) fcn_name, failure_mssg2); } + if ( core_file_driver_failed ) { + + HDfprintf(stdout, + "%s(): Unable to open test file with core file driver.\n", + fcn_name); + } + return !pass2; } /* check_get_entry_status() */ @@ -13611,6 +13737,8 @@ check_expunge_entry(void) TESTING("H5C2_expunge_entry() functionality"); + core_file_driver_failed = FALSE; + pass2 = TRUE; if ( pass2 ) { @@ -13893,6 +14021,13 @@ check_expunge_entry(void) fcn_name, failure_mssg2); } + if ( core_file_driver_failed ) { + + HDfprintf(stdout, + "%s(): Unable to open test file with core file driver.\n", + fcn_name); + } + return !pass2; } /* check_expunge_entry() */ @@ -13927,6 +14062,10 @@ check_multiple_read_protect(void) TESTING("multiple read only protects on a single entry"); + core_file_driver_failed = FALSE; + + core_file_driver_failed = FALSE; + pass2 = TRUE; /* allocate a cache. Should succeed. @@ -14316,6 +14455,13 @@ check_multiple_read_protect(void) fcn_name, failure_mssg2); } + if ( core_file_driver_failed ) { + + HDfprintf(stdout, + "%s(): Unable to open test file with core file driver.\n", + fcn_name); + } + return !pass2; } /* check_multiple_read_protect() */ @@ -14374,6 +14520,8 @@ check_rename_entry(void) TESTING("H5C2_rename_entry() functionality"); + core_file_driver_failed = FALSE; + pass2 = TRUE; /* allocate a cache, load entries into it, and then rename @@ -14429,6 +14577,13 @@ check_rename_entry(void) fcn_name, failure_mssg2); } + if ( core_file_driver_failed ) { + + HDfprintf(stdout, + "%s(): Unable to open test file with core file driver.\n", + fcn_name); + } + return !pass2; } /* check_rename_entry() */ @@ -14613,6 +14768,8 @@ check_pin_protected_entry(void) TESTING("H5C2_pin_protected_entry() functionality"); + core_file_driver_failed = FALSE; + pass2 = TRUE; /* Create a cache, protect an entry, and then use H5C2_pin_protected_entry() @@ -14671,6 +14828,13 @@ check_pin_protected_entry(void) fcn_name, failure_mssg2); } + if ( core_file_driver_failed ) { + + HDfprintf(stdout, + "%s(): Unable to open test file with core file driver.\n", + fcn_name); + } + return !pass2; } /* check_pin_protected_entry() */ @@ -14713,6 +14877,8 @@ check_resize_entry(void) TESTING("entry resize functionality"); + core_file_driver_failed = FALSE; + /* Setup a cache and verify that it is empty. * * Then force the load of an entry by protecting it, and verify that @@ -15623,6 +15789,13 @@ check_resize_entry(void) fcn_name, failure_mssg2); } + if ( core_file_driver_failed ) { + + HDfprintf(stdout, + "%s(): Unable to open test file with core file driver.\n", + fcn_name); + } + return !pass2; } /* check_resize_entry() */ @@ -15666,6 +15839,8 @@ check_evictions_enabled(void) TESTING("evictions enabled/disabled functionality"); + core_file_driver_failed = FALSE; + /* Setup a cache and verify that it is empty. * * Use H5C2_get_evictions_enabled() to determine if evictions are @@ -16328,6 +16503,13 @@ check_evictions_enabled(void) fcn_name, failure_mssg2); } + if ( core_file_driver_failed ) { + + HDfprintf(stdout, + "%s(): Unable to open test file with core file driver.\n", + fcn_name); + } + return !pass2; } /* check_evictions_enabled() */ @@ -16357,6 +16539,8 @@ check_flush_protected_err(void) TESTING("flush cache with protected entry error"); + core_file_driver_failed = FALSE; + pass2 = TRUE; /* allocate a cache, protect an entry, and try to flush. This @@ -16406,6 +16590,13 @@ check_flush_protected_err(void) fcn_name, failure_mssg2); } + if ( core_file_driver_failed ) { + + HDfprintf(stdout, + "%s(): Unable to open test file with core file driver.\n", + fcn_name); + } + return !pass2; } /* check_flush_protected_err() */ @@ -16441,6 +16632,8 @@ check_destroy_pinned_err(void) TESTING("destroy cache with permanently pinned entry error"); + core_file_driver_failed = FALSE; + pass2 = TRUE; /* allocate a cache, pin an entry, and try to flush destroy. This @@ -16500,6 +16693,13 @@ check_destroy_pinned_err(void) fcn_name, failure_mssg2); } + if ( core_file_driver_failed ) { + + HDfprintf(stdout, + "%s(): Unable to open test file with core file driver.\n", + fcn_name); + } + return !pass2; } /* check_destroy_pinned_err() */ @@ -16529,6 +16729,8 @@ check_destroy_protected_err(void) TESTING("destroy cache with protected entry error"); + core_file_driver_failed = FALSE; + pass2 = TRUE; /* allocate a cache, protect an entry, and try to flush. This @@ -16587,6 +16789,13 @@ check_destroy_protected_err(void) fcn_name, failure_mssg2); } + if ( core_file_driver_failed ) { + + HDfprintf(stdout, + "%s(): Unable to open test file with core file driver.\n", + fcn_name); + } + return !pass2; } /* check_destroy_protected_err() */ @@ -16619,6 +16828,8 @@ check_duplicate_insert_err(void) TESTING("duplicate entry insertion error"); + core_file_driver_failed = FALSE; + pass2 = TRUE; /* allocate a cache, protect an entry, and then try to insert @@ -16667,6 +16878,13 @@ check_duplicate_insert_err(void) fcn_name, failure_mssg2); } + if ( core_file_driver_failed ) { + + HDfprintf(stdout, + "%s(): Unable to open test file with core file driver.\n", + fcn_name); + } + return !pass2; } /* check_duplicate_insert_err() */ @@ -16701,6 +16919,8 @@ check_rename_err(void) TESTING("rename to existing entry errors"); + core_file_driver_failed = FALSE; + pass2 = TRUE; /* allocate a cache, and insert several entries. Try to rename @@ -16762,6 +16982,13 @@ check_rename_err(void) fcn_name, failure_mssg2); } + if ( core_file_driver_failed ) { + + HDfprintf(stdout, + "%s(): Unable to open test file with core file driver.\n", + fcn_name); + } + return !pass2; } /* check_rename_err() */ @@ -16795,6 +17022,8 @@ check_double_pin_err(void) TESTING("pin a pinned entry error"); + core_file_driver_failed = FALSE; + pass2 = TRUE; /* allocate a cache, protect an entry, unprotect it with the pin flag, @@ -16851,6 +17080,13 @@ check_double_pin_err(void) fcn_name, failure_mssg2); } + if ( core_file_driver_failed ) { + + HDfprintf(stdout, + "%s(): Unable to open test file with core file driver.\n", + fcn_name); + } + return !pass2; } /* check_double_pin_err() */ @@ -16884,6 +17120,8 @@ check_double_unpin_err(void) TESTING("unpin an unpinned entry error"); + core_file_driver_failed = FALSE; + pass2 = TRUE; /* allocate a cache, protect an entry, unprotect it with the unpin flag. @@ -16951,6 +17189,13 @@ check_double_unpin_err(void) fcn_name, failure_mssg2); } + if ( core_file_driver_failed ) { + + HDfprintf(stdout, + "%s(): Unable to open test file with core file driver.\n", + fcn_name); + } + return !pass2; } /* check_double_unpin_err() */ @@ -16984,6 +17229,8 @@ check_pin_entry_errs(void) TESTING("pin entry related errors"); + core_file_driver_failed = FALSE; + pass2 = TRUE; /* Allocate a cache, protect an entry, unprotect it with no flags, @@ -17062,6 +17309,13 @@ check_pin_entry_errs(void) fcn_name, failure_mssg2); } + if ( core_file_driver_failed ) { + + HDfprintf(stdout, + "%s(): Unable to open test file with core file driver.\n", + fcn_name); + } + return !pass2; } /* check_pin_entry_errs() */ @@ -17098,6 +17352,8 @@ check_double_protect_err(void) TESTING("protect a protected entry error"); + core_file_driver_failed = FALSE; + pass2 = TRUE; /* allocate a cache, protect an entry, and then try to protect @@ -17149,6 +17405,13 @@ check_double_protect_err(void) fcn_name, failure_mssg2); } + if ( core_file_driver_failed ) { + + HDfprintf(stdout, + "%s(): Unable to open test file with core file driver.\n", + fcn_name); + } + return !pass2; } /* check_double_protect_err() */ @@ -17188,6 +17451,8 @@ check_double_unprotect_err(void) TESTING("unprotect an unprotected entry error"); + core_file_driver_failed = FALSE; + pass2 = TRUE; /* allocate a cache, protect an entry, unprotect it, and then try to @@ -17237,6 +17502,13 @@ check_double_unprotect_err(void) fcn_name, failure_mssg2); } + if ( core_file_driver_failed ) { + + HDfprintf(stdout, + "%s(): Unable to open test file with core file driver.\n", + fcn_name); + } + return !pass2; } /* check_double_unprotect_err() */ @@ -17279,6 +17551,8 @@ check_mark_entry_dirty_errs(void) TESTING("mark entry dirty related errors"); + core_file_driver_failed = FALSE; + pass2 = TRUE; /* allocate a cache, protect an entry, and then attempt to mark it dirty @@ -17366,6 +17640,13 @@ check_mark_entry_dirty_errs(void) fcn_name, failure_mssg2); } + if ( core_file_driver_failed ) { + + HDfprintf(stdout, + "%s(): Unable to open test file with core file driver.\n", + fcn_name); + } + return !pass2; } /* check_mark_entry_dirty_errs() */ @@ -17399,6 +17680,8 @@ check_expunge_entry_errs(void) TESTING("expunge entry related errors"); + core_file_driver_failed = FALSE; + pass2 = TRUE; /* Allocate a cache, protect an entry, and then call H5C2_expunge_entry() @@ -17490,6 +17773,13 @@ check_expunge_entry_errs(void) fcn_name, failure_mssg2); } + if ( core_file_driver_failed ) { + + HDfprintf(stdout, + "%s(): Unable to open test file with core file driver.\n", + fcn_name); + } + return !pass2; } /* check_expunge_entry_errs() */ @@ -17523,6 +17813,8 @@ check_resize_entry_errs(void) TESTING("resize entry related errors"); + core_file_driver_failed = FALSE; + pass2 = TRUE; /* Allocate a cache, protect an entry, and then call @@ -17597,6 +17889,13 @@ check_resize_entry_errs(void) fcn_name, failure_mssg2); } + if ( core_file_driver_failed ) { + + HDfprintf(stdout, + "%s(): Unable to open test file with core file driver.\n", + fcn_name); + } + return !pass2; } /* check_resize_entry_errs() */ @@ -17630,6 +17929,8 @@ check_unprotect_ro_dirty_err(void) TESTING("unprotect a read only entry dirty error"); + core_file_driver_failed = FALSE; + pass2 = TRUE; /* allocate a cache, protect an entry read only, and then unprotect it @@ -17729,6 +18030,13 @@ check_unprotect_ro_dirty_err(void) fcn_name, failure_mssg2); } + if ( core_file_driver_failed ) { + + HDfprintf(stdout, + "%s(): Unable to open test file with core file driver.\n", + fcn_name); + } + return !pass2; } /* check_unprotect_ro_dirty_err() */ @@ -17762,6 +18070,8 @@ check_protect_ro_rw_err(void) TESTING("protect a read only entry rw error"); + core_file_driver_failed = FALSE; + pass2 = TRUE; /* allocate a cache, protect an entry read only, and then try to protect @@ -17813,6 +18123,13 @@ check_protect_ro_rw_err(void) fcn_name, failure_mssg2); } + if ( core_file_driver_failed ) { + + HDfprintf(stdout, + "%s(): Unable to open test file with core file driver.\n", + fcn_name); + } + return !pass2; } /* check_protect_ro_rw_err() */ @@ -17847,6 +18164,8 @@ check_check_evictions_enabled_err(void) TESTING("get/set evictions enabled errors"); + core_file_driver_failed = FALSE; + pass2 = TRUE; /* allocate a cache. @@ -17952,6 +18271,13 @@ check_check_evictions_enabled_err(void) fcn_name, failure_mssg2); } + if ( core_file_driver_failed ) { + + HDfprintf(stdout, + "%s(): Unable to open test file with core file driver.\n", + fcn_name); + } + return !pass2; } /* check_evictions_enabled_err() */ @@ -18053,6 +18379,8 @@ check_auto_cache_resize(void) TESTING("automatic cache resizing"); + core_file_driver_failed = FALSE; + pass2 = TRUE; if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -22288,6 +22616,13 @@ check_auto_cache_resize(void) fcn_name, failure_mssg2); } + if ( core_file_driver_failed ) { + + HDfprintf(stdout, + "%s(): Unable to open test file with core file driver.\n", + fcn_name); + } + return !pass2; } /* check_auto_cache_resize() */ @@ -22371,6 +22706,8 @@ check_auto_cache_resize_disable(void) TESTING("automatic cache resize disable"); + core_file_driver_failed = FALSE; + pass2 = TRUE; if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -25043,6 +25380,13 @@ check_auto_cache_resize_disable(void) fcn_name, failure_mssg2); } + if ( core_file_driver_failed ) { + + HDfprintf(stdout, + "%s(): Unable to open test file with core file driver.\n", + fcn_name); + } + return !pass2; } /* check_auto_cache_resize_disable() */ @@ -25123,6 +25467,8 @@ check_auto_cache_resize_epoch_markers(void) TESTING("automatic cache resize epoch marker management"); + core_file_driver_failed = FALSE; + pass2 = TRUE; if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -25753,6 +26099,13 @@ check_auto_cache_resize_epoch_markers(void) fcn_name, failure_mssg2); } + if ( core_file_driver_failed ) { + + HDfprintf(stdout, + "%s(): Unable to open test file with core file driver.\n", + fcn_name); + } + return !pass2; } /* check_auto_cache_resize_epoch_markers() */ @@ -25865,6 +26218,8 @@ check_auto_cache_resize_input_errs(void) TESTING("automatic cache resize input errors"); + core_file_driver_failed = FALSE; + pass2 = TRUE; /* allocate a cache, and set a reference automatic cache control @@ -28226,6 +28581,13 @@ check_auto_cache_resize_input_errs(void) fcn_name, failure_mssg2); } + if ( core_file_driver_failed ) { + + HDfprintf(stdout, + "%s(): Unable to open test file with core file driver.\n", + fcn_name); + } + return !pass2; } /* check_auto_cache_resize_input_errs() */ @@ -28317,6 +28679,8 @@ check_auto_cache_resize_aux_fcns(void) TESTING("automatic cache resize auxilary functions"); + core_file_driver_failed = FALSE; + pass2 = TRUE; /* allocate a cache, and then test the various auxilary functions. @@ -28810,6 +29174,13 @@ check_auto_cache_resize_aux_fcns(void) fcn_name, failure_mssg2); } + if ( core_file_driver_failed ) { + + HDfprintf(stdout, + "%s(): Unable to open test file with core file driver.\n", + fcn_name); + } + return !pass2; } /* check_auto_cache_resize_aux_fcns() */ @@ -28835,8 +29206,16 @@ check_auto_cache_resize_aux_fcns(void) int main(void) { + hbool_t core_file_forced = FALSE; + hbool_t regular_file_forced = FALSE; + hbool_t core_file_driver_recommended = FALSE; + const char *envval = NULL; unsigned nerrs = 0; + core_file_driver_recommended = recommend_core_file_driver(); + + try_core_file_driver = core_file_driver_recommended; + H5open(); express_test2 = GetTestExpress(); @@ -28850,12 +29229,52 @@ main(void) skip_long_tests2 = FALSE; } - printf("===================================\n"); + envval = HDgetenv("HDF5_DRIVER"); + + if ( envval != NULL ) { + + if ( HDstrcmp(envval, "core") == 0 ) { + + core_file_forced = TRUE; + try_core_file_driver = TRUE; + + } else { + + regular_file_forced = TRUE; + try_core_file_driver = FALSE; + + } + } + + printf("=========================================\n"); printf("Internal cache tests\n"); printf(" express_test = %d\n", express_test2); printf(" skip_long_tests = %d\n", (int)skip_long_tests2); - printf(" use_core_driver = %d\n", USE_CORE_DRIVER); - printf("===================================\n"); + printf(" regular_file_forced = %d\n", (int)regular_file_forced); + printf(" core_file_forced = %d\n", (int)core_file_forced); + printf(" core_file_driver_recommended = %d\n", + (int)core_file_driver_recommended); + printf(" try_core_file_driver = %d\n", (int)try_core_file_driver); + printf("=========================================\n"); + + if ( try_core_file_driver ) { + + printf("\n"); + printf("All the longer cache tests will attempt to use the core file\n"); + printf("driver in an attempt to avoid disk I/O and thereby run the\n"); + printf("tests faster. If a test is unable to to do so, it will\n"); + printf("attempt to run the test using a regular file, and will note\n"); + printf("this fact at test completion.\n"); + printf("\n"); + printf("Shorter tests never attempt to use the core file driver\n"); + printf("as the overhead exceeds the gain\n"); + printf("\n"); + printf("In general, running the longer cache tests with the core\n"); + printf("file driver should speed up the tests significantly.\n"); + printf("However, if the available physical ram is less than 2 GB,\n"); + printf("it may slow the tests down instead.\n"); + printf("\n"); + } #if 1 nerrs += smoke_check_1(); @@ -28872,6 +29291,12 @@ main(void) #if 1 nerrs += write_permitted_check(); #endif + /* for shorter tests, the overhead of using the core file driver doesn't + * seem to allow us to realize any significant time saveings. Thus + * set try_core_file_driver to FALSE for the remaining tests. + */ + try_core_file_driver = FALSE; + nerrs += check_insert_entry(); nerrs += check_flush_cache(); nerrs += check_get_entry_status(); diff --git a/test/cache2_common.c b/test/cache2_common.c index cd49043..691792d 100644 --- a/test/cache2_common.c +++ b/test/cache2_common.c @@ -20,6 +20,8 @@ * implemented in H5C2.c */ +#include "H5private.h" + #include "h5test.h" #include "H5Iprivate.h" #include "H5ACprivate.h" @@ -27,6 +29,7 @@ #include "H5MMprivate.h" #include "cache2_common.h" + /* global variable declarations: */ const char *FILENAME[] = { @@ -35,9 +38,17 @@ const char *FILENAME[] = { NULL }; +hid_t saved_fapl_id = H5P_DEFAULT; /* store the fapl id here between + * cache setup and takedown. Note + * that if saved_fapl_id == H5P_DEFAULT, + * we assume that there is no fapl to + * close. + */ + hid_t saved_fid = -1; /* store the file id here between cache setup * and takedown. */ + H5C2_t * saved_cache2 = NULL; /* store the pointer to the instance of * of H5C2_t created by H5Fcreate() * here between test cache setup and @@ -48,6 +59,8 @@ hbool_t write_permitted2 = TRUE; hbool_t pass2 = TRUE; /* set to false on error */ hbool_t skip_long_tests2 = TRUE; hbool_t run_full_test2 = TRUE; +hbool_t try_core_file_driver = TRUE; +hbool_t core_file_driver_failed = FALSE; const char *failure_mssg2 = NULL; int failures2 = 0; int express_test2 = 0; @@ -1943,6 +1956,82 @@ entry_in_cache2(H5C2_t * cache_ptr, /*------------------------------------------------------------------------- + * Function: recommend_core_file_driver + * + * Purpose: Using the core file driver for test files allows us to avoid + * disk I/O, and thust offers the potential of speeding up + * tests. However, if the target system has insufficient + * physical memory to accomodate the test file, using the + * core file driver will actually slow the test down, as the + * target system will page fault continuously. + * + * The purpose of this function is to determine whether it + * makes sense to use the core file driver on this particular + * system. + * + * To do this, we need to determine a number of facts about + * the host system -- most particularly how much physical + * RAM it has. This information is not always available. + * If it is not, we assume the worst and report that using + * the core file driver would be ill advised. + * + * Return: TRUE If use of the core file driver seems a good idea. + * + * FALSE If available data on the host system suggests that + * user of the core file driver is ill advised, or + * if no information is available upon which to base + * a suggestion. + * + * Programmer: John Mainzer + * 1/13/09 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ + +hbool_t +recommend_core_file_driver(void) +{ + const char * fcn_name = "recommend_core_file_driver()"; + hbool_t core_file_driver_recomended = FALSE; + hbool_t verbose = FALSE; + unsigned long long free_ram = 0; + unsigned long long free_swap = 0; + unsigned long long physical_ram = 0; + + free_ram = H5_get_free_ram(); + free_swap = H5_get_free_swap(); + physical_ram = H5_get_physical_ram(); + + if ( ( physical_ram > ((((unsigned long long)MAX_ADDR) / 5) * 9) ) || + ( ( physical_ram > ((((unsigned long long)MAX_ADDR) / 2) * 3) ) && + ( ( ((unsigned long long)MAX_ADDR) < free_ram ) || + ( ((unsigned long long)MAX_ADDR) < free_swap ) ) ) ) { + + core_file_driver_recomended = TRUE; + } + + if ( verbose ) { + + HDfprintf(stdout, "%s: physical_ram = %lld\n", + fcn_name, (long long)physical_ram); + HDfprintf(stdout, "%s: free_ram = %lld\n", + fcn_name, (long long)free_ram); + HDfprintf(stdout, "%s: free_swap = %lld\n", + fcn_name, (long long)free_swap); + HDfprintf(stdout, "%s: MAX_ADDR = %lld\n", + fcn_name, (long long)MAX_ADDR); + HDfprintf(stdout, "%s: core_file_driver_recomended = %d\n", + fcn_name, (int)core_file_driver_recomended); + } + + return(core_file_driver_recomended); + +} /* recommend_core_file_driver() */ + + +/*------------------------------------------------------------------------- * Function: reset_entries2 * * Purpose: reset the contents of the entries arrays to know values. @@ -2710,28 +2799,45 @@ setup_cache2(size_t max_cache_size, HDfprintf(stdout, "%s() - %0d -- pass2 = %d\n", fcn_name, mile_stone++, (int)pass2); -#if USE_CORE_DRIVER - if ( pass2 ) { + if ( ( pass2 ) && ( try_core_file_driver ) ) { if ( (fapl_id = H5Pcreate(H5P_FILE_ACCESS)) == FAIL ) { pass2 = FALSE; failure_mssg2 = "H5Pcreate(H5P_FILE_ACCESS) failed.\n"; } - else if ( H5Pset_fapl_core(fapl_id, 64 * 1024 * 1024, FALSE) < 0 ) { + else if ( H5Pset_fapl_core(fapl_id, MAX_ADDR, FALSE) < 0 ) { + H5Pclose(fapl_id); + fapl_id = H5P_DEFAULT; pass2 = FALSE; failure_mssg2 = "H5P_set_fapl_core() failed.\n"; } + else if ( (fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) + < 0 ) { + + core_file_driver_failed = TRUE; + + if ( verbose ) { + HDfprintf(stdout, "%s: H5Fcreate() with CFD failed.\n", fcn_name); + } + + } else { + + saved_fapl_id = fapl_id; + } } -#endif /* USE_CORE_DRIVER */ if ( show_progress ) /* 3 */ HDfprintf(stdout, "%s() - %0d -- pass2 = %d\n", fcn_name, mile_stone++, (int)pass2); - if ( pass2 ) { - + /* if we either aren't using the core file driver, or a create + * with the core file driver failed, try again with a regular file. + * If this fails, we are cooked. + */ + if ( ( pass2 ) && ( fid < 0 ) ) { + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); saved_fid = fid; @@ -2744,8 +2850,20 @@ setup_cache2(size_t max_cache_size, if ( verbose ) { HDfprintf(stdout, "%s: H5Fcreate() failed.\n", fcn_name); } + } + } + + if ( show_progress ) /* 4 */ + HDfprintf(stdout, "%s() - %0d -- pass2 = %d\n", + fcn_name, mile_stone++, (int)pass2); + + if ( pass2 ) { + + HDassert( fid >= 0 ); + + saved_fid = fid; - } else if ( H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0 ) { + if ( H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0 ) { pass2 = FALSE; failure_mssg2 = "H5Fflush() failed."; @@ -2770,7 +2888,7 @@ setup_cache2(size_t max_cache_size, } } - if ( show_progress ) /* 4 */ + if ( show_progress ) /* 5 */ HDfprintf(stdout, "%s() - %0d -- pass2 = %d\n", fcn_name, mile_stone++, (int)pass2); @@ -2822,7 +2940,7 @@ setup_cache2(size_t max_cache_size, file_ptr->shared->cache2 = cache_ptr; } - if ( show_progress ) /* 5 */ + if ( show_progress ) /* 6 */ HDfprintf(stdout, "%s() - %0d -- pass2 = %d\n", fcn_name, mile_stone++, (int)pass2); @@ -2848,7 +2966,7 @@ setup_cache2(size_t max_cache_size, } } - if ( show_progress ) /* 6 */ + if ( show_progress ) /* 7 */ HDfprintf(stdout, "%s() - %0d -- pass2 = %d\n", fcn_name, mile_stone++, (int)pass2); @@ -2882,7 +3000,7 @@ setup_cache2(size_t max_cache_size, } } - if ( show_progress ) /* 7 */ + if ( show_progress ) /* 8 */ HDfprintf(stdout, "%s() - %0d -- pass2 = %d\n", fcn_name, mile_stone++, (int)pass2); @@ -2892,7 +3010,7 @@ setup_cache2(size_t max_cache_size, ret_val = file_ptr; } - if ( show_progress ) /* 8 */ + if ( show_progress ) /* 9 */ HDfprintf(stdout, "%s() - %0d -- pass2 = %d\n", fcn_name, mile_stone++, (int)pass2); @@ -2946,6 +3064,12 @@ takedown_cache2(H5F_t * file_ptr, } } + if ( saved_fapl_id != H5P_DEFAULT ) { + + H5Pclose(saved_fapl_id); + saved_fapl_id = H5P_DEFAULT; + } + if ( saved_fid != -1 ) { if ( H5Fclose(saved_fid) < 0 ) { @@ -2958,21 +3082,23 @@ takedown_cache2(H5F_t * file_ptr, saved_fid = -1; } -#if ( USE_CORE_DRIVER == FALSE ) - if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) - == NULL ) { - pass2 = FALSE; - failure_mssg2 = "h5_fixname() failed.\n"; - } + if ( ( ! try_core_file_driver ) || ( core_file_driver_failed ) ) { - if ( HDremove(filename) < 0 ) { + if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) + == NULL ) { - pass2 = FALSE; - failure_mssg2 = "couldn't delete test file."; + pass2 = FALSE; + failure_mssg2 = "h5_fixname() failed.\n"; + } + + if ( HDremove(filename) < 0 ) { + pass2 = FALSE; + failure_mssg2 = "couldn't delete test file."; + + } } -#endif /* USE_CORE_CRIVER */ } return; @@ -3492,7 +3618,7 @@ rename_entry2(H5C2_t * cache_ptr, int32_t idx, hbool_t main_addr) { - const char * fcn_name = "rename_entry2()"; + /* const char * fcn_name = "rename_entry2()"; */ herr_t result; hbool_t done = TRUE; /* will set to FALSE if we have work to do */ haddr_t old_addr = HADDR_UNDEF; @@ -5855,7 +5981,7 @@ check_and_validate_cache_hit_rate(hid_t file_id, pass2 = FALSE; failure_mssg2 = "H5Fget_mdc_hit_rate() failed."; - } else if ( hit_rate != expected_hit_rate ) { + } else if ( ! DBL_REL_EQUAL(hit_rate, expected_hit_rate, 0.00001) ) { pass2 = FALSE; failure_mssg2 = "unexpected hit rate (1)."; diff --git a/test/cache2_common.h b/test/cache2_common.h index 4afde3a..c6f9c55 100644 --- a/test/cache2_common.h +++ b/test/cache2_common.h @@ -33,7 +33,7 @@ #define NO_CHANGE -1 -#define USE_CORE_DRIVER FALSE +#define USE_CORE_DRIVER TRUE /* with apologies for the abuse of terminology... */ @@ -592,6 +592,8 @@ extern hbool_t write_permitted2; extern hbool_t pass2; /* set to false on error */ extern hbool_t skip_long_tests2; extern hbool_t run_full_test2; +extern hbool_t try_core_file_driver; +extern hbool_t core_file_driver_failed; extern const char *failure_mssg2; extern int express_test2; extern int failures2; @@ -809,6 +811,8 @@ void execute_flush_op2(H5F_t * file_ptr, struct flush_op * op_ptr, unsigned * flags_ptr); +hbool_t recommend_core_file_driver(void); + void reset_entries2(void); void resize_entry2(H5F_t * file_ptr, diff --git a/test/cache2_journal.c b/test/cache2_journal.c index 73eba53..1fa0031 100644 --- a/test/cache2_journal.c +++ b/test/cache2_journal.c @@ -5227,15 +5227,97 @@ mdj_smoke_check_02(void) * Purpose: Verify that the example code for using the metadata * journaling works as expected * + * This example demonstrates enabling journaling at file + * creation time, and enabling journaling on an open file. It + * also demonstrates disabling journaling both manualy during a + * computation and automatically at file close. Finally, + * it demonstrates the use of H5Fflush() to keep the journal + * file from becoming too long. + * + * We begin by creating an hdf5 file with journaling enabled. + * + * The inital calls to TESTING(), SKIPPED(), h5_fixname(), + * HDremove(), the initialization of pass2, and the like are all + * part of the HDF5 test framework, and may be largely ignored. + * In your application, the only point here is that you will + * have to set up the paths to your data file and journal + * file. Further, the journal file must not exist before + * the hdf5 file is opened, as hdf5 will refuse to overwrite + * a journal file. + * + * With these preliminaries dealt with, we allocate a + * file access property list (FAPL). Journaling uses some + * recent extensions to the superblock, so the first step + * is to set the library version to latest via a call to + * H5Pset_libver_bounds(). + * + * Next, we must set up the journaling property. We could + * do this in several ways, but in this example we will do + * this by using H5Pget_jnl_config() to get the default + * journaling configuration, modifing it, and then using + * H5Pset_jnl_config() to replace the default with our + * configuration. See the comments in the code for the + * particulars -- note that we must set the version field of + * the H5AC2_jnl_config_t before we call H5Pget_jnl_config(). + * + * After setting up the FAPL, we create the file as usual. + * Journaling will be enabled with configuration as specified. + * + * With file created and journaling running we then go off + * and do what we want -- in this example we set up a selection + * of chunked data sets. Note that these data sets (and our + * access pattern) are chosen to maximize the amount of dirty + * metadata generated. In your application, you will want to + * do just the opposite if possible. + * + * After the data sets are created, we then shut down journaling + * and then re-enable it via the H5Fget_jnl_config() and + * H5Fset_jnl_config() calls. Note that when we re-enable + * journaling via the H5Fset_jnl_config() call, we don't need + * to set all the fields in the H5AC2_jnl_config_t, since we + * are re-using the configuration we obtained via the + * H5Fget_jnl_config() call. If we had opened the file without + * journaling, and then wanted to enable journaling, we would + * have had to set up the fields of the H5AC2_jnl_config_t in + * much the same way we did earlier in the example. We would + * also have had to create the file initially with the latest + * format (using H5Pset_libver_bounds()). + * + * Having re-enabled journaling, we then proceed to write to + * our data sets. Again, please not that our write strategy + * (round robin and small chunks) is designed to maximize + * dirty metadata generation and load on the metadata cache. + * In your application, you should try to do just the opposite + * if possible. + * + * However, since we are maximizing dirty metadata generation, + * the journal file will grow quickly. This can be a problem, + * so from time to time we force truncation of the journal file + * via a call to H5Fflush(). This call flushes the hdf5 file, + * and then truncates the journal file, as the contents of the + * journal becomes irrelvant after the metadata journal is + * flushed. + * + * After writing data to our data sets, we then to a number of + * reads. We could turn off journaling here, as we are not + * modifying the file. But since we are not generating any + * dirty metadata, we aren't generating any journal entries + * either -- so it really doesn't matter. + * + * Finally, we close the hdf5 file. Since journaling is enabled, + * the call to H5Fclose() will flush the journal, flush the + * metadata cache, truncate the journal, mark the file as not + * having journaling in progress, and then delete the journal + * file as part of the close. + * * Return: void * * Programmer: John Mainzer - * 4/14/04 + * 12/14/08 * * Modifications: * - * JRM -- 7/12/06 - * Added progress reporting code. + * None. * *------------------------------------------------------------------------- */ -- cgit v0.12