INCLUDE_DIRECTORIES(${${COMMON_LIBRARY}_DIR})
BUILD_MODULE(${PKGNAME} "daemon" "binary")
+IF("${TEST_MODULE}" STREQUAL "ON")
+ BUILD_MODULE("${PKGNAME}-test" "test" "library")
+ENDIF()
Source0: %{name}-%{version}.tar.gz
Source101: %{name}.service
+%define test_module ON
+
BuildRequires: cmake
BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(glib-2.0)
%description common
Common library for resourced-headless modules.
+%if %{test_module} == ON
+%package test
+Summary: Test module
+Requires: %{name} = %{version}-%{release}
+Requires: %{name}-common = %{version}-%{release}
+%description test
+Test module for resourced-headless. It just writes log.
+%endif
+
%prep
%setup -q
%cmake . \
-DFULLVER=%{version} \
-DMAJORVER=${MAJORVER} \
- -DLIB_DIR=%{_libdir}
+ -DLIB_DIR=%{_libdir} \
+ -DTEST_MODULE=%{test_module} \
make %{?jobs:-j%jobs}
%license LICENSE
%manifest %{name}-common.manifest
%{_libdir}/libresourced-headless-common.so*
+
+%if %{test_module} == ON
+%files test
+%license LICENSE
+%manifest %{name}-test.manifest
+%{_libdir}/libresourced-headless-test.so*
+%endif
--- /dev/null
+/*
+ * resourced-headless
+ *
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <glib.h>
+#include <stdio.h>
+
+#include <log.h>
+#include <macro.h>
+#include <module.h>
+
+int __INIT__ test_init(void)
+{
+ _I("Test module is initialized!");
+
+ return 0;
+}
+
+int __EXIT__ test_exit(void)
+{
+ _I("Test module is finalized!");
+
+ return 0;
+}
+
+static struct module test_module = {
+ .name = "test",
+ .priority = MODULE_PRIORITY_NORMAL,
+ .init = test_init,
+ .exit = test_exit,
+};
+
+MODULE_REGISTER(&test_module)