[toranj] improve code coverage by using absolute path (#4491)

Gcov sometimes cannot correctly find source files when the code is
configured with relative path. This commit enables using absolute path
to run toranj tests.
This commit is contained in:
Yakun Xu
2020-01-23 19:45:51 -08:00
committed by Jonathan Hui
parent b0a89c4083
commit 8d22fdd09c
4 changed files with 18 additions and 8 deletions
+2 -2
View File
@@ -182,11 +182,11 @@ jobs:
os: linux os: linux
compiler: gcc compiler: gcc
script: .travis/script.sh script: .travis/script.sh
- env: BUILD_TARGET="toranj-test-framework" VERBOSE=1 - env: BUILD_TARGET="toranj-test-framework" COVERAGE=1 VERBOSE=1
os: linux os: linux
compiler: gcc compiler: gcc
script: .travis/script.sh script: .travis/script.sh
- env: BUILD_TARGET="toranj-test-framework" VERBOSE=1 TORANJ_POSIX_APP_RCP_MODEL=1 - env: BUILD_TARGET="toranj-test-framework" COVERAGE=1 VERBOSE=1 TORANJ_POSIX_APP_RCP_MODEL=1
os: linux os: linux
compiler: gcc compiler: gcc
script: .travis/script.sh script: .travis/script.sh
+1 -1
View File
@@ -637,7 +637,7 @@ build_samr21() {
} }
[ $BUILD_TARGET != toranj-test-framework ] || { [ $BUILD_TARGET != toranj-test-framework ] || {
./tests/toranj/start.sh || die top_builddir=$(pwd)/build/toranj ./tests/toranj/start.sh || die
} }
[ $BUILD_TARGET != osx ] || { [ $BUILD_TARGET != osx ] || {
+14 -3
View File
@@ -91,13 +91,22 @@ configure_options=" \
cppflags_config='-DOPENTHREAD_PROJECT_CORE_CONFIG_FILE=\"../tests/toranj/openthread-core-toranj-config.h\"' cppflags_config='-DOPENTHREAD_PROJECT_CORE_CONFIG_FILE=\"../tests/toranj/openthread-core-toranj-config.h\"'
if [ -n "${top_builddir}" ]; then
top_srcdir=$(pwd)
mkdir -p "${top_builddir}"
else
top_srcdir=.
top_builddir=.
fi
case ${build_config} in case ${build_config} in
ncp) ncp)
echo "===================================================================================================" echo "==================================================================================================="
echo "Building OpenThread NCP FTD mode with POSIX platform" echo "Building OpenThread NCP FTD mode with POSIX platform"
echo "===================================================================================================" echo "==================================================================================================="
./bootstrap || die ./bootstrap || die
./configure \ cd "${top_builddir}"
${top_srcdir}/configure \
CPPFLAGS="$cppflags_config" \ CPPFLAGS="$cppflags_config" \
--with-examples=posix \ --with-examples=posix \
$configure_options || die $configure_options || die
@@ -109,7 +118,8 @@ case ${build_config} in
echo "Building OpenThread RCP (NCP in radio mode) with POSIX platform" echo "Building OpenThread RCP (NCP in radio mode) with POSIX platform"
echo "====================================================================================================" echo "===================================================================================================="
./bootstrap || die ./bootstrap || die
./configure \ cd "${top_builddir}"
${top_srcdir}/configure \
CPPFLAGS="$cppflags_config" \ CPPFLAGS="$cppflags_config" \
--enable-coverage=${coverage} \ --enable-coverage=${coverage} \
--enable-ncp \ --enable-ncp \
@@ -125,7 +135,8 @@ case ${build_config} in
echo "Building OpenThread POSIX App NCP" echo "Building OpenThread POSIX App NCP"
echo "====================================================================================================" echo "===================================================================================================="
./bootstrap || die ./bootstrap || die
./configure \ cd "${top_builddir}"
${top_srcdir}/configure \
CPPFLAGS="$cppflags_config -DOPENTHREAD_CONFIG_POSIX_APP_ENABLE_PTY_DEVICE=1 -DOPENTHREAD_POSIX_RCP_UART_ENABLE=1" \ CPPFLAGS="$cppflags_config -DOPENTHREAD_CONFIG_POSIX_APP_ENABLE_PTY_DEVICE=1 -DOPENTHREAD_POSIX_RCP_UART_ENABLE=1" \
--enable-posix-app \ --enable-posix-app \
$configure_options || die $configure_options || die
+1 -2
View File
@@ -77,8 +77,7 @@ run() {
cd $(dirname $0) cd $(dirname $0)
# On Travis CI, the $BUILD_TARGET is defined as "toranj-test-framework". if [ "$COVERAGE" = 1 ]; then
if [ "$BUILD_TARGET" = "toranj-test-framework" ]; then
coverage_option="--enable-coverage" coverage_option="--enable-coverage"
else else
coverage_option="" coverage_option=""