diff mbox series

[v3,5/5] travis: test ODP with shared DPDK

Message ID 1516759212-29210-6-git-send-email-odpbot@yandex.ru
State Superseded
Headers show
Series [v3,1/5] build: odp_dpdk: another fix for linking with shared libdpdk | expand

Commit Message

Github ODP bot Jan. 24, 2018, 2 a.m. UTC
From: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>


Add testcase compiling and running ODP with shared DPDK lib

Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>

---
/** Email created from pull request 416 (lumag:trav-dpdk-shared)
 ** https://github.com/Linaro/odp/pull/416
 ** Patch: https://github.com/Linaro/odp/pull/416.patch
 ** Base sha: b122176ee59494dd957f0f5ff41d4b55a1477e13
 ** Merge commit sha: eda6bc11b0fade6a40b217608359775c2c7043f8
 **/
 .travis.yml | 48 ++++++++++++++++++++++++++++++++----------------
 1 file changed, 32 insertions(+), 16 deletions(-)
diff mbox series

Patch

diff --git a/.travis.yml b/.travis.yml
index 98d0b0115..7dd7522da 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -14,7 +14,6 @@  group: deprecated-2017Q2
 stages:
   - "build only"
   - test
-env:
 
 addons:
         apt:
@@ -48,6 +47,7 @@  env:
         # for individual commit validation. But you you want to track tests history
         # you need generated new one at https://codecov.io specific for your repo.
         - CODECOV_TOKEN=a733c34c-5f5c-4ff1-af4b-e9f5edb1ab5e
+        - DPDK_VERS="17.08"
     matrix:
         - CONF=""
         - CONF="--disable-abi-compat"
@@ -57,6 +57,7 @@  env:
         - CONF="--enable-schedule-scalable"
         - CONF="--enable-dpdk-zero-copy"
         - CONF="--disable-static-applications"
+        - DPDK_SHARED="y" CONF="--disable-static-applications"
         - CROSS_ARCH="arm64"
         - CROSS_ARCH="armhf" CFLAGS="-march=armv7-a"
         - CROSS_ARCH="powerpc"
@@ -160,7 +161,6 @@  install:
         - gem install asciidoctor
 
         # DPDK pktio. Note that cache must be purged if dpdk version changes.
-        - DPDK_VERS="17.08"
         - |
           CACHED_DPDK_VERS=`fgrep Version dpdk/pkg/dpdk.spec | cut -d " " -f 2`
           if [ "${CACHED_DPDK_VERS}" != "${DPDK_VERS}" ]; then
@@ -169,43 +169,53 @@  install:
         - |
           case "$CROSS_ARCH" in
             "arm64")
-              TARGET="arm64-armv8a-linuxapp-gcc"
+              DPDK_TARGET="arm64-armv8a-linuxapp-gcc"
               ;;
             "armhf")
-              TARGET="arm-armv7a-linuxapp-gcc"
+              DPDK_TARGET="arm-armv7a-linuxapp-gcc"
               ;;
             "i386")
-              TARGET="i686-native-linuxapp-gcc"
+              DPDK_TARGET="i686-native-linuxapp-gcc"
               ;;
             "")
-              TARGET="x86_64-native-linuxapp-gcc"
+              DPDK_TARGET="x86_64-native-linuxapp-gcc"
               DPDK_MACHINE=snb
               ;;
           esac
         - |
-          if [ -n "$TARGET" ] ; then
-           if [ ! -f "dpdk/${TARGET}/lib/libdpdk.a" ] ; then
+          if [ -n "$DPDK_TARGET" ] ; then
+           if [ -n "$DPDK_SHARED" ] ; then
+            TARGET="$DPDK_TARGET"-shared
+            LIBDPDKEXT=so
+            export LD_LIBRARY_PATH="`pwd`/${TARGET}:$LD_LIBRARY_PATH"
+            echo $LD_LIBRARY_PATH
+           else
+            TARGET="$DPDK_TARGET"
+            LIBDPDKEXT=a
+           fi
+           if [ ! -f "dpdk/${TARGET}/lib/libdpdk.$LIBDPDKEXT" ]; then
             git -c advice.detachedHead=false clone -q --depth=1 --single-branch --branch=v${DPDK_VERS} http://dpdk.org/git/dpdk dpdk
             pushd dpdk
             git log --oneline --decorate
-            echo $CC
             # AArch64 && ARMv7 fixup
             sed -i -e 's/40900/40800/g' lib/librte_eal/common/include/arch/arm/rte_vect.h
             sed -i -e 's/!(/!(defined(__arm__) \&\& defined(__clang__) || /g' lib/librte_eal/common/include/arch/arm/rte_byteorder.h
             sed -i -e 's/__GNUC__/defined(__arm__) \&\& defined(__clang__) || __GNUC__/' lib/librte_eal/common/include/generic/rte_byteorder.h
-            make config T=${TARGET} O=${TARGET}
+            make config T=${DPDK_TARGET} O=${TARGET}
             pushd ${TARGET}
             sed -ri 's,(CONFIG_RTE_LIBRTE_PMD_PCAP=).*,\1y,' .config
-            cat .config |grep RTE_MACHINE
             if test -n "${DPDK_MACHINE}" ; then
               sed -ri 's,(CONFIG_RTE_MACHINE=).*,\1"'${DPDK_MACHINE}'",' .config
             fi
+            if test -n "${DPDK_SHARED}" ; then
+              sed -ri 's,(CONFIG_RTE_BUILD_SHARED_LIB=).*,\1y,' .config
+            fi
             if test -n "$CROSS_ARCH" ; then
               sed -ri -e 's,(CONFIG_RTE_EAL_IGB_UIO=).*,\1n,' .config
               sed -ri -e 's,(CONFIG_RTE_KNI_KMOD=).*,\1n,' .config
             fi
             popd
-            make install T=${TARGET} EXTRA_CFLAGS="-fPIC $DPDK_CFLAGS" CROSS="$DPDK_CROSS" -j $(nproc)
+            make build T=${DPDK_TARGET} O=${TARGET} EXTRA_CFLAGS="-fPIC $DPDK_CFLAGS" CROSS="$DPDK_CROSS" -j $(nproc)
             rm -r ./doc ./${TARGET}/app ./${TARGET}/build
             popd
            fi
@@ -244,11 +254,17 @@  script:
         - pushd $HOME
         - echo "Dynamic link.."
         - ${CC} ${CFLAGS} ${OLDPWD}/example/hello/odp_hello.c -o odp_hello_inst_dynamic `PKG_CONFIG_PATH=${HOME}/odp-install/lib/pkgconfig:${PKG_CONFIG_PATH} pkg-config --cflags --libs libodp-linux`
-        - echo "Static link.."
-        - ${CC} ${CFLAGS} ${OLDPWD}/example/hello/odp_hello.c -o odp_hello_inst_static `PKG_CONFIG_PATH=${HOME}/odp-install/lib/pkgconfig:${PKG_CONFIG_PATH} pkg-config --cflags --libs libodp-linux --static` -static
         - if [ -z "$CROSS_ARCH" ] ; then
-          LD_LIBRARY_PATH="${HOME}/odp-install/lib:$LD_LIBRARY_PATH" ./odp_hello_inst_dynamic ;
-          ./odp_hello_inst_static ;
+            LD_LIBRARY_PATH="${HOME}/odp-install/lib:$LD_LIBRARY_PATH" ./odp_hello_inst_dynamic ;
+          fi
+        - |
+          # it is not possible to do static linking if we only have shared DPDK library. Compiler complains about missing -ldpdk
+          if [ -z "$TARGET" -o -z "$DPDK_SHARED" ] ; then
+            echo "Static link.."
+            ${CC} ${CFLAGS} ${OLDPWD}/example/hello/odp_hello.c -o odp_hello_inst_static `PKG_CONFIG_PATH=${HOME}/odp-install/lib/pkgconfig:${PKG_CONFIG_PATH} pkg-config --cflags --libs libodp-linux --static` -static || exit 1
+            if [ -z "$CROSS_ARCH" ] ; then
+            ./odp_hello_inst_static;
+            fi
           fi
         - popd
         - ccache -s