File: testlibinfo.sh.in

package info (click to toggle)
hdf5 1.10.0-patch1+docs-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 143,572 kB
  • ctags: 38,562
  • sloc: ansic: 472,614; f90: 28,734; java: 27,116; xml: 17,791; sh: 16,757; cpp: 14,937; makefile: 1,769; perl: 1,339; yacc: 338; lex: 184; ruby: 24
file content (122 lines) | stat: -rw-r--r-- 3,432 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#! /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

srcdir=@srcdir@

# 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
    # Some systems, like Mac, the strings command inspects library files. Older
    # versions of strings may not know newer library format, resulting in
    # command errors. Make it read the file as stdin to avoid the problem.
    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
   shlib=$(grep dlname ../src/libhdf5@FLAVOR@.la | sed -e "s/dlname='//" -e "s/'//")
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}/${shlib}
else
    SKIP shlib
fi

# Though rare, libhdf5.a may not have been built.
if [ x-$Static_Lib = x-yes ]; then
    CHECK_LIBINFO ${h5libdir}/libhdf5@FLAVOR@.a
else
    SKIP ${h5libdir}/libhdf5@FLAVOR@.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