diff --git a/CMakeLists.txt b/CMakeLists.txt index fb618f8e5..00581bc4a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,6 +36,7 @@ elseif("${BUILD_TYPE_UPPER}" STREQUAL "DEBUG") set(CMAKE_C_FLAGS "-g -O0 ${CMAKE_C_FLAGS}") elseif("${BUILD_TYPE_UPPER}" STREQUAL "RELWITHDEBINFO") set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Build Type" FORCE) + set(CMAKE_C_FLAGS "-DNDEBUG -g -O2 ${CMAKE_C_FLAGS}") elseif("${BUILD_TYPE_UPPER}" STREQUAL "RELWITHDEBUG") set(CMAKE_BUILD_TYPE "RelWithDebug" CACHE STRING "Build Type" FORCE) elseif("${BUILD_TYPE_UPPER}" STREQUAL "ABICHECK") diff --git a/distro/pkg/deb/control b/distro/pkg/deb/control index da96a91e4..e978149a1 100644 --- a/distro/pkg/deb/control +++ b/distro/pkg/deb/control @@ -8,7 +8,10 @@ Build-Depends: cmake, debhelper (>= 10), libyang-dev, libsystemd-dev, - pkg-config + pkg-config, + libcmocka-dev, + valgrind + Vcs-Browser: https://github.com/sysrepo/sysrepo/tree/master Vcs-Git: https://github.com/sysrepo/sysrepo.git diff --git a/distro/pkg/deb/rules b/distro/pkg/deb/rules index 897c275f4..01d374ae9 100755 --- a/distro/pkg/deb/rules +++ b/distro/pkg/deb/rules @@ -4,12 +4,21 @@ export DEB_BUILD_MAINT_OPTIONS = hardening=+all include /usr/share/dpkg/default.mk +# determine number of processors to enable parallel tests +NPROCS:=$(shell grep -c ^processor /proc/cpuinfo) + %: - dh $@ + dh $@ -j override_dh_auto_configure: dh_auto_configure -- \ - -DCMAKE_BUILD_TYPE:String="Release" \ + -DCMAKE_BUILD_TYPE:String="RelWithDebInfo" \ -DSYSREPO_UMASK=007 \ -DSYSREPO_GROUP=sysrepo \ -DNACM_SRMON_DATA_PERM=660 + +override_dh_auto_test: +ifeq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),) + make -C obj-$(DEB_HOST_GNU_TYPE) test ARGS=' -j $(NPROCS) -V' + make -C obj-$(DEB_HOST_GNU_TYPE) test_clean +endif