aboutsummaryrefslogtreecommitdiffstats
path: root/debian/tests/test-linkage
blob: a49eeddad5dd56ae4c4c2c233f7f3419ab2d1dcb (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
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
#!/bin/bash
set -eux
binary="build/testlinkage"

basedir=$(dirname "$0")
. "${basedir}"/check-dpdk-supported-arch.sh

cat > testlinkage.c << EOF
#include <stdio.h>
#include <rte_common.h>

int main(void)
{
        printf("Hello rte_exit %p\n", rte_exit);
        return 0;
}
EOF

cat >  Makefile-testlinkage << 'EOF'
# Based on examples/helloworld/Makefile

ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif

# Default target, can be overridden by command line or environment
RTE_TARGET ?= x86_64-native-linuxapp-gcc

include $(RTE_SDK)/mk/rte.vars.mk

# binary name
APP = testlinkage

# all source are stored in SRCS-y
SRCS-y := testlinkage.c

CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)

include $(RTE_SDK)/mk/rte.extapp.mk
EOF


printf "\n\nSet up DPDK'ish build environment\n"
. /usr/share/dpdk/dpdk-sdk-env.sh
export CFLAGS=$(pkg-config --libs --cflags libdpdk)

# -ldpdk actually refers to a linker script now, not a real .so
# with broken linkage this will fail with undefined symbols
printf "\n\nChecking compile with link against DPDK\n"
make V=1 -f Makefile-testlinkage
echo "OK"

printf "\n\nLinkage info\n"
lddtree ${binary}

printf "\n\nChecking for expected internal libraries\n"
# a few of the sublibs that it should use
lddtree ${binary} | grep '^    librte_eal.so'
echo "OK"

printf "\n\nChecking for expected feature dependent library dependencies\n"
# features only used by the lib that we enabled
ldd /usr/lib/*/librte_pmd_pcap.so | grep libpcap
echo "OK"

printf "\n\nChecking test execution\n"
# It doesn't do much, but it should work - so calling it is a minor extra test.
# It is known to fail without SSE3 in e.g. some adt environments, in that
# case check at least that we get the correct error message (this will trigger
# a test fail if it neither finds the success nor the expected error message)
(./${binary} 2>&1 || /bin/true ) | \
grep -E 'ERROR: This system does not support "SSSE3".|Hello rte_exit 0x'

echo "OK"