diff mbox series

[v2,3/3] travis: test ODP with shared DPDK

Message ID 1516669211-12088-4-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [v2,1/3] build: another fix for linking with shared libdpdk | expand

Commit Message

Github ODP bot Jan. 23, 2018, 1 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: 91127f4ec35dafb800211b84e2fa8992d7b6d216
 **/
 .travis.yml | 29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/.travis.yml b/.travis.yml
index fca06a0d2..0f39a85fe 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -75,6 +75,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"
@@ -198,7 +199,14 @@  install:
           esac
         - |
           if [ -n "$TARGET" ] ; then
-           if [ ! -f "dpdk/${TARGET}/lib/libdpdk.a" ] ; then
+           # force DPDK rebuild if it does not match shared/non-shared requirement
+           if [ -n "$DPDK_SHARED" -a ! -f "dpdk/${TARGET}/lib/libdpdk.so" ] ; then
+            rm -rf dpdk/"$TARGET"
+           fi
+           if [ -z "$DPDK_SHARED" -a ! -f "dpdk/${TARGET}/lib/libdpdk.a" ] ; then
+            rm -rf dpdk/"$TARGET"
+           fi
+           if [ ! -f "dpdk/${TARGET}/lib/libdpdk.a" -a ! -f "dpdk/${TARGET}/lib/libdpdk.so" ]; 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
@@ -214,6 +222,11 @@  install:
             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
+              export LD_LIBRARY_PATH="`pwd`/${TARGET}:$LD_LIBRARY_PATH"
+              echo $LD_LIBRARY_PATH
+            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
@@ -258,11 +271,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
+        - echo "Static link.."
+        - |
+          # 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
+            ${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 || exit 1;
+            fi
           fi
         - popd
         - ccache -s