Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added code coverage to build #18

Merged
merged 6 commits into from
Jul 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ set(CMAKE_BUILD_TYPE Release)
project (DeathKnell)
set(PROJECT_SRC ${DeathKnell_SOURCE_DIR}/src)
set(DIR_UNIT_TEST ${DeathKnell_SOURCE_DIR}/test)
set(DIR_3RDPARTY ${DeathKnell_SOURCE_DIR}/3rdparty)
set(DIR_3RDPARTY ${DeathKnell_SOURCE_DIR}/thirdparty)


MESSAGE(" PROJECT_SRC = : ${PROJECT_SRC}")
Expand Down Expand Up @@ -90,7 +90,7 @@ include_directories(${PROJECT_SRC})
file(GLOB TEST_SRC_FILES "test/*.cpp")

SET(CMAKE_CXX_FLAGS "-Wall -Wno-sign-compare -rdynamic -Wunused -std=c++14 -pthread -D_GLIBCXX_USE_NANOSLEEP")
add_executable(UnitTestRunner 3rdparty/test_main.cpp ${TEST_SRC_FILES} )
add_executable(UnitTestRunner thirdparty/test_main.cpp ${TEST_SRC_FILES} )
target_link_libraries(UnitTestRunner ${LIBRARY_TO_BUILD} gtest_170_lib ${LIBS})
set_target_properties(${test} PROPERTIES COMPILE_FLAGS "-isystem -pthread ")

Expand Down
11 changes: 8 additions & 3 deletions packaging/DeathKnell.spec
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fi
cd %{name}/
PATH=/usr/local/gcc/bin:/usr/local/probe/bin:$PATH
rm -f CMakeCache.txt
cd 3rdparty
cd thirdparty
unzip -u gtest-1.7.0.zip
cd ..

Expand All @@ -37,7 +37,7 @@ if [ "%{buildtype}" == "-DUSE_LR_DEBUG=OFF" ]; then
-DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_CXX_COMPILER=/usr/local/gcc/bin/g++
elif [ "%{buildtype}" == "-DUSE_LR_DEBUG=ON" ]; then
/usr/local/probe/bin/cmake -DUSE_LR_DEBUG=ON -DVERSION:STRING=%{version}.%{buildnumber} \
-DCMAKE_CXX_COMPILER_ARG1:STRING=' -std=c++14 -Wall -Werror -g -gdwarf-2 -O0 -fPIC -m64 -isystem/usr/local/gcc/include -isystem/usr/local/probe/include -Wl,-rpath -Wl,. -Wl,-rpath -Wl,/usr/local/probe/lib -Wl,-rpath -Wl,/usr/local/gcc/lib64 ' \
-DCMAKE_CXX_COMPILER_ARG1:STRING=' -std=c++14 -Wall -Werror -g -gdwarf-2 --coverage -O0 -fPIC -m64 -isystem/usr/local/gcc/include -isystem/usr/local/probe/include -Wl,-rpath -Wl,. -Wl,-rpath -Wl,/usr/local/probe/lib -Wl,-rpath -Wl,/usr/local/gcc/lib64 ' \
-DCMAKE_CXX_COMPILER=/usr/local/gcc/bin/g++
else
echo "Unknown buildtype:" "%{buildtype}"
Expand All @@ -46,7 +46,12 @@ fi

make -j6
./UnitTestRunner

if [ "%{buildtype}" == "-DUSE_LR_DEBUG=ON" ]; then
/usr/local/probe/bin/CodeCoverage.py
username=$(whoami)
userhome=$HOME
sudo chown -R ${username}:${username} ${userhome}/rpmbuild/BUILD/*
fi
mkdir -p $RPM_BUILD_ROOT/usr/local/probe/lib
cp -rfd lib%{name}.so* $RPM_BUILD_ROOT/usr/local/probe/lib
mkdir -p $RPM_BUILD_ROOT/usr/local/probe/include
Expand Down
9 changes: 4 additions & 5 deletions scripts/buildRpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ set -e
PACKAGE=DeathKnell

if [[ $# -ne 2 ]] ; then
echo 'Usage: sh buildRpm <BUILD_TYPE> <BUILDNUMBER>'
echo 'Usage: sh buildRpm <BUILD_NUMBER> <BUILD_TYPE>'
echo ' BUILD_TYPE is PRODUCTION or DEBUG'
exit 0
fi

if [ "$1" = "PRODUCTION" ] ; then
if [ "$2" = "PRODUCTION" ] ; then
BUILD_TYPE="-DUSE_LR_DEBUG=OFF"
elif [ "$1" = "DEBUG" ] ; then
elif [ "$2" = "DEBUG" ] ; then
BUILD_TYPE="-DUSE_LR_DEBUG=ON"
else
echo "<BUILD_TYPE> must be one of: PRODUCTION or DEBUG"
exit 0
fi

BUILD="$2"
BUILD="$1"

# As version number we use the commit number on HEAD
# we do not bother with other branches for now
Expand All @@ -31,7 +31,6 @@ CWD=$PWD/$PACKAGE
DISTDIR=$CWD/dist/$PACKAGE
PATH=$PATH:/usr/local/probe/bin:$PATH

rm -rf ~/rpmbuild
rpmdev-setuptree
cp packaging/$PACKAGE.spec ~/rpmbuild/SPECS
rm -f $PACKAGE-$VERSION.tar.gz
Expand Down
File renamed without changes.
File renamed without changes.