3 binary="build/testlinkage"
5 basedir=$(dirname "$0")
6 . "${basedir}"/check-dpdk-supported-arch.sh
8 cat > testlinkage.c << EOF
10 #include <rte_common.h>
14 printf("Hello rte_exit %p\n", rte_exit);
19 cat > Makefile-testlinkage << 'EOF'
20 # Based on examples/helloworld/Makefile
23 $(error "Please define RTE_SDK environment variable")
26 # Default target, can be overridden by command line or environment
27 RTE_TARGET ?= x86_64-native-linuxapp-gcc
29 include $(RTE_SDK)/mk/rte.vars.mk
34 # all source are stored in SRCS-y
35 SRCS-y := testlinkage.c
38 CFLAGS += $(WERROR_FLAGS)
40 include $(RTE_SDK)/mk/rte.extapp.mk
44 printf "\n\nSet up DPDK'ish build environment\n"
45 . /usr/share/dpdk/dpdk-sdk-env.sh
46 export CFLAGS=$(pkg-config --libs --cflags libdpdk)
48 # -ldpdk actually refers to a linker script now, not a real .so
49 # with broken linkage this will fail with undefined symbols
50 printf "\n\nChecking compile with link against DPDK\n"
51 make V=1 -f Makefile-testlinkage
54 printf "\n\nLinkage info\n"
57 printf "\n\nChecking for expected internal libraries\n"
58 # a few of the sublibs that it should use
59 lddtree ${binary} | grep '^ librte_eal.so'
62 printf "\n\nChecking for expected feature dependent library dependencies\n"
63 # features only used by the lib that we enabled
64 ldd /usr/lib/*/librte_pmd_pcap.so | grep libpcap
67 printf "\n\nChecking test execution\n"
68 # It doesn't do much, but it should work - so calling it is a minor extra test.
69 # It is known to fail without SSE3 in e.g. some adt environments, in that
70 # case check at least that we get the correct error message (this will trigger
71 # a test fail if it neither finds the success nor the expected error message)
72 (./${binary} 2>&1 || /bin/true ) | \
73 grep -E 'ERROR: This system does not support "SSSE3".|Hello rte_exit 0x'