Merge branch 'upstream-16.11-stable' into 16.11.x
[deb_dpdk.git] / debian / tests / test-linkage
1 #!/bin/bash
2 set -eu
3
4 basedir=$(dirname "$0")
5 . "${basedir}"/check-dpdk-supported-arch.sh
6
7 cat > testlinkage.c << EOF
8 #include <stdio.h>
9 #include "dpdk/rte_common.h"
10
11 int main()
12 {
13         printf("Hello rte_exit %p\n", rte_exit);
14         return 0;
15 }
16 EOF
17
18 # -ldpdk actually refers to a linker script now, not a real .so
19 # with broken linkage this will fail with undefined symbols
20 printf "\n\nChecking compile with link against DPDK\n"
21 gcc -v testlinkage.c -o testlinkage.bin -Wall -Werror -ldpdk
22 echo "OK"
23
24 printf "\n\nLinkage info\n"
25 lddtree testlinkage.bin
26
27 printf "\n\nChecking for expected internal libraries\n"
28 # a few of the sublibs that it should use
29 lddtree testlinkage.bin | grep '^    librte_eal.so'
30 echo "OK"
31
32 printf "\n\nChecking for expected secondary library dependencies\n"
33 lddtree testlinkage.bin | grep '^        libpthread.so'
34 echo "OK"
35
36 printf "\n\nChecking for expected feature dependent library dependencies\n"
37 # features only used by the lib that we enabled
38 ldd /usr/lib/*/librte_pmd_pcap.so | grep libpcap
39 echo "OK"
40
41 printf "\n\nChecking test execution\n"
42 # It doesn't do much, but it should work - so calling it is a minor extra test.
43 # It is known to fail without SSE3 in e.g. some adt environments, in that
44 # case check at least that we get the correct error message (this will trigger
45 # a test fail if it neither finds the success nor the expected error message)
46 (./testlinkage.bin 2>&1 || /bin/true ) | \
47 grep -E 'ERROR: This system does not support "SSSE3".|Hello rte_exit 0x'
48
49 echo "OK"