summaryrefslogtreecommitdiff
path: root/test.d/libproxy_proxy_and_lib.test
blob: f851e6818a628f9c52a23575454902ca7ab53747 (plain)
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
#!/bin/sh
# $Id$

lib=$(/sbin/ldconfig -p 2>/dev/null | awk '/libproxy.so /{print $NF}')
proxy=$(which proxy 2>/dev/null)
build=src/bin/proxy

# Make sure libproxy is built and a valid dynamic library
if ! nm $lib 2>/dev/null | grep -qs _DYNAMIC; then
    nm src/lib/.libs/libproxy.so 2>/dev/null | grep -qs _DYNAMIC
    if [ $? -eq 0 ]; then
        # Try to be intelligent and use the library in the build dir
        # before we start running the rest of the tests
        export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:src/lib/.libs"
        lib=src/lib/.libs/libproxy.so
    fi
fi  

# Prefer the freshly built version over the installed version
if [ ! -x "$proxy" -a -x $build ]; then
    proxy=$build
fi  

if [ "$proxy" -a "$lib" ]; then
    echo pass=True
else
    echo pass=False
    echo 'reason="unable to access the library, try: make"'
fi