summaryrefslogtreecommitdiffstats
path: root/test/testlibinfo.sh.in
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2009-09-21 05:28:44 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2009-09-21 05:28:44 (GMT)
commit1d2bf10ae704d08b03ce9f86234e81368549ba3e (patch)
treee3acb5907b24c0b624334b15a961eb9e1a69dbe4 /test/testlibinfo.sh.in
parent22d4097ff71fcdb7fbc505d3296f63943251ffd3 (diff)
downloadhdf5-1d2bf10ae704d08b03ce9f86234e81368549ba3e.zip
hdf5-1d2bf10ae704d08b03ce9f86234e81368549ba3e.tar.gz
hdf5-1d2bf10ae704d08b03ce9f86234e81368549ba3e.tar.bz2
[svn-r17502] Purpose:
Stage 2 implementation of embedded library information feature. H5.c: added code to print the embedded library information when there is a library versions mis-match occurs. This ensures the library information string is included in the executable. Also modifies the code so that the Library mismatch warning string is included only once in the executable. H5private.h: Added a global reference to the libinfo string variable to prepare for possible stage 3 implementation of a public API. test/testlibinfo.sh.in: A new test added to verify the library information is indeed included in the executables. configure.in: configure: Added entry to auto-generate test/testlibinfo.sh. H5detect.c: Modified the libhdf5settings generating code to allow it to insert the strings to a file other than stdout. This maybe needed in stage 3 implementation. MANIFEST: updated with the newly added file of testlibinfo.sh.in. Tested: h5committest passed. Additional tests: jam serial; jam --disable-embedded-libinfo; jam --disable-shared. All passed.
Diffstat (limited to 'test/testlibinfo.sh.in')
-rw-r--r--test/testlibinfo.sh.in116
1 files changed, 116 insertions, 0 deletions
diff --git a/test/testlibinfo.sh.in b/test/testlibinfo.sh.in
new file mode 100644
index 0000000..d8cd7e5
--- /dev/null
+++ b/test/testlibinfo.sh.in
@@ -0,0 +1,116 @@
+#! /bin/sh
+#
+# Copyright by The HDF Group.
+# Copyright by the Board of Trustees of the University of Illinois.
+# All rights reserved.
+#
+# This file is part of HDF5. The full HDF5 copyright notice, including
+# terms governing use, modification, and redistribution, is contained in
+# the files COPYING and Copyright.html. COPYING can be found at the root
+# of the source code distribution tree; Copyright.html can be found at the
+# root level of an installed copy of the electronic HDF5 document set and
+# is linked from the top-level documents page. It can also be found at
+# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have
+# access to either file, you may request a copy from help@hdfgroup.org.
+
+
+#
+# Tests for the embedded library information feature.
+# Part 1:
+# Verify the HDF5 library does contains an exact copy of the content of the
+# libhdf5.settings file.
+# Part 2:
+# If executable is linked with the static hdf5 library (how to determine?),
+# verify an executable indeed contains an exact copy of hte content of the
+# libhdf5.settings file.
+#
+# Programmer: Albert Cheng
+# Sep 18, 2009
+
+# Determine the configure options of the hdf5 library and executables.
+
+Shared_Lib=@enable_shared@
+Static_Lib=@enable_static@
+Static_exec=@STATIC_EXEC@
+
+
+# Print a line-line message left justified in a field of 70 characters.
+#
+LINEMSG() {
+ SPACES=" "
+ echo "Check file $* $SPACES" | cut -c1-70 | tr -d '\012'
+}
+
+
+# Print a "SKIP" message
+SKIP() {
+ LINEMSG $*
+ echo " -SKIP-"
+}
+
+# Function definitions
+CHECK_LIBINFO(){
+ LINEMSG $1
+ if strings $1 | grep "SUMMARY OF THE HDF5 CONFIGURATION" > /dev/null; then
+ echo " PASSED"
+ else
+ echo " FAILED"
+ nerrors=`expr $nerrors + 1`
+ fi
+}
+
+
+# MAIN Body
+nerrors=0
+H5_HAVE_EMBEDDED_LIBINFO=`grep '#define H5_HAVE_EMBEDDED_LIBINFO ' ../src/H5pubconf.h`
+
+# Skip the rest if embedded-libinfo is not enabled.
+if [ -z "$H5_HAVE_EMBEDDED_LIBINFO" ]; then
+ echo "embedded-libinfo is not enabled. Test skipped."
+ exit 0
+fi
+
+# The location of HDF library file(s) depends on whether shared lib is
+# built too.
+if [ -n $Shared_Lib ]; then
+ h5libdir=../src/.libs
+else
+ h5libdir=../src
+fi
+
+h5libsettings=../src/libhdf5.settings
+
+# Part 1:
+# Verify the HDF5 library does contains an exact copy of the content of the
+# libhdf5.settings file.
+# Check dynamic library file if built.
+if [ x-$Shared_Lib = x-yes ]; then
+ CHECK_LIBINFO ${h5libdir}/libhdf5.so
+else
+ SKIP ${h5libdir}/libhdf5.so
+fi
+
+# Though rare, libhdf5.a may not have been built.
+if [ x-$Static_Lib = x-yes ]; then
+ CHECK_LIBINFO ${h5libdir}/libhdf5.a
+else
+ SKIP ${h5libdir}/libhdf5.a
+fi
+
+# Check if executables has the lib information only if shared lib is not
+# built or static-exec is used. (Don't care static-exec since it affects
+# tools binary only.)
+if [ x-$Shared_Lib != x-yes ]; then
+ CHECK_LIBINFO testhdf5
+else
+ SKIP testhdf5
+fi
+
+
+if [ $nerrors -gt 0 ]; then
+ echo "***$nerrors errors encountered***"
+ exit 1
+else
+ echo "No error encountered"
+ exit 0
+fi