From 788ce0d0d8d99da43354f6685a006a81c3f8c7b6 Mon Sep 17 00:00:00 2001 From: Dongsun Lee Date: Tue, 10 Dec 2024 16:52:05 +0900 Subject: [PATCH] Disable test build by default - to build the test package, use test_build_on flag as below. gbs build -A armv7l --define "test_build_on 1" Change-Id: I163b6e96fe7993b2dbdda4a36aa94416ebf45c5f --- CMakeLists.txt | 4 +++- packaging/capi-system-resource.spec | 12 +++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 59e3147..f76aee2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,4 +49,6 @@ INSTALL( FILES_MATCHING PATTERN "cpu-boosting*.h") ADD_SUBDIRECTORY(src/plugin) -ADD_SUBDIRECTORY(tests) +IF(TEST_BUILD_ON) + ADD_SUBDIRECTORY(tests) +ENDIF(TEST_BUILD_ON) diff --git a/packaging/capi-system-resource.spec b/packaging/capi-system-resource.spec index 6e420c6..a7bbdd8 100644 --- a/packaging/capi-system-resource.spec +++ b/packaging/capi-system-resource.spec @@ -9,7 +9,8 @@ Source1: capi-system-resource.manifest BuildRequires: cmake BuildRequires: pkgconfig(capi-base-common) BuildRequires: pkgconfig(dlog) -BuildRequires: pkgconfig(glib-2.0) + +%global build_test_package %{?test_build_on:%test_build_on}%{!?test_build_on:0} %description API library for system resource management and optimization @@ -30,12 +31,15 @@ Requires: %{name} = %{version}-%{release} %description plugin API plugin library +%if %{build_test_package} %package test Summary: API test for system resource management and optimization Group: System/Development +BuildRequires: pkgconfig(glib-2.0) Requires: %{name} = %{version}-%{release} %description test +%endif %prep @@ -47,9 +51,13 @@ MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` %cmake . -DMAJORVER=${MAJORVER} \ -DFULLVER=%{version} \ +%if %{build_test_package} + -DTEST_BUILD_ON=ON \ +%endif -DPLUGIN_PATH=%{_libdir} + %__make %{?jobs:-j%jobs} %install @@ -77,6 +85,7 @@ MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` %license LICENSE.MIT %{_libdir}/libcapi-system-resource-plugin.so* +%if %{build_test_package} %files test %manifest %{name}.manifest %license LICENSE.MIT @@ -84,3 +93,4 @@ MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` %{_bindir}/system-resource-test-service %{_unitdir}/system-resource-test-service.service %{_unitdir}/multi-user.target.wants/system-resource-test-service.service +%endif -- 2.34.1