From e37dfb239ce524743aac34197b272c048c4c610d Mon Sep 17 00:00:00 2001 From: Youngjae Shin Date: Thu, 14 May 2020 15:25:36 +0900 Subject: [PATCH] cleanup build scripts and filenames Change-Id: Ied544eebcc49dbd418ba1855dee57938e42a9a7a --- CMakeLists.txt | 187 ++++----------------- LICENSE => LICENSE.APLv2 | 4 +- README_UnitTest.md | 12 -- capi-system-system-settings.pc.in | 19 +-- debian/README | 0 debian/capi-system-system-settings-dev.install | 4 - debian/capi-system-system-settings-dev.postinst | 1 - debian/capi-system-system-settings.install | 1 - debian/capi-system-system-settings.postinst | 1 - debian/changelog | 34 ---- debian/compat | 1 - debian/control | 22 --- debian/rules | 68 -------- doc/system_settings_doc.h | 7 +- include/system_settings.h | 7 +- include/system_settings_multi_callback.h | 24 --- include/system_settings_ringtones.h | 23 --- .../capi-system-system-settings.manifest | 0 packaging/capi-system-system-settings.spec | 122 ++++++-------- src/{system_settings.c => sys_settings.c} | 11 +- .../sys_settings.h | 12 +- ...{system_settings_json.c => sys_settings_json.c} | 24 ++- .../sys_settings_json.h | 8 +- ...ti_callback.c => sys_settings_multi_callback.c} | 17 +- src/sys_settings_multi_callback.h | 39 +++++ ..._setting_platform.c => sys_settings_platform.c} | 49 +++--- ...ttings_ringtones.c => sys_settings_ringtones.c} | 15 +- src/sys_settings_ringtones.h | 38 +++++ ...ystem_settings_vconf.c => sys_settings_vconf.c} | 11 +- system-setting-config.h.in | 14 -- system-settings-util/CMakeLists.txt | 57 ------- tests/CMakeLists.txt | 22 +++ tests/mocks/efl-extension.c | 28 +++ .../src => tests/mocks}/pkgmgrinfo_appinfo.c | 15 ++ {unit_test/src => tests/mocks}/vconf.cpp | 24 +-- {unit_test/resource => tests/res}/ringtone_sdk.mp3 | Bin {unit_test => tests}/run_coverage.sh | 6 +- .../scripts}/convert_vconf_script_to_sql.sh | 0 .../script => tests/scripts}/unit_test_gdb_script | 2 +- {unit_test/script => tests/scripts}/unittest.sh | 6 +- {unit_test/script => tests/scripts}/unittest2.sh | 2 +- {unit_test/script => tests/scripts}/vconf_all.sh | 0 .../src/unit_test.c => tests/sys_settings_test.c | 24 ++- .../sys_settings_test.h | 36 ++-- .../unit_test_fw.c => tests/sys_settings_test_fw.c | 17 +- tests/sys_settings_test_fw.h | 49 ++++++ unit_test/CMakeLists.txt | 56 ------ unit_test/include/unit_test_fw.h | 29 ---- unit_test/src/efl-extension.c | 13 -- unit_test/src/vconf.sym | 38 ----- utils/CMakeLists.txt | 13 ++ .../sys_settings_font.h | 0 .../sys_settings_util.c | 11 +- .../sys_settings_util.h | 0 54 files changed, 452 insertions(+), 771 deletions(-) mode change 100755 => 100644 CMakeLists.txt rename LICENSE => LICENSE.APLv2 (97%) mode change 100755 => 100644 delete mode 100644 README_UnitTest.md mode change 100755 => 100644 capi-system-system-settings.pc.in delete mode 100755 debian/README delete mode 100755 debian/capi-system-system-settings-dev.install delete mode 100755 debian/capi-system-system-settings-dev.postinst delete mode 100755 debian/capi-system-system-settings.install delete mode 100755 debian/capi-system-system-settings.postinst delete mode 100755 debian/changelog delete mode 100755 debian/compat delete mode 100755 debian/control delete mode 100755 debian/rules delete mode 100644 include/system_settings_multi_callback.h delete mode 100644 include/system_settings_ringtones.h rename capi-system-system-settings.manifest => packaging/capi-system-system-settings.manifest (100%) mode change 100755 => 100644 packaging/capi-system-system-settings.spec rename src/{system_settings.c => sys_settings.c} (99%) rename include/system_settings_private.h => src/sys_settings.h (99%) rename src/{system_settings_json.c => sys_settings_json.c} (86%) rename include/system_settings_json.h => src/sys_settings_json.h (84%) rename src/{system_settings_multi_callback.c => sys_settings_multi_callback.c} (77%) create mode 100644 src/sys_settings_multi_callback.h rename src/{system_setting_platform.c => sys_settings_platform.c} (97%) rename src/{system_settings_ringtones.c => sys_settings_ringtones.c} (90%) create mode 100644 src/sys_settings_ringtones.h rename src/{system_settings_vconf.c => sys_settings_vconf.c} (96%) delete mode 100644 system-setting-config.h.in delete mode 100755 system-settings-util/CMakeLists.txt create mode 100644 tests/CMakeLists.txt create mode 100644 tests/mocks/efl-extension.c rename {unit_test/src => tests/mocks}/pkgmgrinfo_appinfo.c (95%) rename {unit_test/src => tests/mocks}/vconf.cpp (98%) rename {unit_test/resource => tests/res}/ringtone_sdk.mp3 (100%) rename {unit_test => tests}/run_coverage.sh (96%) rename {unit_test/script => tests/scripts}/convert_vconf_script_to_sql.sh (100%) rename {unit_test/script => tests/scripts}/unit_test_gdb_script (79%) rename {unit_test/script => tests/scripts}/unittest.sh (94%) mode change 100755 => 100644 rename {unit_test/script => tests/scripts}/unittest2.sh (96%) mode change 100755 => 100644 rename {unit_test/script => tests/scripts}/vconf_all.sh (100%) rename unit_test/src/unit_test.c => tests/sys_settings_test.c (99%) rename unit_test/include/unit_test_assert.h => tests/sys_settings_test.h (81%) mode change 100755 => 100644 rename unit_test/src/unit_test_fw.c => tests/sys_settings_test_fw.c (77%) create mode 100644 tests/sys_settings_test_fw.h delete mode 100755 unit_test/CMakeLists.txt delete mode 100644 unit_test/include/unit_test_fw.h delete mode 100644 unit_test/src/efl-extension.c delete mode 100644 unit_test/src/vconf.sym create mode 100644 utils/CMakeLists.txt rename system-settings-util/include/system_settings_font.h => utils/sys_settings_font.h (100%) rename system-settings-util/src/system_settings_util.c => utils/sys_settings_util.c (98%) rename system-settings-util/include/system_settings_util.h => utils/sys_settings_util.h (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt old mode 100755 new mode 100644 index 6b4b3a4..6bd9a1f --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,74 +1,21 @@ - -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -SET(fw_name "capi-system-system-settings") -SET(unit_test "system-setting-unittest") - -PROJECT(${fw_name}) - -SET(CMAKE_INSTALL_PREFIX /usr) -SET(PREFIX ${CMAKE_INSTALL_PREFIX}) - -SET(SYSTEM_SETTINGS_UTIL system-settings-util) -SET(LIB_SYSTEM_SETTINGS_UTIL system-settings-util) - -#GCOV_PREFIX=/target/run’ and ‘GCOV_PREFIX_STRIP=1 -#--------------------------------------------------------------- -# code coverage -#--------------------------------------------------------------- -set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/scripts/cmake) -IF ((CMAKE_BUILD_TYPE STREQUAL "UNITTEST") OR (CMAKE_BUILD_TYPE STREQUAL "GCOVTEST")) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -g -O0 -fprofile-arcs -ftest-coverage --coverage") - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -g -O0 -fprofile-arcs -ftest-coverage --coverage") -ENDIF() #CMAKE_BUILD_TYPE STREQUAL "UNITTEST" -#--------------------------------------------------------------- -# include/system-setting-config.h -#--------------------------------------------------------------- -set (VERSION_MAJOR 1) -set (VERSION_MINOR 0) -set (SETTING_DEF_RES_PATH "\"${SETTING_DEF_RES}\"") - -set (SETTING_TIME_ZONEINFO_PATH "\"/usr/share/zoneinfo/\"") -set (SETTING_TZONE_SYMLINK_PATH "\"/opt/etc/localtime\"") - -# DSETTING_DEF_RES -configure_file ( - "${PROJECT_SOURCE_DIR}/system-setting-config.h.in" - "${PROJECT_SOURCE_DIR}/include/system-setting-config.h" -) - - -SET(LIBDIR "${CMAKE_LIBDIR}") -SET(INC_DIR include) -INCLUDE_DIRECTORIES(${INC_DIR}) - -SET(requires "dlog vconf fontconfig libxml-2.0 pkgmgr pkgmgr-info alarm-service capi-media-metadata-extractor aul json-glib-1.0 capi-appfw-app-manager capi-appfw-package-manager capi-system-info glib-2.0") -SET(pc_requires "capi-base-common") - - -IF(TIZEN_WEARABLE) - ADD_DEFINITIONS(-DTIZEN_WEARABLE) -ENDIF(TIZEN_WEARABLE) -IF(TIZEN_MOBILE) - ADD_DEFINITIONS(-DTIZEN_MOBILE) -ENDIF(TIZEN_MOBILE) +CMAKE_MINIMUM_REQUIRED(VERSION 3.9) +PROJECT(capi-system-system-settings) INCLUDE(FindPkgConfig) -pkg_check_modules(${fw_name} REQUIRED ${requires}) -FOREACH(flag ${${fw_name}_CFLAGS}) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") -ENDFOREACH(flag) - +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror-implicit-function-declaration") +SET(SETTING_TZONE_SYMLINK_PATH "\"/opt/etc/localtime\"") -SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") +SET(EXTRA_FLAGS "-Wall -Werror -fvisibility=hidden") +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_FLAGS} -std=c++11") +SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie") -IF("${ARCH}" STREQUAL "arm") - ADD_DEFINITIONS("-DTARGET") -ENDIF("${ARCH}" STREQUAL "arm") - -ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") -ADD_DEFINITIONS("-DSLP_DEBUG") +PKG_CHECK_MODULES(pkgs REQUIRED dlog vconf fontconfig libxml-2.0 pkgmgr pkgmgr-info + alarm-service capi-media-metadata-extractor aul json-glib-1.0 capi-appfw-app-manager + capi-appfw-package-manager capi-system-info glib-2.0) +INCLUDE_DIRECTORIES(${pkgs_INCLUDE_DIRS}) +LINK_DIRECTORIES(${pkgs_LIBRARY_DIRS}) ADD_DEFINITIONS("-D_TZ_SYS_DATA=\"${TZ_SYS_DATA}\"") ADD_DEFINITIONS("-D_TZ_SYS_ETC=\"${TZ_SYS_ETC}\"") @@ -76,98 +23,24 @@ ADD_DEFINITIONS("-D_TZ_SYS_RO_SHARE=\"${TZ_SYS_RO_SHARE}\"") ADD_DEFINITIONS("-D_TZ_SYS_SHARE=\"${TZ_SYS_SHARE}\"") ADD_DEFINITIONS("-DSETTING_DEF_RES=\"${SETTING_DEF_RES}\"") -SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib") -IF (CMAKE_BUILD_TYPE STREQUAL "UNITTEST") - SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov") - ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/unit_test) -ENDIF() #CMAKE_BUILD_TYPE STREQUAL "UNITTEST" - -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/${SYSTEM_SETTINGS_UTIL}/include) -ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${SYSTEM_SETTINGS_UTIL}) - -#AUX_SOURCE_DIRECTORY(src SOURCES) -SET(SOURCES "src/system_setting_platform.c" - "src/system_settings.c" - "src/system_settings_json.c" - "src/system_settings_ringtones.c" - "src/system_settings_multi_callback.c" - "src/system_settings_vconf.c") - -#SET(UNITSOURES "system_setting_unittest.c") - -ADD_LIBRARY(${fw_name} SHARED ${SOURCES}) - -TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS}) - -SET_TARGET_PROPERTIES(${fw_name} - PROPERTIES - VERSION ${FULLVER} - SOVERSION ${MAJORVER} - CLEAN_DIRECT_OUTPUT 1 -) - -IF (CMAKE_BUILD_TYPE STREQUAL "UNITTEST") - # Coverage Testing - INSTALL( - DIRECTORY "CMakeFiles" DESTINATION /usr/src/packages/BUILD/capi-system-system-settings-${FULLVER} - FILES_MATCHING - PATTERN "*.gcno" - PATTERN "*system_setting_unittest.c.gcno" EXCLUDE - ) -ENDIF() #CMAKE_BUILD_TYPE STREQUAL "UNITTEST" - - -INSTALL(TARGETS ${fw_name} DESTINATION ${LIBDIR}) -INSTALL( - DIRECTORY ${INC_DIR}/ DESTINATION include/system - FILES_MATCHING - PATTERN "*_private.h" EXCLUDE - PATTERN "*_json.h" EXCLUDE - PATTERN "*_ringtones.h" EXCLUDE - PATTERN "${INC_DIR}/*.h" - ) - -SET(PC_NAME ${fw_name}) -SET(PC_REQUIRED ${pc_requires}) -SET(PC_LDFLAGS -l${fw_name}) -SET(PC_CFLAGS -I\${includedir}/system) - -CONFIGURE_FILE( - capi-system-system-settings.pc.in - ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc - @ONLY -) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION ${LIBDIR}/pkgconfig) +IF(TIZEN_WEARABLE) + ADD_DEFINITIONS(-DTIZEN_WEARABLE) +ENDIF(TIZEN_WEARABLE) +IF(TIZEN_MOBILE) + ADD_DEFINITIONS(-DTIZEN_MOBILE) +ENDIF(TIZEN_MOBILE) -# INSTALL (TARGETS test DESTINATION bin) +FILE(GLOB SRCS src/*.c) +ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS}) +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LIBRARIES}) +SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${FULLVER} SOVERSION ${MAJORVER}) -IF(UNIX) +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR}) +FILE(GLOB HEADERS include/*.h) +INSTALL(FILES ${HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/system) -ADD_CUSTOM_TARGET (distclean @echo cleaning for source distribution) -ADD_CUSTOM_COMMAND( - DEPENDS clean - COMMENT "distribution clean" - COMMAND find - ARGS . - -not -name config.cmake -and \( - -name tester.c -or - -name Testing -or - -name CMakeFiles -or - -name cmake.depends -or - -name cmake.check_depends -or - -name CMakeCache.txt -or - -name cmake.check_cache -or - -name *.cmake -or - -name Makefile -or - -name core -or - -name core.* -or - -name gmon.out -or - -name install_manifest.txt -or - -name *.pc -or - -name *~ \) - | grep -v TC | xargs rm -rf - TARGET distclean - VERBATIM -) -ENDIF(UNIX) +CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY) +INSTALL(FILES ${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) +ADD_SUBDIRECTORY(utils) +ADD_SUBDIRECTORY(tests) diff --git a/LICENSE b/LICENSE.APLv2 old mode 100755 new mode 100644 similarity index 97% rename from LICENSE rename to LICENSE.APLv2 index bbe9d02..62649a4 --- a/LICENSE +++ b/LICENSE.APLv2 @@ -1,4 +1,4 @@ -Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. +Copyright (c) 2012 - 2020 Samsung Electronics Co., Ltd. All rights reserved. Apache License Version 2.0, January 2004 @@ -202,5 +202,3 @@ Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. See the License for the specific language governing permissions and limitations under the License. - - diff --git a/README_UnitTest.md b/README_UnitTest.md deleted file mode 100644 index 1100200..0000000 --- a/README_UnitTest.md +++ /dev/null @@ -1,12 +0,0 @@ - - -# Unit Testing for system-settings API - - -## HOW TO TEST - - #./unittest.sh /home/mjpark/GBS-ROOT/local/repos/slp/armv7l/RPMS capi-system-system-settings 0.0.3-3 armv7l 2>&1 | tee ./unittest.log - - ./unittest.sh /home/mjpark/GBS-ROOT/local/repos/slp/armv7l/RPMS armv7l 2>&1 | tee ./unittest.log - ./unittest2.sh /home/mjpark/GBS-ROOT/local/repos/slp/armv7l/RPMS armv7l 2>&1 | tee ./unittest.log - diff --git a/capi-system-system-settings.pc.in b/capi-system-system-settings.pc.in old mode 100755 new mode 100644 index ef23d0c..d610d90 --- a/capi-system-system-settings.pc.in +++ b/capi-system-system-settings.pc.in @@ -1,14 +1,9 @@ -# Package Information for pkg-config +libdir=@LIB_INSTALL_DIR@ +includedir=@INCLUDE_INSTALL_DIR@/system -prefix=@PREFIX@ -exec_prefix=/usr -libdir=/usr/lib -includedir=/usr/include/system - -Name: @PC_NAME@ -Description: @PACKAGE_DESCRIPTION@ -Version: @VERSION@ -Requires: @PC_REQUIRED@ -Libs: -L${libdir} @PC_LDFLAGS@ +Name: @PROJECT_NAME@ +Description: Tizen Native API for System Settings +Version: @FULLVER@ +Requires: capi-base-common +Libs: -L${libdir} -l@PROJECT_NAME@ Cflags: -I${includedir} - diff --git a/debian/README b/debian/README deleted file mode 100755 index e69de29..0000000 diff --git a/debian/capi-system-system-settings-dev.install b/debian/capi-system-system-settings-dev.install deleted file mode 100755 index 761a28b..0000000 --- a/debian/capi-system-system-settings-dev.install +++ /dev/null @@ -1,4 +0,0 @@ -/usr/include/* -/usr/include/*/* -/usr/lib/pkgconfig/*.pc - diff --git a/debian/capi-system-system-settings-dev.postinst b/debian/capi-system-system-settings-dev.postinst deleted file mode 100755 index 1a24852..0000000 --- a/debian/capi-system-system-settings-dev.postinst +++ /dev/null @@ -1 +0,0 @@ -#!/bin/sh diff --git a/debian/capi-system-system-settings.install b/debian/capi-system-system-settings.install deleted file mode 100755 index 4a755a4..0000000 --- a/debian/capi-system-system-settings.install +++ /dev/null @@ -1 +0,0 @@ -/usr/lib/lib*.so* diff --git a/debian/capi-system-system-settings.postinst b/debian/capi-system-system-settings.postinst deleted file mode 100755 index 1a24852..0000000 --- a/debian/capi-system-system-settings.postinst +++ /dev/null @@ -1 +0,0 @@ -#!/bin/sh diff --git a/debian/changelog b/debian/changelog deleted file mode 100755 index b9fa9ed..0000000 --- a/debian/changelog +++ /dev/null @@ -1,34 +0,0 @@ -capi-system-system-settings (0.0.1-7ubuntu1) precise; urgency=low - - * release - * font-type API refinement - - -- mjpark Wed, 23 Jan 2013 15:25:21 +0900 - -capi-system-system-settings (0.0.1-7) unstable; urgency=low - - * release - - -- MyoungJune Park Tue, 04 Sep 2012 10:34:54 +0900 - -capi-system-system-settings (0.0.1-6) unstable; urgency=low - - * tizen build - - -- MyoungJune Park Tue, 14 Aug 2012 10:20:07 +0900 - -capi-system-system-settings (0.0.1-5) unstable; urgency=low - - * Initial upload - * Git: slp/api/system-settings - * Tag: capi-system-system-settings_0.0.1-5 - - -- MyoungJune Park Mon, 21 May 2012 15:45:32 +0900 - -capi-system-system-settings (0.0.1-1) unstable; urgency=low - - * Initial upload - * Git: slp-info.sec.samsung.net:slp/api/system-settings - * Tag: capi-system-system-settings_0.0.1-1 - - -- Junghyuk Park Tue, 06 Dec 2011 21:16:07 +0900 diff --git a/debian/compat b/debian/compat deleted file mode 100755 index 7ed6ff8..0000000 --- a/debian/compat +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/debian/control b/debian/control deleted file mode 100755 index b4a5614..0000000 --- a/debian/control +++ /dev/null @@ -1,22 +0,0 @@ - -Source: capi-system-system-settings -Section: libs -Priority: extra -Maintainer: Woongsuk Cho , junghyuk park , MyoungJune Park -Build-Depends: debhelper (>= 5), libecore-dev, dlog-dev, libelm-dev, libappcore-efl-dev, libvconf-dev, capi-base-common-dev, libfontconfig1-dev, libxml2-dev ,libglib2.0-dev - -Package: capi-system-system-settings -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} -Description: A System Settings library in Tizen Native API - -Package: capi-system-system-settings-dev -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, capi-system-system-settings (= ${Source-Version}), capi-base-common-dev -Description: A System Settings library in Tizen Native API (DEV) - -Package: capi-system-system-settings-dbg -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, capi-system-system-settings (= ${Source-Version}) -Description: A System Settings library in Tizen Native API (DBG) - diff --git a/debian/rules b/debian/rules deleted file mode 100755 index 2e2326d..0000000 --- a/debian/rules +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/make -f - -CFLAGS = -Wall -g - -ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) - CFLAGS += -O0 -else - CFLAGS += -O2 -endif -CMAKE_ROOT_DIR ?= $(CURDIR) -CMAKE_BUILD_DIR ?= $(CURDIR)/cmake_build_tmp - -FULLVER ?= $(shell dpkg-parsechangelog | grep Version: | cut -d ' ' -f 2 | cut -d '-' -f 1) -MAJORVER ?= $(shell echo $(FULLVER) | cut -d '.' -f 1) - -configure: configure-stamp -configure-stamp: - dh_testdir - mkdir -p $(CMAKE_BUILD_DIR) && cd $(CMAKE_BUILD_DIR) && cmake .. -DFULLVER=${FULLVER} -DMAJORVER=${MAJORVER} - touch configure-stamp - - -build: build-stamp -build-stamp: configure-stamp - dh_testdir - cd $(CMAKE_BUILD_DIR) && $(MAKE) - touch $@ - -clean: - cd $(CMAKE_ROOT_DIR) - dh_testdir - dh_testroot - rm -f build-stamp configure-stamp - rm -f `find . -name *.pc` - rm -rf $(CMAKE_BUILD_DIR) - dh_clean - -install: build - dh_testdir - dh_testroot - dh_clean -k - dh_installdirs - - cd $(CMAKE_BUILD_DIR) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install - -binary-indep: build install - -binary-arch: build install - dh_testdir - dh_testroot - dh_installchangelogs - dh_installdocs - dh_installexamples - dh_install --sourcedir=debian/tmp - dh_installman - dh_link - dh_strip --dbg-package=capi-system-system-settings-dbg - dh_fixperms - dh_makeshlibs - dh_installdeb - dh_shlibdeps - dh_gencontrol - dh_md5sums - dh_builddeb - -binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install configure - diff --git a/doc/system_settings_doc.h b/doc/system_settings_doc.h index f03e88c..d30c4b6 100644 --- a/doc/system_settings_doc.h +++ b/doc/system_settings_doc.h @@ -1,20 +1,19 @@ /* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2015-2019 Samsung Electronics Co., Ltd All Rights Reserved * - * Licensed under the Apache License, Version 2.0 (the License); + * 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, + * 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. */ - /** * @ingroup CAPI_SYSTEM_FRAMEWORK * @defgroup CAPI_SYSTEM_SYSTEM_SETTINGS_MODULE System Settings diff --git a/include/system_settings.h b/include/system_settings.h index 1552817..5402076 100644 --- a/include/system_settings.h +++ b/include/system_settings.h @@ -1,19 +1,18 @@ /* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2011-2020 Samsung Electronics Co., Ltd All Rights Reserved * - * Licensed under the Apache License, Version 2.0 (the License); + * 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, + * 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. */ - #ifndef __TIZEN_SYSTEM_SYSTEM_SETTINGS_H__ #define __TIZEN_SYSTEM_SYSTEM_SETTINGS_H__ diff --git a/include/system_settings_multi_callback.h b/include/system_settings_multi_callback.h deleted file mode 100644 index 1c352d6..0000000 --- a/include/system_settings_multi_callback.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef __TIZEN_SYSTEM_SETTING_MULTI_CALLBACK_H__ -#define __TIZEN_SYSTEM_SETTING_MULTI_CALLBACK_H__ -#include -#include -#include - -typedef struct __st_multi_callback_node_ -{ - system_settings_changed_cb callback; - void* user_data; -}callback_node; - -typedef struct __st_multi_callback_list_ -{ - GList * list; - int is_registered; -}callback_list; - -int add_multi_callback(callback_list *handle, system_settings_changed_cb ptr, void* user_data); -int delete_multi_callback(callback_list *handle, system_settings_changed_cb ptr); -int invoke_callback_list(callback_list *handle, system_settings_key_e key); - - -#endif /* __TIZEN_SYSTEM_SETTING_MULTI_CALLBACK_H__ */ diff --git a/include/system_settings_ringtones.h b/include/system_settings_ringtones.h deleted file mode 100644 index 49c84d3..0000000 --- a/include/system_settings_ringtones.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef __SYSTEM_SETTINGS_RINGTONES_H__ -#define __SYSTEM_SETTINGS_RINGTONES_H__ - -#include -#include -#include - -typedef struct _ugFsNodeInfo fileNodeInfo; -struct _ugFsNodeInfo { - char *path; - char *name; - char *media_name; -}; - -int get_filelist_from_dir_path(char *path, GList **file_list); -char *get_filename_from_fullname(const char *fullname); - -#if 0 -void ringtone_play_sound(const char *sound_file, player_h **mp_handle); -void ringtone_stop_sound(void *data); -#endif - -#endif /* __SYSTEM_SETTINGS_RINGTONES_H__ */ diff --git a/capi-system-system-settings.manifest b/packaging/capi-system-system-settings.manifest similarity index 100% rename from capi-system-system-settings.manifest rename to packaging/capi-system-system-settings.manifest diff --git a/packaging/capi-system-system-settings.spec b/packaging/capi-system-system-settings.spec old mode 100755 new mode 100644 index 080b830..ad04476 --- a/packaging/capi-system-system-settings.spec +++ b/packaging/capi-system-system-settings.spec @@ -2,9 +2,13 @@ Name: capi-system-system-settings Summary: A System Settings library in Tizen Native API Version: 0.0.4 Release: 5 + Group: System/System Info License: Apache-2.0 +URL : https://git.tizen.org/cgit/platform/core/api/system-settings Source0: %{name}-%{version}.tar.gz +Source1001: %{name}.manifest + BuildRequires: cmake BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(vconf) @@ -19,24 +23,22 @@ BuildRequires: pkgconfig(uuid) BuildRequires: pkgconfig(capi-media-metadata-extractor) BuildRequires: pkgconfig(capi-system-info) BuildRequires: pkgconfig(libsystemd) - BuildRequires: pkgconfig(json-glib-1.0) BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(capi-appfw-app-manager) BuildRequires: pkgconfig(capi-appfw-package-manager) +Requires(post): /sbin/ldconfig +Requires(postun): /sbin/ldconfig -%if 0%{?run_tests:1} BuildRequires: pkgconfig(sqlite3) BuildRequires: efl BuildRequires: capi-system-info-test BuildRequires: default-fonts-sdk # BuildRequires: model-config-tm1 +%if 0%{?gcov:1} BuildRequires: lcov %endif -Requires(post): /sbin/ldconfig -Requires(postun): /sbin/ldconfig - %description System setting api for get,set configuration @@ -49,22 +51,30 @@ Requires: pkgconfig(capi-base-common) %description devel System setting api for get,set configuration +%package unittests +Summary: Test Programs for %{name} +Group: System/Testing + +%description unittests +The %{name}-unittests pacakge contains programs for checking the %{name}. + %if 0%{?gcov:1} %package gcov Summary: A System Settings library in Tizen Native API -Group: System/System Info/Testing +Group: System/Testing + %description gcov System Settings library gcov objects %endif +%define tizen_profile_name mobile +%define sys_setting_test_dir %{_bindir}/sys-settings %prep %setup -q - -%define tizen_profile_name mobile +cp %{SOURCE1001} ./%{name}.manifest %build - %if "%{?tizen_profile_name}" == "wearable" export CFLAGS="$CFLAGS -DTIZEN_WEARABLE" export CXXFLAGS="$CXXFLAGS -DTIZEN_WEARABLE" @@ -87,72 +97,51 @@ export CXXFLAGS="$CXXFLAGS -DTIZEN_ENGINEER_MODE" export FFLAGS="$FFLAGS -DTIZEN_ENGINEER_MODE" %endif - -%ifarch aarch64 +%ifarch aarch64 x86_64 export CFLAGS+="$CFLAGS -DSETTING_ARCH_64" export CXXFLAGS+="$CXXFLAGS -DSETTING_ARCH_64" export FFLAGS+="$FFLAGS -DSETTING_ARCH_64" %endif -%ifarch x86_64 -export CFLAGS+="$CFLAGS -DSETTING_ARCH_64" -export CXXFLAGS+="$CXXFLAGS -DSETTING_ARCH_64" -export FFLAGS+="$FFLAGS -DSETTING_ARCH_64" +%if 0%{?gcov:1} +export CFLAGS+=" -fprofile-arcs -ftest-coverage" +export CXXFLAGS+=" -fprofile-arcs -ftest-coverage" +export FFLAGS+=" -fprofile-arcs -ftest-coverage" +export LDFLAGS+=" -lgcov" %endif - - -VERSION=`echo %{version} | grep Version: | awk '{ print $2 }'` -RELEASE=`echo %{version} | grep Version: | awk '{ print $2 }'` MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` - -cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER} -DCMAKE_LIBDIR=%{_libdir} \ - -DCMAKE_INCLUDEDIR=%{_includedir} \ +%cmake . -DMAJORVER=${MAJORVER} -DFULLVER=%{version} \ + -DCMAKE_VERBOSE_MAKEFILE=OFF \ -DTZ_SYS_DATA=%{TZ_SYS_DATA} \ -DTZ_SYS_ETC=%{TZ_SYS_ETC} \ -DTZ_SYS_RO_SHARE=%{TZ_SYS_RO_SHARE} \ -DTZ_SYS_SHARE=%{TZ_SYS_SHARE} \ - -DSETTING_DEF_RES=%{TZ_SYS_GLOBALUSER_DATA}/settings \ -%if 0%{?gcov:1} - -DCMAKE_BUILD_TYPE=GCOVTEST \ -%endif + -DBUILD_GCOV=%{?gcov:1}%{!?gcov:0} \ + -DTEST_INSTALL_DIR:PATH=%{sys_setting_test_dir} \ %if 0%{?thread_number} -DN_THREADS=%{thread_number} \ -%endif -%if 0%{?run_tests:1} - -DCMAKE_BUILD_TYPE=UNITTEST \ - -DUNIT_TEST=1 \ - -DGCOV_PREFIX="%{buildroot}" \ - -DGCOV_PREFIX_STRIP=1 %else - -# add empty line -%endif - - -make %{?jobs:-j%jobs} - -%if 0%{?gcov:1} -mkdir -p gcov-obj -find . -name '*.gcno' -exec cp '{}' gcov-obj ';' + -DN_THREADS=1 \ %endif + -DSETTING_DEF_RES=%{TZ_SYS_GLOBALUSER_DATA}/settings +make %{?_smp_mflags} %install -#rm -rf %{buildroot} %make_install %if 0%{?gcov:1} -mkdir -p %{buildroot}%{_datadir}/gcov/obj -install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj +find .. -name '*.gcno' | tar cf %{name}-gcov.tar -T - +install -d -m 755 %{buildroot}%{_datadir}/gcov/obj +tar xf %{name}-gcov.tar -C %{buildroot}%{_datadir}/gcov/obj %endif %check -############################################### -# Causion : unit test need to root permission -############################################### -# pushd unit_test -# ./run_coverage.sh -# popd +#cd tests +#bash ./run_coverage.sh + +%post unittests +XDG_RUNTIME_DIR=/run %{sys_setting_test_dir}/sys-settings-test %post -p /sbin/ldconfig @@ -160,31 +149,22 @@ install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj %files %manifest %{name}.manifest -%{_libdir}/lib*.so.* -%if 0%{?run_tests:1} -/usr/local/bin/system-setting-unittest - -/usr/src/packages/BUILD/%{name}-%{version}/CMakeFiles/%{name}.dir/src/system_setting_platform.c.gcno -/usr/src/packages/BUILD/%{name}-%{version}/CMakeFiles/%{name}.dir/src/system_settings.c.gcno -/usr/src/packages/BUILD/%{name}-%{version}/CMakeFiles/%{name}.dir/src/system_settings_json.c.gcno -/usr/src/packages/BUILD/%{name}-%{version}/CMakeFiles/%{name}.dir/src/system_settings_ringtones.c.gcno -/usr/src/packages/BUILD/%{name}-%{version}/CMakeFiles/%{name}.dir/src/system_settings_vconf.c.gcno -/usr/src/packages/BUILD/%{name}-%{version}/CMakeFiles/%{name}.dir/src/system_settings_multi_callback.c.gcno -/usr/src/packages/BUILD/%{name}-%{version}/system-settings-util/CMakeFiles/system-settings-util.dir/src/system_settings_util.c.gcno -%endif -%license LICENSE -# /usr/local/bin/test_system_settings -#/usr/local/bin/test_system_settings_gui +%{_libdir}/lib*settings.so.* +%{_libdir}/lib*settings-util.so +%license LICENSE.APLv2 %files devel %manifest %{name}.manifest -%license LICENSE -%{_includedir}/system/*.h -%{_includedir}/system_settings_util.h +%{_libdir}/lib*settings.so %{_libdir}/pkgconfig/*.pc -%{_libdir}/lib*.so +%{_includedir}/system/*.h + +%files unittests +%manifest %{name}.manifest +%{sys_setting_test_dir}/* +%license LICENSE.APLv2 %if 0%{?gcov:1} %files gcov -%{_datadir}/gcov/obj/* +%{_datadir}/gcov/* %endif diff --git a/src/system_settings.c b/src/sys_settings.c similarity index 99% rename from src/system_settings.c rename to src/sys_settings.c index 634a36b..4785896 100644 --- a/src/system_settings.c +++ b/src/sys_settings.c @@ -1,26 +1,25 @@ /* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2011-2020 Samsung Electronics Co., Ltd All Rights Reserved * - * Licensed under the Apache License, Version 2.0 (the License); + * 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, + * 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 #include #include #include -#include -#include +#include "system_settings.h" +#include "sys_settings.h" #include diff --git a/include/system_settings_private.h b/src/sys_settings.h similarity index 99% rename from include/system_settings_private.h rename to src/sys_settings.h index b161cca..8cbb6d0 100644 --- a/include/system_settings_private.h +++ b/src/sys_settings.h @@ -1,20 +1,18 @@ /* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2011-2020 Samsung Electronics Co., Ltd All Rights Reserved * - * Licensed under the Apache License, Version 2.0 (the License); + * 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, + * 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. */ - - #ifndef __TIZEN_SYSTEM_SETTING_PRIVATE_H__ #define __TIZEN_SYSTEM_SETTING_PRIVATE_H__ @@ -24,8 +22,8 @@ extern "C" #endif #include -#include -#include +#include "system_settings.h" +#include "sys_settings_multi_callback.h" #ifndef VCONFKEY_SETAPPL_ACCESSIBILITY_HIGH_CONTRAST #define VCONFKEY_SETAPPL_ACCESSIBILITY_HIGH_CONTRAST "db/setting/accessibility/high_contrast" diff --git a/src/system_settings_json.c b/src/sys_settings_json.c similarity index 86% rename from src/system_settings_json.c rename to src/sys_settings_json.c index c37e8d2..1447db9 100644 --- a/src/system_settings_json.c +++ b/src/sys_settings_json.c @@ -1,10 +1,24 @@ - -#include -#include -#include - +/* + * Copyright (c) 2016-2020 Samsung Electronics Co., Ltd All Rights Reserved + * + * 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 +#include "system_settings.h" +#include "sys_settings.h" +#include "sys_settings_json.h" + //#define VCONFKEY_SETAPPL_CALL_RINGTONE_USER_LIST /* LCOV_EXCL_START */ diff --git a/include/system_settings_json.h b/src/sys_settings_json.h similarity index 84% rename from include/system_settings_json.h rename to src/sys_settings_json.h index a95227f..f6f71e8 100644 --- a/include/system_settings_json.h +++ b/src/sys_settings_json.h @@ -1,20 +1,18 @@ /* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2011-2020 Samsung Electronics Co., Ltd All Rights Reserved * - * Licensed under the Apache License, Version 2.0 (the License); + * 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, + * 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. */ - - #ifndef __TIZEN_SYSTEM_SETTING_JSON_H__ #define __TIZEN_SYSTEM_SETTING_JSON_H__ diff --git a/src/system_settings_multi_callback.c b/src/sys_settings_multi_callback.c similarity index 77% rename from src/system_settings_multi_callback.c rename to src/sys_settings_multi_callback.c index 7e741b8..9129ef1 100644 --- a/src/system_settings_multi_callback.c +++ b/src/sys_settings_multi_callback.c @@ -1,5 +1,20 @@ +/* + * Copyright (c) 2017-2020 Samsung Electronics Co., Ltd All Rights Reserved + * + * 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 -#include +#include "sys_settings.h" void clean_node(callback_node* node) { diff --git a/src/sys_settings_multi_callback.h b/src/sys_settings_multi_callback.h new file mode 100644 index 0000000..a67031b --- /dev/null +++ b/src/sys_settings_multi_callback.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * 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. + */ +#ifndef __TIZEN_SYSTEM_SETTING_MULTI_CALLBACK_H__ +#define __TIZEN_SYSTEM_SETTING_MULTI_CALLBACK_H__ + +#include +#include "system_settings.h" + +typedef struct __st_multi_callback_node_ +{ + system_settings_changed_cb callback; + void* user_data; +}callback_node; + +typedef struct __st_multi_callback_list_ +{ + GList * list; + int is_registered; +}callback_list; + +int add_multi_callback(callback_list *handle, system_settings_changed_cb ptr, void* user_data); +int delete_multi_callback(callback_list *handle, system_settings_changed_cb ptr); +int invoke_callback_list(callback_list *handle, system_settings_key_e key); + + +#endif /* __TIZEN_SYSTEM_SETTING_MULTI_CALLBACK_H__ */ diff --git a/src/system_setting_platform.c b/src/sys_settings_platform.c similarity index 97% rename from src/system_setting_platform.c rename to src/sys_settings_platform.c index 67d86f3..eb58d45 100644 --- a/src/system_setting_platform.c +++ b/src/sys_settings_platform.c @@ -1,19 +1,18 @@ /* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2011-2020 Samsung Electronics Co., Ltd All Rights Reserved * - * Licensed under the Apache License, Version 2.0 (the License); + * 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, + * 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 #include #include @@ -41,19 +40,15 @@ #include #include #include - -#include -#include -#include -#include - -#include - #include #include - #include +#include "system_settings.h" +#include "sys_settings.h" +#include "sys_settings_ringtones.h" +#include "sys_settings_json.h" + #define SETTING_FONT_CONF_FILE _TZ_SYS_ETC"/fonts/conf.avail/99-tizen.conf" #define SETTING_DEFAULT_FONT_CONF_FILE _TZ_SYS_ETC"/fonts/conf.avail/99-tizen.conf" @@ -71,9 +66,9 @@ #define FREE(arg) __FREE(free, arg) #ifdef SETTING_ARCH_64 -#define SETTING_UTILS_SO_FILE_PATH "/usr/lib64/libsystem-settings-util.so.0.1.0" +#define SETTING_UTILS_SO_FILE_PATH "/usr/lib64/libsystem-settings-util.so" #else -#define SETTING_UTILS_SO_FILE_PATH "/usr/lib/libsystem-settings-util.so.0.1.0" +#define SETTING_UTILS_SO_FILE_PATH "/usr/lib/libsystem-settings-util.so" #endif int _is_file_accessible(const char *path); @@ -446,13 +441,13 @@ static bool dl_is_supported_image_type_load(char *path) handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY); if (!handle) { - SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0"); + SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so"); return false; } image_type_check = dlsym(handle, "__is_supported_image_type_load"); if ((error = dlerror()) != NULL) { - SETTING_TRACE("ERROR!! canNOT find __is_supported_image_type_load function at libsystem-settings-util.so.0.1.0"); + SETTING_TRACE("ERROR!! canNOT find __is_supported_image_type_load function at libsystem-settings-util.so"); if (handle) dlclose(handle); return false; @@ -474,13 +469,13 @@ static int dl_is_available_font(char *str) handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY); if (!handle) { - SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0"); + SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so"); return false; } check_available_font = dlsym(handle, "__is_available_font"); if ((error = dlerror()) != NULL) { - SETTING_TRACE("ERROR!! canNOT find __is_available_font function at libsystem-settings-util.so.0.1.0"); + SETTING_TRACE("ERROR!! canNOT find __is_available_font function at libsystem-settings-util.so"); if (handle) dlclose(handle); return false; @@ -501,13 +496,13 @@ static void dl_font_size_set() handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY); if (!handle) { - SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0"); + SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so"); return; } set_font_size = dlsym(handle, "__font_size_set"); if ((error = dlerror()) != NULL) { - SETTING_TRACE("ERROR!! canNOT find __font_size_set function at libsystem-settings-util.so.0.1.0"); + SETTING_TRACE("ERROR!! canNOT find __font_size_set function at libsystem-settings-util.so"); if (handle) dlclose(handle); return; @@ -528,13 +523,13 @@ static void dl_font_config_set_notification() handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY); if (!handle) { - SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0"); + SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so"); return; } set_font_nodification = dlsym(handle, "font_config_set_notification"); if ((error = dlerror()) != NULL) { - SETTING_TRACE("ERROR!! canNOT find font_config_set_notification function at libsystem-settings-util.so.0.1.0"); + SETTING_TRACE("ERROR!! canNOT find font_config_set_notification function at libsystem-settings-util.so"); if (handle) dlclose(handle); return; @@ -556,13 +551,13 @@ static bool dl_font_config_set(char *font_name) handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY); if (!handle) { - SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0"); + SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so"); return false; } check_font_type = dlsym(handle, "font_config_set"); if ((error = dlerror()) != NULL) { - SETTING_TRACE("ERROR!! canNOT find font_config_set function at libsystem-settings-util.so.0.1.0"); + SETTING_TRACE("ERROR!! canNOT find font_config_set function at libsystem-settings-util.so"); if (handle) dlclose(handle); return false; @@ -584,14 +579,14 @@ static char *dl_get_default_font_info() handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY); if (!handle) { - SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0"); + SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so"); return false; } get_font_info = dlsym(handle, "_get_default_font"); if ((error = dlerror()) != NULL) { - SETTING_TRACE("ERROR!! canNOT find _get_default_font function at libsystem-settings-util.so.0.1.0"); + SETTING_TRACE("ERROR!! canNOT find _get_default_font function at libsystem-settings-util.so"); if (handle) dlclose(handle); return false; diff --git a/src/system_settings_ringtones.c b/src/sys_settings_ringtones.c similarity index 90% rename from src/system_settings_ringtones.c rename to src/sys_settings_ringtones.c index 70402fc..de65717 100644 --- a/src/system_settings_ringtones.c +++ b/src/sys_settings_ringtones.c @@ -1,9 +1,5 @@ /* - * system_settings_ringtones.c - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park + * Copyright (c) 2016-2020 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,17 +12,16 @@ * 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 #include #include -#include -#include -#include "system_settings_ringtones.h" -#include "system_settings_json.h" +#include "system_settings.h" +#include "sys_settings.h" +#include "sys_settings_ringtones.h" +#include "sys_settings_json.h" /* LCOV_EXCL_START */ /*remove ext name */ diff --git a/src/sys_settings_ringtones.h b/src/sys_settings_ringtones.h new file mode 100644 index 0000000..500c2fe --- /dev/null +++ b/src/sys_settings_ringtones.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2011-2020 Samsung Electronics Co., Ltd All Rights Reserved + * + * 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. + */ +#ifndef __SYSTEM_SETTINGS_RINGTONES_H__ +#define __SYSTEM_SETTINGS_RINGTONES_H__ + +#include +#include +#include + +typedef struct _ugFsNodeInfo fileNodeInfo; +struct _ugFsNodeInfo { + char *path; + char *name; + char *media_name; +}; + +int get_filelist_from_dir_path(char *path, GList **file_list); +char *get_filename_from_fullname(const char *fullname); + +#if 0 +void ringtone_play_sound(const char *sound_file, player_h **mp_handle); +void ringtone_stop_sound(void *data); +#endif + +#endif /* __SYSTEM_SETTINGS_RINGTONES_H__ */ diff --git a/src/system_settings_vconf.c b/src/sys_settings_vconf.c similarity index 96% rename from src/system_settings_vconf.c rename to src/sys_settings_vconf.c index 047cbf2..a13cdf4 100644 --- a/src/system_settings_vconf.c +++ b/src/sys_settings_vconf.c @@ -1,19 +1,18 @@ /* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2011-2020 Samsung Electronics Co., Ltd All Rights Reserved * - * Licensed under the Apache License, Version 2.0 (the License); + * 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, + * 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 #include #include @@ -21,8 +20,8 @@ #include #include -#include -#include +#include "system_settings.h" +#include "sys_settings.h" #ifdef LOG_TAG #undef LOG_TAG diff --git a/system-setting-config.h.in b/system-setting-config.h.in deleted file mode 100644 index dd85b98..0000000 --- a/system-setting-config.h.in +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef __SYSTEM_SETTING_CONFIG_IN_H -#define __SYSTEM_SETTING_CONFIG_IN_H - -#define VERSION_MAJOR @VERSION_MAJOR@ - -#define VERSION_MINOR @VERSION_MINOR@ - -#define SETTING_DEF_RES_PATH @SETTING_DEF_RES_PATH@ - -#define SETTING_TIME_ZONEINFO_PATH @SETTING_TIME_ZONEINFO_PATH@ - -#define SETTING_TZONE_SYMLINK_PATH @SETTING_TZONE_SYMLINK_PATH@ - -#endif /* __SYSTEM_SETTING_CONFIG_IN_H */ diff --git a/system-settings-util/CMakeLists.txt b/system-settings-util/CMakeLists.txt deleted file mode 100755 index d5e9b43..0000000 --- a/system-settings-util/CMakeLists.txt +++ /dev/null @@ -1,57 +0,0 @@ -#set variable -# SYSTEM_SETTINGS_UTIL - setting-common - -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -PROJECT(${SYSTEM_SETTINGS_UTIL}) - -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) - -SET(requires "dlog vconf fontconfig libxml-2.0 pkgmgr pkgmgr-info libsystemd") - -PKG_CHECK_MODULES(system_settings_util REQUIRED ${requires}) - -FOREACH(flag ${system_settings_util_CFLAGS}) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") -ENDFOREACH(flag) - -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Werror-implicit-function-declaration ${COVERAGE_TEST_FLAGS}") - -IF (CMAKE_BUILD_TYPE STREQUAL "UNITTEST") - SET(COVERAGE_TEST_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage --coverage") - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COVERAGE_TEST_FLAGS} ${EXTRA_CFLAGS}") -SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") -ADD_DEFINITIONS("-DUNIT_TEST") -ENDIF() #CMAKE_BUILD_TYPE STREQUAL "UNITTEST" - - - - -IF("${ARCH}" STREQUAL "arm") - ADD_DEFINITIONS("-DTARGET") - MESSAGE("add -DTARGET") -ENDIF("${ARCH}" STREQUAL "arm") - -ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") -ADD_DEFINITIONS("-DDATADIR=\"${DATADIR}\"") -ADD_DEFINITIONS("-DSLP_DEBUG") -ADD_DEFINITIONS("-shared") - -#SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl, --rpath=/usr/lib") - -#make lib-${LIB_SYSTEM_SETTINGS_UTIL}.so files -ADD_LIBRARY(${LIB_SYSTEM_SETTINGS_UTIL} SHARED - ./src/system_settings_util.c -) - -TARGET_LINK_LIBRARIES(${LIB_SYSTEM_SETTINGS_UTIL} ${system_settings_util_LDFLAGS}) -SET_TARGET_PROPERTIES(${LIB_SYSTEM_SETTINGS_UTIL} PROPERTIES VERSION 0.1.0 SOVERSION 1) -INSTALL(TARGETS ${LIB_SYSTEM_SETTINGS_UTIL} DESTINATION ${CMAKE_LIBDIR}) - -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/system_settings_util.h DESTINATION ${CMAKE_INCLUDEDIR}) -IF (CMAKE_BUILD_TYPE STREQUAL "UNITTEST") -INSTALL( - DIRECTORY "CMakeFiles" DESTINATION /usr/src/packages/BUILD/capi-system-system-settings-${FULLVER}/system-settings-util/ - FILES_MATCHING - PATTERN "*.gcno" - ) -ENDIF() #CMAKE_BUILD_TYPE STREQUAL "UNITTEST" diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..f47cc05 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,22 @@ +SET(UNITTEST "sys-settings-test") +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIE") +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIE") + +SET(VCONF_MOCK "vconf-mock") +ADD_LIBRARY(${VCONF_MOCK} SHARED mocks/vconf.cpp) + +SET(PKGMGR_INFO_MOCK "pkgmgr-info-mock") +ADD_LIBRARY(${PKGMGR_INFO_MOCK} SHARED mocks/pkgmgrinfo_appinfo.c) + +SET(EFL_EXTENSION_INFO_MOCK "efl-extension-mock") +ADD_LIBRARY(${EFL_EXTENSION_INFO_MOCK} SHARED mocks/efl-extension.c) + +FILE(GLOB TEST_SRCS *.c) +ADD_DEFINITIONS("-DN_THREADS=${N_THREADS}") +ADD_DEFINITIONS(-DSYS_SETTINGS_TEST_DIR=\"${TEST_INSTALL_DIR}\") +ADD_EXECUTABLE(${UNITTEST} ${TEST_SRCS}) +TARGET_LINK_LIBRARIES(${UNITTEST} ${PROJECT_NAME} dl) +INSTALL(TARGETS ${UNITTEST} DESTINATION ${TEST_INSTALL_DIR}) + +FILE(GLOB TEST_RES res/*) +INSTALL(FILES ${TEST_RES} DESTINATION ${TEST_INSTALL_DIR}) diff --git a/tests/mocks/efl-extension.c b/tests/mocks/efl-extension.c new file mode 100644 index 0000000..05a09c9 --- /dev/null +++ b/tests/mocks/efl-extension.c @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved + * + * 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 +#include +#include + +#ifndef API +#define API __attribute__ ((visibility("default"))) +#endif + +API bool eext_config_font_set(char *name, int size) +{ + return true; +} + diff --git a/unit_test/src/pkgmgrinfo_appinfo.c b/tests/mocks/pkgmgrinfo_appinfo.c similarity index 95% rename from unit_test/src/pkgmgrinfo_appinfo.c rename to tests/mocks/pkgmgrinfo_appinfo.c index 17aa2fb..10aa835 100644 --- a/unit_test/src/pkgmgrinfo_appinfo.c +++ b/tests/mocks/pkgmgrinfo_appinfo.c @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved + * + * 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 #include #include diff --git a/unit_test/src/vconf.cpp b/tests/mocks/vconf.cpp similarity index 98% rename from unit_test/src/vconf.cpp rename to tests/mocks/vconf.cpp index af0af23..40aeb6d 100644 --- a/unit_test/src/vconf.cpp +++ b/tests/mocks/vconf.cpp @@ -1,11 +1,11 @@ /* - * Copyright (C) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved * - * Licensed under the Apache License, Version 2.0 (the License); + * 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 + * 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, @@ -13,9 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -#pragma once - #include #include #include @@ -23,12 +20,11 @@ #include #include - #include #include #include -#define LOG_D //fprintf +#define LOG_D(fmt, arg...) //fprintf(fmt, arg...) #define LOG_E fprintf using namespace std; @@ -137,7 +133,7 @@ extern "C" { case VCONF_TYPE_BOOL: node.value.b = value->b; break; -defalut: + default: LOG_D(stdout, "[%s][%d] invalid type [%d] \n", __func__, __LINE__, node.type ); return; } @@ -149,7 +145,7 @@ defalut: static sqlite3 *db = NULL; - int _sqlite_close() { + void _sqlite_close() { if( db != NULL ){ sqlite3_close(db); db = NULL; @@ -157,21 +153,17 @@ defalut: } int _sqlite_connect() { - - int rc; - char *err_msg = 0; - char sql[MAX_BUF_LEN+1]; - if( db != NULL ) { return VCONF_OK; } - rc = sqlite3_open(DB_NAME, &db); + int rc = sqlite3_open(DB_NAME, &db); if (rc != SQLITE_OK) { LOG_E(stderr, "[%s][%d] sqlite3_open error: rc [%d] sqlerrcode[%d] sqlexterrcode[%d] sqlmessage[%s]\n", __func__, __LINE__, rc, sqlite3_errcode(db), sqlite3_extended_errcode(db), sqlite3_errmsg(db)); _sqlite_close(); return VCONF_ERROR; } + return VCONF_OK; } /************************************************ diff --git a/unit_test/resource/ringtone_sdk.mp3 b/tests/res/ringtone_sdk.mp3 similarity index 100% rename from unit_test/resource/ringtone_sdk.mp3 rename to tests/res/ringtone_sdk.mp3 diff --git a/unit_test/run_coverage.sh b/tests/run_coverage.sh similarity index 96% rename from unit_test/run_coverage.sh rename to tests/run_coverage.sh index 2191fb4..30ccc34 100755 --- a/unit_test/run_coverage.sh +++ b/tests/run_coverage.sh @@ -4,7 +4,7 @@ RootDir=$PWD popd createVconfDb() { - pushd script + pushd scripts ./convert_vconf_script_to_sql.sh if [ ! -f vconf.db ] @@ -41,7 +41,7 @@ system_info_init_db -k "tizen.org/feature/input.rotating_bezel" -t bool -g platf #======================================================================================== # Causion : Need to root permission #======================================================================================== -cp -f ../system-settings-util/libsystem-settings-util.so* /usr/lib +cp -f ../utils/libsystem-settings-util.so* /usr/lib echo "link [/opt/etc/localtime]" ln -sf /etc/localtime /opt/etc/localtime @@ -71,7 +71,7 @@ touch "/opt/usr/test/sound_5.wav" touch "/opt/usr/test/tct-content-tizen-tests_video.mp4" #======================================================================================== -unitTestFile=system-setting-unittest +unitTestFile=sys-settings-test if [ ! -x "${unitTestFile}" ] then echo "${unitTestFile} file does not exist!" diff --git a/unit_test/script/convert_vconf_script_to_sql.sh b/tests/scripts/convert_vconf_script_to_sql.sh similarity index 100% rename from unit_test/script/convert_vconf_script_to_sql.sh rename to tests/scripts/convert_vconf_script_to_sql.sh diff --git a/unit_test/script/unit_test_gdb_script b/tests/scripts/unit_test_gdb_script similarity index 79% rename from unit_test/script/unit_test_gdb_script rename to tests/scripts/unit_test_gdb_script index e04a506..5bf19a7 100644 --- a/unit_test/script/unit_test_gdb_script +++ b/tests/scripts/unit_test_gdb_script @@ -2,7 +2,7 @@ set pagination off set logging file /opt/usr/share/unit_test_gdb_logs.txt set logging on set confirm off -file /usr/local/bin/system-setting-unittest +file /usr/bin/sys-settings/sys-settings-test r # run it once break exit commands diff --git a/unit_test/script/unittest.sh b/tests/scripts/unittest.sh old mode 100755 new mode 100644 similarity index 94% rename from unit_test/script/unittest.sh rename to tests/scripts/unittest.sh index 22d90ea..336da5c --- a/unit_test/script/unittest.sh +++ b/tests/scripts/unittest.sh @@ -44,8 +44,8 @@ sudo mkdir -p /home/abuild/rpmbuild/BUILD/$APP-$VERSHORT sudo cp -rf . /home/abuild/rpmbuild/BUILD/$APP-$VERSHORT SDB=/usr/bin/sdb -GDB_SCRIPT=$PWD/unit_test/script/unit_test_gdb_script -UNIT_TEST_RESOURCE=$PWD/unit_test/resource/* +GDB_SCRIPT=$PWD/tests/scripts/unit_test_gdb_script +UNIT_TEST_RESOURCE=$PWD/tests/res/* $SDB root on $SDB shell mount -o remount,rw / $SDB push $RPM_ROOT/$APP-$VER.$ARCH.rpm /opt @@ -62,7 +62,7 @@ echo "UNIT TEST----------------------------------------------------" export GCOV_PREFIX=/opt if [ -z $GDB_TEST]; then -$SDB shell su - -c "G_DEBUG=fatal-criticals GCOV_PREFIX=/usr/src/packages GCOV_PREFIX_STRIP=3 /usr/local/bin/system-setting-unittest" +$SDB shell su - -c "G_DEBUG=fatal-criticals GCOV_PREFIX=/usr/src/packages GCOV_PREFIX_STRIP=3 /usr/bin/sys-settings/sys-settings-test" else $SDB shell su - -c "G_DEBUG=fatal-criticals GCOV_PREFIX=/usr/src/packages GCOV_PREFIX_STRIP=3 gdb -x /usr/local/bin/unit_test_gdb_script" fi diff --git a/unit_test/script/unittest2.sh b/tests/scripts/unittest2.sh old mode 100755 new mode 100644 similarity index 96% rename from unit_test/script/unittest2.sh rename to tests/scripts/unittest2.sh index 8c4b58f..fa1f7e0 --- a/unit_test/script/unittest2.sh +++ b/tests/scripts/unittest2.sh @@ -43,7 +43,7 @@ $SDB shell rpm -Uvh --force --nodeps /opt/$APP-debugsource-$VER.$ARCH.rpm echo "UNIT TEST----------------------------------------------------" export GCOV_PREFIX=/opt -$SDB shell G_DEBUG=fatal-criticals GCOV_PREFIX=/usr/src/packages GCOV_PREFIX_STRIP=3 /usr/local/bin/system-setting-unittest +$SDB shell G_DEBUG=fatal-criticals GCOV_PREFIX=/usr/src/packages GCOV_PREFIX_STRIP=3 /usr/bin/sys-settings/sys-settings-test echo "COVERAGE TEST----------------------------------------------------" sdb pull /usr/src/packages/BUILD/$APP-$VERSHORT/CMakeFiles > /dev/null 2>&1 diff --git a/unit_test/script/vconf_all.sh b/tests/scripts/vconf_all.sh similarity index 100% rename from unit_test/script/vconf_all.sh rename to tests/scripts/vconf_all.sh diff --git a/unit_test/src/unit_test.c b/tests/sys_settings_test.c similarity index 99% rename from unit_test/src/unit_test.c rename to tests/sys_settings_test.c index cef6a19..4919296 100644 --- a/unit_test/src/unit_test.c +++ b/tests/sys_settings_test.c @@ -1,8 +1,22 @@ -#include - -#include +/* + * Copyright (c) 2017-2020 Samsung Electronics Co., Ltd All Rights Reserved + * + * 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 +#include +#include "sys_settings_test_fw.h" void unit_test_callback0(system_settings_key_e key, void *user_data) { } void unit_test_callback1(system_settings_key_e key, void *user_data) { } @@ -90,7 +104,7 @@ static int my_assert_ret_eq_bool(int retcode, bool a, bool b) #define my_assert_ret(retcode) do{ \ if (retcode != SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED) { \ if (retcode != SYSTEM_SETTINGS_ERROR_NONE) \ - printf("Error!!\n"); \ + printf("Error!!(%d)\n", retcode); \ assert(retcode == SYSTEM_SETTINGS_ERROR_NONE); \ } \ }while(0) @@ -180,7 +194,7 @@ system_settings_changed_cb get_system_settings_test_callback() } static bool _callback_called = false; -static char *new_ringtonepath = "/opt/usr/share/ringtone_sdk.mp3"; +static char *new_ringtonepath = SYS_SETTINGS_TEST_DIR "/ringtone_sdk.mp3"; /** * @function utc_system_settings_startup diff --git a/unit_test/include/unit_test_assert.h b/tests/sys_settings_test.h old mode 100755 new mode 100644 similarity index 81% rename from unit_test/include/unit_test_assert.h rename to tests/sys_settings_test.h index 93f54c5..c701717 --- a/unit_test/include/unit_test_assert.h +++ b/tests/sys_settings_test.h @@ -1,20 +1,20 @@ -// -// Copyright (c) 2014 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. -// -#ifndef _ASSERT_H_ -#define _ASSERT_H_ +/* + * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved + * + * 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. + */ +#pragma once + #include #include @@ -100,5 +100,3 @@ #define assert_leq(var, ref) g_assert(var <= ref) #endif //GLIB_MODE - -#endif // _ASSERT_H_ diff --git a/unit_test/src/unit_test_fw.c b/tests/sys_settings_test_fw.c similarity index 77% rename from unit_test/src/unit_test_fw.c rename to tests/sys_settings_test_fw.c index 65a9a37..f4a4cd4 100644 --- a/unit_test/src/unit_test_fw.c +++ b/tests/sys_settings_test_fw.c @@ -1,4 +1,19 @@ -#include +/* + * Copyright (c) 2017-2020 Samsung Electronics Co., Ltd All Rights Reserved + * + * 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 "sys_settings_test_fw.h" typedef struct __thread_test_table { char * test_name; diff --git a/tests/sys_settings_test_fw.h b/tests/sys_settings_test_fw.h new file mode 100644 index 0000000..c3d9ddb --- /dev/null +++ b/tests/sys_settings_test_fw.h @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2017-2020 Samsung Electronics Co., Ltd All Rights Reserved + * + * 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. + */ +#ifndef __UNIT_TEST_FW__ +#define __UNIT_TEST_FW__ + +#define GLIB_MODE + +#include +#include +#include + +#include "sys_settings_test.h" + +void add_test_func(char * test_name, GTestFunc func_pointer); +void unittest_api(); + +#ifndef SYS_SETTINGS_TEST_DIR +#define SYS_SETTINGS_TEST_DIR "/usr/bin/sys-settings" +#warning "SYS_SETTINGS_TEST_DIR is redefined" +#endif + +#ifdef GLIB_MODE +#define RETTYPE void +#define RETURN(a) return +#else +#define RETTYPE int +#define RETURN(a) return a +#endif + +#ifndef N_THREADS +#define N_THERADS 0 +#endif + +#define MAX_TEST_CASE 1000 + +#endif diff --git a/unit_test/CMakeLists.txt b/unit_test/CMakeLists.txt deleted file mode 100755 index f74b9ca..0000000 --- a/unit_test/CMakeLists.txt +++ /dev/null @@ -1,56 +0,0 @@ - -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -SET(fw_name "capi-system-system-settings") -SET(unit_test "system-setting-unittest") - -SET(requires "dlog vconf fontconfig libxml-2.0 sqlite3 pkgmgr pkgmgr-info alarm-service capi-media-metadata-extractor aul json-glib-1.0 capi-appfw-app-manager capi-appfw-package-manager capi-system-info glib-2.0") - -PROJECT(${unit_test}) - -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) - -INCLUDE(FindPkgConfig) -pkg_check_modules(${fw_name} REQUIRED ${requires}) -FOREACH(flag ${${fw_name}_CFLAGS}) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") -ENDFOREACH(flag) - -INCLUDE(FindPkgConfig) -pkg_check_modules(${unit_test} REQUIRED ${requires}) -FOREACH(flag ${${unit_test}_CFLAGS}) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") -ENDFOREACH(flag) - -#=======================================================================================# -SET(VCONF_MOCK "vconf-mock") -SET(VCONF_MOCK_SRCS src/vconf.cpp ) -SET(VCONF_MOCK_CFLAGS "${CMAKE_C_FLAGS}" ) -ADD_LIBRARY(${VCONF_MOCK} SHARED ${VCONF_MOCK_SRCS}) -SET_TARGET_PROPERTIES(${VCONF_MOCK} PROPERTIES - COMPILE_FLAGS ${VCONF_MOCK_CFLAGS} -) -#=======================================================================================# -SET(PKGMGR_INFO_MOCK "pkgmgr-info-mock") -SET(PKGMGR_INFO_MOCK_SRCS src/pkgmgrinfo_appinfo.c ) -SET(PKGMGR_INFO_MOCK_CFLAGS "${CMAKE_C_FLAGS}" ) -ADD_LIBRARY(${PKGMGR_INFO_MOCK} SHARED ${PKGMGR_INFO_MOCK_SRCS}) -SET_TARGET_PROPERTIES(${PKGMGR_INFO_MOCK} PROPERTIES - COMPILE_FLAGS ${PKGMGR_INFO_MOCK_CFLAGS} -) -#=======================================================================================# -SET(EFL_EXTENSION_INFO_MOCK "efl-extension-mock") -SET(EFL_EXTENSION_INFO_MOCK_SRCS src/efl-extension.c ) -SET(EFL_EXTENSION_INFO_MOCK_CFLAGS "${CMAKE_C_FLAGS}" ) -ADD_LIBRARY(${EFL_EXTENSION_INFO_MOCK} SHARED ${EFL_EXTENSION_INFO_MOCK_SRCS}) -SET_TARGET_PROPERTIES(${EFL_EXTENSION_INFO_MOCK} PROPERTIES - COMPILE_FLAGS ${EFL_EXTENSION_INFO_MOCK_CFLAGS} -) -#=======================================================================================# -SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}") -ADD_DEFINITIONS("-DN_THREADS=${N_THREADS}") -ADD_EXECUTABLE(${unit_test} src/unit_test.c - src/unit_test_fw.c) - -TARGET_LINK_LIBRARIES(${unit_test} ${fw_name} "-ldl") -INSTALL(TARGETS ${unit_test} DESTINATION /usr/local/bin) - diff --git a/unit_test/include/unit_test_fw.h b/unit_test/include/unit_test_fw.h deleted file mode 100644 index d4de420..0000000 --- a/unit_test/include/unit_test_fw.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef __UNIT_TEST_FW__ -#define __UNIT_TEST_FW__ - -#define GLIB_MODE - -#include -#include -#include - -#include - -void add_test_func(char * test_name, GTestFunc func_pointer); -void unittest_api(); - -#ifdef GLIB_MODE -#define RETTYPE void -#define RETURN(a) return -#else -#define RETTYPE int -#define RETURN(a) return a -#endif - -#ifndef N_THREADS -#define N_THERADS 0 -#endif - -#define MAX_TEST_CASE 1000 - -#endif diff --git a/unit_test/src/efl-extension.c b/unit_test/src/efl-extension.c deleted file mode 100644 index d7799b7..0000000 --- a/unit_test/src/efl-extension.c +++ /dev/null @@ -1,13 +0,0 @@ -#include -#include -#include - -#ifndef API -#define API __attribute__ ((visibility("default"))) -#endif - -API bool eext_config_font_set(char *name, int size) -{ - return true; -} - diff --git a/unit_test/src/vconf.sym b/unit_test/src/vconf.sym deleted file mode 100644 index 745cacf..0000000 --- a/unit_test/src/vconf.sym +++ /dev/null @@ -1,38 +0,0 @@ -VCONF_BUXTON_1.0 { - global: - vconf_keynode_get_name; - vconf_keynode_get_type; - vconf_keynode_get_int; - vconf_keynode_get_dbl; - vconf_keynode_get_bool; - vconf_keynode_get_str; - vconf_notify_key_changed; - vconf_ignore_key_changed; - vconf_set_int; - vconf_set_bool; - vconf_set_str; - vconf_set_dbl; - vconf_get_int; - vconf_get_bool; - vconf_get_str; - vconf_get_dbl; - vconf_get_ext_errno; - vconf_keylist_new; - vconf_keylist_free; - vconf_keylist_add_int; - vconf_keylist_add_bool; - vconf_keylist_add_dbl; - vconf_keylist_add_str; - vconf_keylist_add_null; - vconf_keylist_del; - vconf_keylist_nextnode; - vconf_keylist_rewind; - vconf_get; - vconf_set; - vconf_unset; - vconf_unset_recursive; - vconf_sync_key; - vconf_keylist_lookup; - local: - *; -}; diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt new file mode 100644 index 0000000..4db1ea7 --- /dev/null +++ b/utils/CMakeLists.txt @@ -0,0 +1,13 @@ +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src) + +SET(LIB_UTILS system-settings-util) + +FILE(GLOB UTILS_SRCS *.c) + +PKG_CHECK_MODULES(utils_pkgs REQUIRED dlog vconf fontconfig libxml-2.0 pkgmgr pkgmgr-info libsystemd) +INCLUDE_DIRECTORIES(${client_pkgs_INCLUDE_DIRS}) +LINK_DIRECTORIES(${client_pkgs_LIBRARY_DIRS}) + +ADD_LIBRARY(${LIB_UTILS} SHARED ${UTILS_SRCS}) +TARGET_LINK_LIBRARIES(${LIB_UTILS} ${utils_LIBRARIES}) +INSTALL(TARGETS ${LIB_UTILS} DESTINATION ${LIB_INSTALL_DIR}) diff --git a/system-settings-util/include/system_settings_font.h b/utils/sys_settings_font.h similarity index 100% rename from system-settings-util/include/system_settings_font.h rename to utils/sys_settings_font.h diff --git a/system-settings-util/src/system_settings_util.c b/utils/sys_settings_util.c similarity index 98% rename from system-settings-util/src/system_settings_util.c rename to utils/sys_settings_util.c index 2a43651..1ce407d 100644 --- a/system-settings-util/src/system_settings_util.c +++ b/utils/sys_settings_util.c @@ -17,13 +17,12 @@ #include #include - -#include -#include - #include -#include -#include + +#include "system_settings.h" +#include "sys_settings.h" +#include "sys_settings_util.h" +#include "sys_settings_font.h" #ifdef TIZEN_WEARABLE #define SMALL_FONT_DPI (-90) diff --git a/system-settings-util/include/system_settings_util.h b/utils/sys_settings_util.h similarity index 100% rename from system-settings-util/include/system_settings_util.h rename to utils/sys_settings_util.h -- 2.7.4