diff options
author | Anders Roxell <anders.roxell@linaro.org> | 2014-11-29 23:25:57 +0100 |
---|---|---|
committer | Anders Roxell <anders.roxell@linaro.org> | 2015-01-03 02:05:26 +0100 |
commit | 0dafec9f0d0101bbddb9e2bfe193e177451e7e13 (patch) | |
tree | cd0ab81e7509ad86658954474e89ff4cd1df4d7d | |
parent | 41aa35a0cd2ee7c87c27500e4dd0ac1a00faa9b3 (diff) |
refactoring: merge cross-compile-test and make-test
Delete cross-compile-test.sh and only use make-test.sh
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
-rw-r--r-- | README | 11 | ||||
-rwxr-xr-x | cross-compile-test.sh | 57 | ||||
-rw-r--r-- | helper/coverity | 25 | ||||
-rw-r--r-- | helper/ks2 | 5 | ||||
-rw-r--r-- | helper/openssl | 13 | ||||
-rw-r--r-- | helper/toolchain | 13 | ||||
-rwxr-xr-x | make-test.sh | 46 |
7 files changed, 76 insertions, 94 deletions
@@ -1,7 +1,6 @@ # This repository were created for building the OpenDataPlane (ODP) project # daily in a continues integration (CI) system. # -# make-test.sh and cross-compile-test.sh builds ODP from the upstream project. # make-ks2-test.sh builds from keystone2's ODP repository # make-dpdk-test.sh builds from DPDK's ODP repository # make-netmap-test.sh builds from netmap's ODP repository @@ -15,9 +14,11 @@ $ apt-get install build-essential git-core lib32stdc++6 lib32z1 graphviz gcc-mul # For ODP: $ apt-get install autoconf automake libtool doxygen texlive-full libssl-dev -# build ODP native +# build ODP # type make-test.sh -h to see what environment variables you can change. # Most of the time default setup are enough. + +# build ODP native $ ./make-test.sh # one example to run from a local git url @@ -53,9 +54,5 @@ $ git_repo=file:///home/anders/src/odp tests=clang ./make-ssc.sh $ PATCH_DIR=/home/anders/test-patches ./apply-and-build.sh # cross compile ODP -# type cross-compile-test.sh -h to see what environment variables you can change. -# Most of the time default setup are enough. -$ ./cross-compile-test.sh - # one example to run with another ARCH -$ ARCH=arm64 ./cross-compile-test.sh +$ ARCH=arm64 ./make-test.sh diff --git a/cross-compile-test.sh b/cross-compile-test.sh deleted file mode 100755 index 52860cf..0000000 --- a/cross-compile-test.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash -set -e - -export parent_workspace="${parent_workspace:-"/mnt/ci_build/workspace/odp-api-check"}" -ROOT_DIR=$(readlink -f $(dirname $0)) -export CLEANUP="${CLEANUP:-1}" - -source ${ROOT_DIR}/helper/toolchain -source ${ROOT_DIR}/helper/openssl -source ${ROOT_DIR}/helper/cunit -source ${ROOT_DIR}/helper/coverity - -cd $ROOT_DIR - -usage_cross_compile() { - ./make-test.sh -h - tc_usage - cunit_usage -} - -if [[ "x$1" = "x-h" || "x$1" = "x--help" ]]; then - usage_cross_compile - exit 0 -fi - -trap cleanup_exit_cross_compile INT TERM EXIT - -cleanup_exit_cross_compile() -{ - if [[ ${CLEANUP} -eq 1 ]]; then - tc_cleanup - openssl_cleanup - cunit_cleanup - fi -} - -build_odp() -{ - pushd ${ROOT_DIR} - export CROSS_HOST="--host=${compiler_prefix}" - if [ "$COV_DIR" != "" ]; then - get_coverity - fi - ./make-test.sh - [[ $? -eq 1 ]] && exit 1 - popd -} - -find_toolchain_to_download -install_custom_toolchain -setup_compiler_prefix -build_openssl -build_cunit - -build_odp - -## vim: set sw=4 sts=4 et foldmethod=syntax : ## diff --git a/helper/coverity b/helper/coverity index 378feb6..fe4ea12 100644 --- a/helper/coverity +++ b/helper/coverity @@ -1,8 +1,27 @@ -[ -n "$COVERTITY_HELPER" ] && return || readonly COVERTITY_HELPER=1 +[ -n "$COVERITY_HELPER" ] && return || readonly COVERITY_HELPER=1 -get_coverity(){ +coverity_usage() { + echo -e "\tCOV_DIR:\t path to coverty, default: not set" +} + +coverity_prepare() { PATH="$COV_DIR:$PATH" - cov-configure --comptype gcc --compiler ${tcbindir}/${compiler_prefix}-gcc + if [[ -n ${COV_DIR} && -n ${ARCH} ]]; then + pushd ${ROOT_DIR} + cov-configure --comptype gcc --compiler ${tcbindir}/${compiler_prefix}-gcc + popd + fi +} + +coverity_build() { + cov-build --dir ${ROOT_DIR}/cov-int make + pushd ${ROOT_DIR} + tar -czvf ${ROOT_DIR}/${PLATFORM}-cov-int.tgz ./cov-int + popd +} + +coverity_cleanup() { + rm -rf $ROOT_DIR/cov-int } ## vim: set ft=sh sw=4 sts=4 et foldmethod=syntax : ## @@ -13,14 +13,9 @@ GIT_KS_MANIFEST=${GIT_KS_MANIFEST:-git://git.linaro.org/people/taras.kondratiuk/ ks2_cleanup(){ rm -rf ${ROOT_DIR_KS} - tc_cleanup - openssl_cleanup - cunit_cleanup } ks2_usage(){ - tc_usage - cunit_usage echo -e "\tGIT_KS_MANIFEST: which KS manifest git repo to use" } diff --git a/helper/openssl b/helper/openssl index c00e9a6..5adc080 100644 --- a/helper/openssl +++ b/helper/openssl @@ -3,14 +3,25 @@ #openssl vars OPENSSL_BUILD_FAILED=0 OPENSSL_GIT=${OPENSSL_GIT:-git://git.openssl.org/openssl.git} -OPENSSL_BRANCH="OpenSSL_1_0_1h" BASE_ARCH=${ARCH:-$(uname -m)} export OPENSSL_SRCDIR=${ROOT_DIR}/openssl export OPENSSL_INSTALLDIR=${OPENSSL_INSTALLDIR:-${ROOT_DIR}/installed/${BASE_ARCH}/openssl-${OPENSSL_BRANCH}} +OPENSSL_BRANCH=${OPENSSL_BRANCH:-OpenSSL_1_0_1h} +export OPENSSL_BUILD=${OPENSSL_BUILD:-0} + +openssl_usage() { + echo -e "\tOPENSSL_BUILD:\t build custom openssl, default: ${OPENSSL_BUILD}" + echo -e "\tOPENSSL_GIT:\t git url to OpenSSL, default ${OPENSSL_GIT}" + echo -e "\tOPENSSL_BRANCH:\t git branch to OpenSSL, default ${OPENSSL_BRANCH}" + +} build_openssl() { echo "Building ${OPENSSL_BRANCH}" + [[ -n ${ARCH} ]] && export OPENSSL_BUILD=1 + [[ ${OPENSSL_BUILD} -ne 1 ]] && return + export EXTRA_FLAGS="${EXTRA_FLAGS} --with-openssl-path=${OPENSSL_INSTALLDIR}" [[ -f ${OPENSSL_INSTALLDIR}/lib/libcrypto.a ]] && return diff --git a/helper/toolchain b/helper/toolchain index ffb4640..1799c58 100644 --- a/helper/toolchain +++ b/helper/toolchain @@ -1,12 +1,11 @@ [ -n "$TOOLCHAIN_HELPER" ] && return || readonly TOOLCHAIN_HELPER=1 -export ARCH=${ARCH:-arm} export TOOLCHAIN_RELEASE="${TOOLCHAIN_RELEASE:-14.09}" tc_usage() { - echo -e "\tARCH:\t\t which arch to build (arm, armeb, arm64, arm64be), default: ${ARCH}" echo -e "\tTOOLCHAIN_RELEASE: set toolchain release, default: ${TOOLCHAIN_RELEASE}" + echo -e "\t\t\t Only used when ARCH is given!" echo -e "\t\t\t Linaros toolchain releases are located here:" echo -e "\t\t\t http://releases.linaro.org/${TOOLCHAIN_RELEASE}/components/toolchain/binaries/" } @@ -52,6 +51,16 @@ setup_compiler_prefix() export CROSS_COMPILE=${compiler_prefix}- } +toolchain_prepare() +{ + [[ -z ${ARCH} ]] && return + + find_toolchain_to_download + install_custom_toolchain + setup_compiler_prefix + export CROSS_HOST="--host=${compiler_prefix}" +} + tc_cleanup(){ rm -rf ${ROOT_DIR}/gcc-linaro-* } diff --git a/make-test.sh b/make-test.sh index 448a6a5..9191cf9 100755 --- a/make-test.sh +++ b/make-test.sh @@ -1,11 +1,14 @@ #!/bin/bash set -e +[[ -n ${ARCH} ]] && export ARCH + ROOT_DIR=$(readlink -f $(dirname $0)) -cd ${ROOT_DIR} -source ${ROOT_DIR}/helper/cunit +source ${ROOT_DIR}/helper/toolchain source ${ROOT_DIR}/helper/openssl +source ${ROOT_DIR}/helper/cunit +source ${ROOT_DIR}/helper/coverity # CROSS_HOST need to be exported # EXTRA_FLAGS need to be exported @@ -27,13 +30,17 @@ GLOBAL_DSTDIRPATH="$ROOT_DIR/new-build" DSTDIR="--prefix=${GLOBAL_DSTDIRPATH}" usage() { + echo -e "\tARCH:\t\t which arch to build (arm, armeb, arm64, arm64be), default: not set" echo -e "\tGIT_ODP:\t which ODP git repo to use, default: ${GIT_ODP}" echo -e "\tGIT_BRANCH:\t which branch to checkout and test, default: ${GIT_BRANCH}" - echo -e "\tCOV_DIR:\t path to coverty, default: not set" - echo -e "\tCLEANUP:\t to save workspace set CLEANUP=0, default: ${CLEANUP}" + tc_usage + cunit_usage + openssl_usage + coverity_usage echo -e "\tGCOV:\t\t to genrate gcov set GCOV=1, default: ${GCOV}" echo -e "\tBUILD_OPENSSL:\t build custom openssl, default: ${BUILD_OPENSSL}" echo -e "\tNUM_CPUS:\t add parallel make, default: _NPROCESSORS_ONLN" + echo -e "\tCLEANUP:\t to save workspace set CLEANUP=0, default: ${CLEANUP}" } if [[ "x$1" = "x-h" || "x$1" = "x--help" ]]; then @@ -46,38 +53,37 @@ trap cleanup_exit INT TERM EXIT cleanup_exit() { if [[ ${CLEANUP} -eq 1 ]]; then - cd $ROOT_DIR rm -rf ${ODP_DIR} - rm -rf new-build - rm -rf toolchain - rm -rf gcc-linaro-arm* - if [ "$COV_DIR" != "" ]; then - rm -rf cov-int - fi + rm -rf $ROOT_DIR/new-build + rm -rf $ROOT_DIR/gcc-linaro-arm* if [ "$GCOV" == "1" ]; then rm -rf ${ROOT_DIR}/${PLATFORM}-coverage.info fi cunit_cleanup + tc_cleanup + openssl_cleanup + coverity_cleanup fi } +toolchain_prepare -[[ ${BUILD_OPENSSL} -eq 1 ]] && build_openssl +build_openssl build_cunit echo "pulling from $GIT_ODP" echo "branch $GIT_BRANCH" git clone --depth 1 -b ${GIT_BRANCH} ${GIT_ODP} ${ODP_DIR} -cd ${ODP_DIR} +# Run cross compile coverty +coverity_prepare + +pushd ${ODP_DIR} ./bootstrap ./configure ${GPLATFORM} ${DSTDIR} ${CROSS_HOST} ${EXTRA_FLAGS} if [ "$COV_DIR" != "" ]; then - PATH="$COV_DIR:$PATH" - cov-build --dir ${ROOT_DIR}/cov-int make - cd ${ROOT_DIR} - tar -czvf ${ROOT_DIR}/${PLATFORM}-cov-int.tgz ./cov-int + coverity_build elif [ "$GCOV" == "1" ]; then make check CFLAGS="-fprofile-arcs -ftest-coverage" lcov -c -d ${ROOT_DIR}/odp/platform/${PLATFORM} --output-file ${ROOT_DIR}/${PLATFORM}-coverage.info @@ -85,14 +91,16 @@ elif [ "$GCOV" == "1" ]; then else make -j ${NUM_CPUS} make install - cd ${ODP_DIR} git clean -xdf ./bootstrap mkdir ${ODP_DIR}/testdir - cd ${ODP_DIR}/testdir + pushd ${ODP_DIR}/testdir ../configure ${GPLATFORM} ${DSTDIR} ${CROSS_HOST} ${EXTRA_FLAGS} make -j ${NUM_CPUS} make install + popd fi +popd + ## vim: set sw=4 sts=4 et foldmethod=syntax : ## |