From 157829b74c6073be2dc27f6927a80ac081968c88 Mon Sep 17 00:00:00 2001 From: Yunjin Lee Date: Fri, 11 Sep 2020 10:49:51 +0900 Subject: [PATCH 01/16] Release version 0.0.6 (modified) - Due to the testhub environment, change privacy privilege check method - Remove duplicated logics - Update API reference and doc Change-Id: Ib2769f5ce91a500d07e1f7fd413619a8254bbe2b Signed-off-by: Yunjin Lee --- packaging/privilege-info.changes | 1 + 1 file changed, 1 insertion(+) diff --git a/packaging/privilege-info.changes b/packaging/privilege-info.changes index 85fcf2e..5ea38ff 100644 --- a/packaging/privilege-info.changes +++ b/packaging/privilege-info.changes @@ -1,4 +1,5 @@ Release version 0.0.6 +- Change privacy privilege check - Remove duplicated logics - Update API reference and doc -- 2.7.4 From 5d869680b75442b0d2c256124b199c349cd440e6 Mon Sep 17 00:00:00 2001 From: Yunjin Lee Date: Mon, 21 Sep 2020 11:36:04 +0900 Subject: [PATCH 02/16] Check after getting return - When calling __convert_return_value(), pass return value and derived out value after getting return cleary. On some target, in this case emulator image, it fails to reference passed out param pointer, hence separate them to be safe. Change-Id: I7ffb4f9dd06be466485952800a280c5fd6973254 Signed-off-by: Yunjin Lee --- src/privilege_information.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/privilege_information.c b/src/privilege_information.c index 6de2c21..6d7e2e7 100755 --- a/src/privilege_information.c +++ b/src/privilege_information.c @@ -108,7 +108,9 @@ int privilege_info_get_display_name(const char *api_version, const char *privile TryReturn(api_version != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] api_version is NULL"); TryReturn(privilege != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] privilege is NULL"); - return __convert_return_value(privilege_info_get_privilege_display_name(privilege, display_name), *display_name); + int ret = privilege_info_get_privilege_display_name(privilege, display_name); + + return __convert_return_value(ret, *display_name); } PI_API @@ -117,7 +119,9 @@ int privilege_info_get_description(const char *api_version, const char *privileg TryReturn(api_version != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] api_version is NULL"); TryReturn(privilege != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] privilege is NULL"); - return __convert_return_value(privilege_info_get_privilege_description(privilege, description), *description); + int ret = privilege_info_get_privilege_description(privilege, description); + + return __convert_return_value(ret, *description); } PI_API @@ -127,7 +131,9 @@ int privilege_info_get_display_name_by_pkgtype(const char *package_type, const c TryReturn(api_version != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] api_version is NULL"); TryReturn(privilege != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] privilege is NULL"); - return __convert_return_value(privilege_info_get_privilege_display_name_by_package_type(privilege, api_version, __convert_package_type(package_type), display_name), *display_name); + int ret = privilege_info_get_privilege_display_name_by_package_type(privilege, api_version, __convert_package_type(package_type), display_name); + + return __convert_return_value(ret, *display_name); } PI_API @@ -137,7 +143,9 @@ int privilege_info_get_description_by_pkgtype(const char *package_type, const ch TryReturn(api_version != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] api_version is NULL"); TryReturn(privilege != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] privilege is NULL"); - return __convert_return_value(privilege_info_get_privilege_description_by_package_type(privilege, api_version, __convert_package_type(package_type), description), *description); + int ret = privilege_info_get_privilege_description_by_package_type(privilege, api_version, __convert_package_type(package_type), description); + + return __convert_return_value(ret, *description); } PI_API -- 2.7.4 From 282b7b05fdcb656aa82e590ef9fb6d1f556aadcf Mon Sep 17 00:00:00 2001 From: Yunjin Lee Date: Mon, 21 Sep 2020 11:44:37 +0900 Subject: [PATCH 03/16] Release version 0.0.7 - Check after getting return Change-Id: Ifbb1cc7bdbd661642e1945276ecbb32b4dc7da64 Signed-off-by: Yunjin Lee --- packaging/privilege-info.changes | 3 +++ packaging/privilege-info.spec | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packaging/privilege-info.changes b/packaging/privilege-info.changes index 5ea38ff..2b479eb 100644 --- a/packaging/privilege-info.changes +++ b/packaging/privilege-info.changes @@ -1,3 +1,6 @@ +Release version 0.0.7 +- Check after getting return + Release version 0.0.6 - Change privacy privilege check - Remove duplicated logics diff --git a/packaging/privilege-info.spec b/packaging/privilege-info.spec index a45e337..f4c306e 100644 --- a/packaging/privilege-info.spec +++ b/packaging/privilege-info.spec @@ -1,6 +1,6 @@ Name: privilege-info Summary: Privilege Information -Version: 0.0.6 +Version: 0.0.7 Release: 1 Group: Security/API License: Apache-2.0 -- 2.7.4 From b3cd1f9fb5007f3f9ec65abac0ec3ce0b4a5e993 Mon Sep 17 00:00:00 2001 From: Yunjin Lee Date: Thu, 17 Dec 2020 10:22:17 +0900 Subject: [PATCH 04/16] remove hyperlink from feature name of doc Change-Id: I7072256239f49a3034453445d1fabb6303ff27a4 Signed-off-by: Yunjin Lee --- doc/privilege-info_doc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/privilege-info_doc.h b/doc/privilege-info_doc.h index 7848865..5b0e618 100755 --- a/doc/privilege-info_doc.h +++ b/doc/privilege-info_doc.h @@ -32,7 +32,7 @@ * * @section CAPI_SECURITY_FRAMEWORK_PRIVILEGE_INFO_MODULE_FEATURE Related Features * This API is related with the following features:\n - * - http://tizen.org/feature/security.privacy_privilege\n + * - %http://tizen.org/feature/security.privacy_privilege\n * It is recommended to design feature related codes in your application for reliability.\n * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, and control your application's actions accordingly.\n * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n -- 2.7.4 From a4a014b3e33388e125c7376be295c335e051f69f Mon Sep 17 00:00:00 2001 From: Dariusz Michaluk Date: Tue, 12 Jan 2021 16:38:06 +0100 Subject: [PATCH 05/16] Fix source files access rights Change-Id: I3f8f77e83e656c4f00645ca071807317b90248f8 --- CMakeLists.txt | 0 doc/privilege-info_doc.h | 0 privilege-info.pc.in | 0 src/CMakeLists.txt | 0 src/include/privilege_information.h | 0 src/privilege_information.c | 0 test/CMakeLists.txt | 0 test/tc_privilege_info.c | 0 8 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 CMakeLists.txt mode change 100755 => 100644 doc/privilege-info_doc.h mode change 100755 => 100644 privilege-info.pc.in mode change 100755 => 100644 src/CMakeLists.txt mode change 100755 => 100644 src/include/privilege_information.h mode change 100755 => 100644 src/privilege_information.c mode change 100755 => 100644 test/CMakeLists.txt mode change 100755 => 100644 test/tc_privilege_info.c diff --git a/CMakeLists.txt b/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/doc/privilege-info_doc.h b/doc/privilege-info_doc.h old mode 100755 new mode 100644 diff --git a/privilege-info.pc.in b/privilege-info.pc.in old mode 100755 new mode 100644 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/src/include/privilege_information.h b/src/include/privilege_information.h old mode 100755 new mode 100644 diff --git a/src/privilege_information.c b/src/privilege_information.c old mode 100755 new mode 100644 diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/test/tc_privilege_info.c b/test/tc_privilege_info.c old mode 100755 new mode 100644 -- 2.7.4 From af0671e6734470169f57f0f2b21e1a9331e9b7fe Mon Sep 17 00:00:00 2001 From: Dariusz Michaluk Date: Wed, 13 Jan 2021 12:21:37 +0100 Subject: [PATCH 06/16] Cleanup cmake/spec infrastructure Change-Id: I17436b498832c39c19393d752c2d79ee81bbaa72 --- CMakeLists.txt | 37 ++++++++++++------- packaging/privilege-info.spec | 85 ++++++++----------------------------------- privilege-info.pc.in | 23 +++++------- src/CMakeLists.txt | 66 ++++++++++----------------------- test/CMakeLists.txt | 27 ++------------ 5 files changed, 74 insertions(+), 164 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0ed70da..c8b66fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,22 +1,33 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +CMAKE_MINIMUM_REQUIRED(VERSION 3.0) +PROJECT(privilege-info VERSION 0.0.7 LANGUAGES C) -SET(CMAKE_VERBOSE_MAKEFILE OFF) +INCLUDE(GNUInstallDirs) +INCLUDE(FindPkgConfig) -IF("${USE_AUTOSTART}" STREQUAL "1") - ADD_DEFINITIONS("-DUSE_AUTOSTART") -ENDIF() +IF(NOT CMAKE_BUILD_TYPE) + SET(CMAKE_BUILD_TYPE "RELEASE") +ENDIF(NOT CMAKE_BUILD_TYPE) -ADD_DEFINITIONS("-DCLIENT_IPC_THREAD") -ADD_DEFINITIONS("-DUSE_IPC_EPOLL") +SET(CMAKE_C_FLAGS_DEBUG "-std=c11 -O0 -ggdb -Wp,-U_FORTIFY_SOURCE") +SET(CMAKE_C_FLAGS_RELEASE "-std=c11 -O2 -DNDEBUG") -ADD_DEFINITIONS("-Werror -Wall -Wextra") +ADD_DEFINITIONS("-Werror") +ADD_DEFINITIONS("-Wall") +ADD_DEFINITIONS("-Wextra") -STRING(REGEX MATCH "([^.]*)" API_VERSION "${VERSION}") -ADD_DEFINITIONS("-DAPI_VERSION=\"$(API_VERSION)\"") +SET(CMAKE_POSITION_INDEPENDENT_CODE "True") +SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie") -CONFIGURE_FILE(privilege-info.pc.in privilege-info.pc @ONLY) +PKG_CHECK_MODULES(PRIVILEGE_INFO_DEPS REQUIRED + glib-2.0 + dlog + security-privilege-manager + capi-base-common + capi-system-info) + +INCLUDE_DIRECTORIES(SYSTEM ${PRIVILEGE_INFO_DEPS_INCLUDE_DIRS}) +LINK_DIRECTORIES(${PRIVILEGE_INFO_DEPS_LIBRARY_DIRS}) +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/include) -MESSAGE("build privilege-info") ADD_SUBDIRECTORY(src) -MESSAGE("build tc-privilege-info") ADD_SUBDIRECTORY(test) diff --git a/packaging/privilege-info.spec b/packaging/privilege-info.spec index f4c306e..5a1cdea 100644 --- a/packaging/privilege-info.spec +++ b/packaging/privilege-info.spec @@ -1,3 +1,5 @@ +%{!?build_type:%global build_type RELEASE} + Name: privilege-info Summary: Privilege Information Version: 0.0.7 @@ -8,17 +10,13 @@ Source0: %{name}-%{version}.tar.gz Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig + BuildRequires: cmake BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(capi-base-common) -BuildRequires: pkgconfig(security-privilege-manager) -BuildRequires: pkgconfig(libtzplatform-config) BuildRequires: pkgconfig(capi-system-info) -%if 0%{?gcov:1} -BuildRequires: lcov -%endif -Requires: tizen-locale +BuildRequires: pkgconfig(security-privilege-manager) %description Provides Privilege Information(Privilege Info) API @@ -29,96 +27,45 @@ Group: Security/Development Requires: %{name} = %{version}-%{release} %description -n privilege-info-devel -The Privilege Info API provides functions to get privilege information (DEV) +The Privilege Info API provides functions to get privilege information (Development) -%package -n tc-privilege-info +%package -n privilege-info-tests Summary: Privilege Info TC Group: Security/Testing Requires: %{name} = %{version}-%{release} -%description -n tc-privilege-info +%description -n privilege-info-tests Privilege Info API Internal Test -%if 0%{?gcov:1} -%package gcov -Summary: Privilege Info(gcov) -Group: Security/Testing -%description gcov -New Privilege Info gcov objects -%endif - - %prep %setup -q %build - -export CFLAGS="$CFLAGS -DTIZEN_ENGINEER_MODE" -export CXXFLAGS="$CXXFLAGS -DTIZEN_ENGINEER_MODE" -export FFLAGS="$FFLAGS -DTIZEN_ENGINEER_MODE" - -%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 - -echo cmake . -DPREFIX=%{_prefix} \ - -DLIBDIR=%{_libdir} \ - -DINCLUDEDIR=%{_includedir} \ - -DCMAKE_BUILD_TYPE=%{build_type} \ - -DVERSION=%{version} \ - -DTZ_SYS_RO_PACKAGES=%TZ_SYS_RO_PACKAGES \ - -DTZ_SYS_RO_APP=%TZ_SYS_RO_APP \ - -DBUILD_GCOV={?gcov:1}%{!?gcov:0} - -cmake . -DPREFIX=%{_prefix} \ - -DLIBDIR=%{_libdir} \ - -DINCLUDEDIR=%{_includedir} \ - -DCMAKE_BUILD_TYPE=%{build_type} \ - -DVERSION=%{version} \ - -DTZ_SYS_RO_PACKAGES=%TZ_SYS_RO_PACKAGES \ - -DTZ_SYS_RO_APP=%TZ_SYS_RO_APP \ - -DBUILD_GCOV={?gcov:1}%{!?gcov:0} +%cmake . -DCMAKE_BUILD_TYPE=%{build_type} make %{?jobs:-j%jobs} -%if 0%{?gcov:1} -mkdir -p gcov-obj -find . \( -name '*.gcno' ! -name 'tc_*' \) -exec cp '{}' gcov-obj ';' -%endif - %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 -%endif +%clean +rm -rf %{buildroot} %post -n privilege-info -p /sbin/ldconfig %postun -n privilege-info -p /sbin/ldconfig %files -n privilege-info -%{_libdir}/libprivilege-info.so* %license LICENSE.Apache-2.0 %manifest packaging/privilege-info.manifest +%{_libdir}/libprivilege-info.so.* %files -n privilege-info-devel +%manifest packaging/privilege-info.manifest +%{_libdir}/libprivilege-info.so %{_includedir}/privilege_information.h %{_libdir}/pkgconfig/privilege-info.pc -%files -n tc-privilege-info -%{_bindir}/tc-privilege-info - -%if 0%{?gcov:1} -%files gcov -%{_datadir}/gcov/obj/* -%endif - -%clean -rm -rf %{buildroot} - +%files -n privilege-info-tests +%manifest packaging/privilege-info.manifest +%{_bindir}/privilege-info-tests diff --git a/privilege-info.pc.in b/privilege-info.pc.in index 050d8ad..6a257c0 100644 --- a/privilege-info.pc.in +++ b/privilege-info.pc.in @@ -1,14 +1,11 @@ -# Package Information for pkg-config - -prefix=@PREFIX@ -exec_prefix=/usr -libdir=@LIBDIR@ -includedir=@INCLUDEDIR@ - -Name: @PC_NAME@ -Description: @PACKAGE_DESCRIPTION@ -Version: @VERSION@ -Requires: @PC_REQUIRED@ -Libs: -L${libdir} @PC_LDFLAGS@ -Cflags: -I${includedir} @PC_CFLAGS@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=@CMAKE_INSTALL_PREFIX@ +libdir=@LIB_INSTALL_DIR@ +includedir=@INCLUDE_INSTALL_DIR@ +Name: privilege-info +Description: Provides Privilege Information(Privilege Info) API +Version: @PROJECT_VERSION@ +Requires: glib-2.0 +Libs: -L${libdir} -lprivilege-info +Cflags: -I${includedir} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a0cf43c..f0bd2ae 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,46 +1,20 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -SET(PACKAGE_NAME privilege-info) -PROJECT(${PACKAGE_NAME}) - -SET(PRIV_INFO_SOURCES - ${PROJECT_SOURCE_DIR}/privilege_information.c -) - -INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/include) - -SET(requires glib-2.0 dlog security-privilege-manager capi-system-info) -INCLUDE(FindPkgConfig) -pkg_check_modules(${PACKAGE_NAME} REQUIRED ${requires}) -FOREACH(flag ${${PACKAGE_NAME}_CFLAGS}) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") -ENDFOREACH(flag) - -# Compiler flags -SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fPIC -fvisibility=hidden -D_WITH_SYSTEMD_") -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} ${PACKAGE_NAME_CFLAGS}") - -######################################################## -# For libprivilege-info libraries(.so) -######################################################## - -SET(TARGET_PRIV_INFO_LIB "privilege-info") -SET(SO_VERSION 1) -SET(VERSION "${SO_VERSION}.0.0") - -ADD_LIBRARY(${TARGET_PRIV_INFO_LIB} SHARED ${PRIV_INFO_SOURCES}) - -SET_TARGET_PROPERTIES(${TARGET_PRIV_INFO_LIB} PROPERTIES - SOVERSION ${SO_VERSION} - VERSION ${VERSION} -) - -TARGET_LINK_LIBRARIES(${TARGET_PRIV_INFO_LIB} ${${PACKAGE_NAME}_LDFLAGS}) - -####################################################### - -INSTALL(TARGETS ${PACKAGE_NAME} DESTINATION ${LIBDIR}) -INSTALL(FILES ${PROJECT_SOURCE_DIR}/include/privilege_information.h DESTINATION ${INCLUDEDIR}) - -SET(PC_LDFLAGS -l${PACKAGE_NAME}) -CONFIGURE_FILE(../${PACKAGE_NAME}.pc.in ${PACKAGE_NAME}.pc @ONLY) -INSTALL(FILES ${PACKAGE_NAME}.pc DESTINATION ${LIBDIR}/pkgconfig) +SET(TARGET_LIB "privilege-info") +ADD_LIBRARY(${TARGET_LIB} SHARED privilege_information.c) +TARGET_LINK_LIBRARIES(${TARGET_LIB} ${PRIVILEGE_INFO_DEPS_LIBRARIES}) + +SET_TARGET_PROPERTIES(${TARGET_LIB} + PROPERTIES + VERSION "1.0.0" + SOVERSION 1 + C_VISIBILITY_PRESET hidden) + +INSTALL(TARGETS ${TARGET_LIB} LIBRARY) + +INSTALL(FILES + ${CMAKE_SOURCE_DIR}/src/include/privilege_information.h + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + +CONFIGURE_FILE(../privilege-info.pc.in privilege-info.pc @ONLY) +INSTALL(FILES + ${CMAKE_CURRENT_BINARY_DIR}/privilege-info.pc + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 8da99db..a402a1b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,24 +1,5 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -SET(PACKAGE_NAME tc-privilege-info) -PROJECT(${PACKAGE_NAME}) +SET(TARGET_TESTS "privilege-info-tests") +ADD_EXECUTABLE(${TARGET_TESTS} tc_privilege_info.c ../src/privilege_information.c) +TARGET_LINK_LIBRARIES(${TARGET_TESTS} ${PRIVILEGE_INFO_DEPS_LIBRARIES}) -SET(TC1_NAME tc-privilege-info) - -SET(TC1_SRCS ${PROJECT_SOURCE_DIR}/tc_privilege_info.c) - -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/include) - -SET(requires glib-2.0 dlog) -INCLUDE(FindPkgConfig) -pkg_check_modules(${PACKAGE_NAME} REQUIRED ${requires}) -FOREACH(flag ${${PACKAGE_NAME}_CFLAGS}) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") -ENDFOREACH(flag) - -SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fPIC -Wall -fvisibility=hidden -D_WITH_SYSTEMD_") -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} ${PACKAGE_NAME_CFLAGS}") - -ADD_EXECUTABLE(${TC1_NAME} ${TC1_SRCS}) -TARGET_LINK_LIBRARIES(${TC1_NAME} "privilege-info") - -INSTALL(TARGETS ${TC1_NAME} DESTINATION /usr/bin) +INSTALL(TARGETS ${TARGET_TESTS} RUNTIME) -- 2.7.4 From 5c8d5b5d7f31e30efa3fe66bad0da011bd46de32 Mon Sep 17 00:00:00 2001 From: Dariusz Michaluk Date: Wed, 13 Jan 2021 14:07:34 +0100 Subject: [PATCH 07/16] Automate code coverage measurement To gather unit tests coverage report: - use COVERAGE build_type, - install privilege-info-coverage rpm, - run privilege-info-coverage.sh script. Change-Id: I21d6c63ffba6a61646d80facedfe5bdf3c27d797 --- CMakeLists.txt | 9 +++++++++ packaging/privilege-info.spec | 32 ++++++++++++++++++++++++++++++- test/CMakeLists.txt | 23 ++++++++++++++++++++++ test/privilege-info-coverage.sh.in | 39 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 test/privilege-info-coverage.sh.in diff --git a/CMakeLists.txt b/CMakeLists.txt index c8b66fa..0e024a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,8 +8,17 @@ IF(NOT CMAKE_BUILD_TYPE) SET(CMAKE_BUILD_TYPE "RELEASE") ENDIF(NOT CMAKE_BUILD_TYPE) +IF(NOT DEFINED COVERAGE_DIR) + SET(COVERAGE_DIR + "${SHARE_INSTALL_PREFIX}/${PROJECT_NAME}-coverage" + CACHE PATH + "Read-only coverage data directory") +ENDIF(NOT DEFINED COVERAGE_DIR) +ADD_DEFINITIONS("-DCOVERAGE_DIR=\"${COVERAGE_DIR}\"") + SET(CMAKE_C_FLAGS_DEBUG "-std=c11 -O0 -ggdb -Wp,-U_FORTIFY_SOURCE") SET(CMAKE_C_FLAGS_RELEASE "-std=c11 -O2 -DNDEBUG") +SET(CMAKE_C_FLAGS_COVERAGE "-std=c11 -O0 -ggdb --coverage -Wp,-U_FORTIFY_SOURCE") ADD_DEFINITIONS("-Werror") ADD_DEFINITIONS("-Wall") diff --git a/packaging/privilege-info.spec b/packaging/privilege-info.spec index 5a1cdea..29b8410 100644 --- a/packaging/privilege-info.spec +++ b/packaging/privilege-info.spec @@ -17,6 +17,9 @@ BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(capi-base-common) BuildRequires: pkgconfig(capi-system-info) BuildRequires: pkgconfig(security-privilege-manager) +%if "%{build_type}" == "COVERAGE" +BuildRequires: lcov +%endif %description Provides Privilege Information(Privilege Info) API @@ -37,11 +40,29 @@ Requires: %{name} = %{version}-%{release} %description -n privilege-info-tests Privilege Info API Internal Test +%if "%{build_type}" == "COVERAGE" + +%package -n privilege-info-coverage +Summary: Privilege Info code coverage data +Group: Security/Testing +Requires: privilege-info-tests = %{version}-%{release} +Requires: privilege-info-debugsource = %{version}-%{release} +Requires: lcov +Requires: gcc + +%description -n privilege-info-coverage +Privilege Info code coverage data + +%endif + %prep %setup -q %build -%cmake . -DCMAKE_BUILD_TYPE=%{build_type} + +%global coverage_dir %{_datadir}/privilege-info-coverage + +%cmake . -DCMAKE_BUILD_TYPE=%{build_type} -DCOVERAGE_DIR=%{coverage_dir} make %{?jobs:-j%jobs} @@ -69,3 +90,12 @@ rm -rf %{buildroot} %files -n privilege-info-tests %manifest packaging/privilege-info.manifest %{_bindir}/privilege-info-tests + +%if "%{build_type}" == "COVERAGE" + +%files -n privilege-info-coverage +%manifest packaging/privilege-info.manifest +%{_bindir}/privilege-info-coverage.sh +%coverage_dir + +%endif diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a402a1b..74ccad7 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -2,4 +2,27 @@ SET(TARGET_TESTS "privilege-info-tests") ADD_EXECUTABLE(${TARGET_TESTS} tc_privilege_info.c ../src/privilege_information.c) TARGET_LINK_LIBRARIES(${TARGET_TESTS} ${PRIVILEGE_INFO_DEPS_LIBRARIES}) +IF (CMAKE_BUILD_TYPE MATCHES "COVERAGE") + + # coverage data + SET(COVERAGE_BUILD_DIR + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${TARGET_TESTS}.dir/ + ) + + # install gcno files + INSTALL( + DIRECTORY ${COVERAGE_BUILD_DIR}/ + DESTINATION ${COVERAGE_DIR} + FILES_MATCHING PATTERN "*.gcno" + ) + + # install code coverage automation script + CONFIGURE_FILE(privilege-info-coverage.sh.in privilege-info-coverage.sh @ONLY) + INSTALL( + PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/privilege-info-coverage.sh + DESTINATION ${CMAKE_INSTALL_BINDIR} + ) + +ENDIF (CMAKE_BUILD_TYPE MATCHES "COVERAGE") + INSTALL(TARGETS ${TARGET_TESTS} RUNTIME) diff --git a/test/privilege-info-coverage.sh.in b/test/privilege-info-coverage.sh.in new file mode 100644 index 0000000..42caa34 --- /dev/null +++ b/test/privilege-info-coverage.sh.in @@ -0,0 +1,39 @@ +#!/bin/bash + +set -exuo pipefail + +REPORT="@PROJECT_NAME@-coverage.info" +STDERR="@PROJECT_NAME@-coverage.stderr" +HTML_DIR="@PROJECT_NAME@-coverage" + +SRCS_DIR="/usr/src/debug/@PROJECT_NAME@-@PROJECT_VERSION@" + +# create dir for the report +mkdir $HTML_DIR + +# remove old gcda files +find / -iname "*.gcda" -exec rm {} \; + +# launch unit tests +privilege-info-tests + +# copy source files +cp -rp $SRCS_DIR/* "@CMAKE_BINARY_DIR@" + +# copy gcda files +cp -r "@COVERAGE_BUILD_DIR@"/* "@COVERAGE_DIR@" + +# prepare report +rm -f $STDERR +lcov --no-external -c -d "@COVERAGE_DIR@" -b "@CMAKE_BINARY_DIR@" -o $REPORT 2>$STDERR +lcov -r $REPORT "@CMAKE_BINARY_DIR@/test/*" -o $REPORT + +# check warnings +if [ -s $STDERR ] +then + echo "Warnings detected (see $STDERR). Aborting." + exit 1 +fi + +# html +genhtml $REPORT --output-directory $HTML_DIR/ -- 2.7.4 From a5c4d9a989ab8e736e752fc36955de8f5361e591 Mon Sep 17 00:00:00 2001 From: Tomasz Swierczek Date: Wed, 3 Mar 2021 14:46:59 +0100 Subject: [PATCH 08/16] Fix coverage generation in rpm 4.14.1 Debug source package directories now have different names. Change-Id: I9d6381c56de855d895a6f9d2b1858768657e0e17 --- test/privilege-info-coverage.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/privilege-info-coverage.sh.in b/test/privilege-info-coverage.sh.in index 42caa34..26eaf5c 100644 --- a/test/privilege-info-coverage.sh.in +++ b/test/privilege-info-coverage.sh.in @@ -18,7 +18,7 @@ find / -iname "*.gcda" -exec rm {} \; privilege-info-tests # copy source files -cp -rp $SRCS_DIR/* "@CMAKE_BINARY_DIR@" +cp -rp $SRCS_DIR*/* "@CMAKE_BINARY_DIR@" # copy gcda files cp -r "@COVERAGE_BUILD_DIR@"/* "@COVERAGE_DIR@" -- 2.7.4 From 55a4529b8346ae342b20909322ff4b688ef25ea7 Mon Sep 17 00:00:00 2001 From: Tomasz Swierczek Date: Wed, 19 May 2021 11:03:43 +0200 Subject: [PATCH 09/16] Add license to test file Change-Id: Ifa4ee896b2ea4af0f569f9bac0181607c4bfecf4 --- test/tc_privilege_info.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/tc_privilege_info.c b/test/tc_privilege_info.c index c4f992b..1bf7081 100644 --- a/test/tc_privilege_info.c +++ b/test/tc_privilege_info.c @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2014-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 -- 2.7.4 From 81a6bd6fea389b2fae596b57f20e88069564bcfa Mon Sep 17 00:00:00 2001 From: Tomasz Swierczek Date: Wed, 19 May 2021 11:15:40 +0200 Subject: [PATCH 10/16] Categorize tests into positive and negative This commit also changes output of unit test binary so its easier to parse by automatic tools. Change-Id: Ia1375d06f0245f7ea9426328a860924d3c2e8682 --- test/tc_privilege_info.c | 388 ++++++++++++++++++++++++++--------------------- 1 file changed, 211 insertions(+), 177 deletions(-) diff --git a/test/tc_privilege_info.c b/test/tc_privilege_info.c index 1bf7081..1ce7d77 100644 --- a/test/tc_privilege_info.c +++ b/test/tc_privilege_info.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2020 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2014-2021 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. @@ -37,11 +37,6 @@ static void __change_color_to_green() printf("%c[%d;%dm", 0x1B, BRIGHTNESS, GREEN); } -static void __change_color_to_yellow() -{ - printf("%c[%d;%dm", 0x1B, BRIGHTNESS, YELLOW); -} - static void __change_color_to_origin() { printf("%c[%dm", 0x1B, 0); @@ -67,39 +62,37 @@ static const char* __get_result_string(privilege_info_error_e ret) static void __check_get_privilege_display_name_result(privilege_info_error_e expected_result, privilege_info_error_e result, const char* display_name) { - printf("expected : %s\n result : %s\n", __get_result_string(expected_result), __get_result_string(result)); + printf("--- expected : %s\n result : %s\n", __get_result_string(expected_result), __get_result_string(result)); if (expected_result != result) { - printf("not matched\n"); __change_color_to_red(); - printf("test fail\n"); + printf("TEST RESULT: FAILED\n"); fail_cnt++; } else { - printf("matched\n"); if (result == PRVINFO_ERROR_NONE) { if (display_name == NULL) { - printf("display_name must not be NULL\n"); + printf("--- display_name must not be NULL\n"); __change_color_to_red(); - printf("test fail\n"); + printf("TEST RESULT: FAILED\n"); fail_cnt++; __change_color_to_origin(); return; } else { - printf("display_name = %s\n", display_name); + printf("--- display_name = %s\n", display_name); } } else if (result == PRVINFO_ERROR_NO_MATCHING_PRIVILEGE) { if (display_name != NULL) { - printf("display_name = %s\n", display_name); - printf("display_name must be NULL\n"); + printf("--- display_name = %s\n", display_name); + printf("--- display_name must be NULL\n"); __change_color_to_red(); - printf("test fail\n"); + printf("TEST RESULT: FAILED\n"); fail_cnt++; __change_color_to_origin(); return; } } __change_color_to_green(); - printf("test success\n"); + printf("TEST RESULT: SUCCESS\n"); success_cnt++; } __change_color_to_origin(); @@ -108,32 +101,30 @@ static void __check_get_privilege_display_name_result(privilege_info_error_e exp static void __check_get_privilege_description_result(privilege_info_error_e expected_result, privilege_info_error_e result, const char* description) { - printf("expected : %s\n result : %s\n", __get_result_string(expected_result), __get_result_string(result)); + printf("--- expected : %s\n result : %s\n", __get_result_string(expected_result), __get_result_string(result)); if (expected_result != result) { - printf("not matched\n"); __change_color_to_red(); - printf("test fail\n"); + printf("TEST RESULT: FAILED\n"); fail_cnt++; } else { - printf("matched\n"); if (result == PRVINFO_ERROR_NONE) { if (description == NULL) { - printf("description must not be NULL\n"); + printf("--- description must not be NULL\n"); __change_color_to_red(); - printf("test fail\n"); + printf("TEST RESULT: FAILED\n"); fail_cnt++; __change_color_to_origin(); return; } else { - printf("description = %s\n", description); + printf("--- description = %s\n", description); } } else if (result == PRVINFO_ERROR_NO_MATCHING_PRIVILEGE) { if (description != NULL) { - printf("description = %s\n", description); - printf("description must be NULL\n"); + printf("--- description = %s\n", description); + printf("--- description must be NULL\n"); __change_color_to_red(); - printf("test fail\n"); + printf("TEST RESULT: FAILED\n"); fail_cnt++; __change_color_to_origin(); return; @@ -141,7 +132,7 @@ static void __check_get_privilege_description_result(privilege_info_error_e expe } __change_color_to_green(); - printf("test success\n"); + printf("TEST RESULT: SUCCESS\n"); success_cnt++; } __change_color_to_origin(); @@ -149,40 +140,39 @@ static void __check_get_privilege_description_result(privilege_info_error_e expe static void __check_get_privacy_display_name_result(privilege_info_error_e expected_result, privilege_info_error_e result, const char* privacy_display) { - printf("expected : %s\n result : %s\n", __get_result_string(expected_result), __get_result_string(result)); + printf("--- expected : %s\n result : %s\n", __get_result_string(expected_result), __get_result_string(result)); if (expected_result != result) { - printf("not matched\n"); __change_color_to_red(); - printf("test fail\n"); + printf("TEST RESULT: FAILED\n"); fail_cnt++; } else { - printf("matched\n"); if (privacy_display != NULL) - printf("privacy_display_name = %s\n", privacy_display); + printf("--- privacy_display_name = %s\n", privacy_display); else - printf("privacy_display_name is NULL.\n"); + printf("--- privacy_display_name is NULL.\n"); __change_color_to_green(); - printf("test success\n"); + printf("TEST RESULT: SUCCESS\n"); success_cnt++; } __change_color_to_origin(); } -static void __test_privilege_info_get_display_name() +static void __test_positive_privilege_info_get_display_name() { int ret; char* display_name = NULL; - printf("-----------------------------------------------------------\n"); - printf("api_version : 2.3\n"); - printf("privilege : http://tizen.org/privilege/window.priority.set\n"); + printf("TEST NAME: %s #1\n",__func__); + printf("--- api_version : 2.3\n"); + printf("--- privilege : http://tizen.org/privilege/window.priority.set\n"); ret = privilege_info_get_display_name("2.3", "http://tizen.org/privilege/window.priority.set", &display_name); __check_get_privilege_display_name_result(PRVINFO_ERROR_NONE, ret, display_name); printf("-----------------------------------------------------------\n"); - printf("api_version : 2.3\n"); - printf("privilege : http://tizen.org/privilege/mediacapture\n"); + printf("TEST NAME: %s #2\n",__func__); + printf("--- api_version : 2.3\n"); + printf("--- privilege : http://tizen.org/privilege/mediacapture\n"); if (display_name != NULL) { free(display_name); display_name = NULL; @@ -190,10 +180,18 @@ static void __test_privilege_info_get_display_name() ret = privilege_info_get_display_name("2.3", "http://tizen.org/privilege/mediacapture", &display_name); __check_get_privilege_display_name_result(PRVINFO_ERROR_NONE, ret, display_name); - printf("-----------------------------------------------------------\n"); - printf("Not existing privilege\n"); - printf("api_version : 2.3\n"); - printf("privilege : http://tizen.org/privilege/RRRRRRRRRR\n"); + free(display_name); +} + +static void __test_negative_privilege_info_get_display_name() +{ + int ret; + char * display_name = NULL; + + printf("TEST NAME: %s #1\n",__func__); + printf("--- Not existing privilege\n"); + printf("--- api_version : 2.3\n"); + printf("--- privilege : http://tizen.org/privilege/RRRRRRRRRR\n"); if (display_name != NULL) { free(display_name); display_name = NULL; @@ -201,10 +199,10 @@ static void __test_privilege_info_get_display_name() ret = privilege_info_get_display_name("2.3", "http://tizen.org/privilege/RRRRRRRRRR", &display_name); __check_get_privilege_display_name_result(PRVINFO_ERROR_NO_MATCHING_PRIVILEGE, ret, display_name); - printf("-----------------------------------------------------------\n"); - printf("Invalid parameter\n"); - printf("api_version : NULL\n"); - printf("privilege : http://tizen.org/privilege/window.priority.set\n"); + printf("TEST NAME: %s #2\n",__func__); + printf("--- Invalid parameter\n"); + printf("--- api_version : NULL\n"); + printf("--- privilege : http://tizen.org/privilege/window.priority.set\n"); if (display_name != NULL) { free(display_name); display_name = NULL; @@ -215,22 +213,22 @@ static void __test_privilege_info_get_display_name() free(display_name); } -static void __test_privilege_info_get_display_name_by_pkgtype() +static void __test_positive_privilege_info_get_display_name_by_pkgtype() { int ret; char* display_name = NULL; - printf("-----------------------------------------------------------\n"); - printf("pkgtype : PRVINFO_PACKAGE_TYPE_NATIVE\n"); - printf("api_version : 2.3\n"); - printf("privilege : http://tizen.org/privilege/window.priority.set\n"); + printf("TEST NAME: %s #1\n",__func__); + printf("--- pkgtype : PRVINFO_PACKAGE_TYPE_NATIVE\n"); + printf("--- api_version : 2.3\n"); + printf("--- privilege : http://tizen.org/privilege/window.priority.set\n"); ret = privilege_info_get_display_name_by_pkgtype("PRVINFO_PACKAGE_TYPE_NATIVE", "2.3", "http://tizen.org/privilege/window.priority.set", &display_name); __check_get_privilege_display_name_result(PRVINFO_ERROR_NONE, ret, display_name); - printf("-----------------------------------------------------------\n"); - printf("pkgtype : PRVINFO_PACKAGE_TYPE_WEB\n"); - printf("api_version : 2.3\n"); - printf("privilege : http://tizen.org/privilege/mediacapture\n"); + printf("TEST NAME: %s #2\n",__func__); + printf("--- pkgtype : PRVINFO_PACKAGE_TYPE_WEB\n"); + printf("--- api_version : 2.3\n"); + printf("--- privilege : http://tizen.org/privilege/mediacapture\n"); if (display_name != NULL) { free(display_name); display_name = NULL; @@ -238,11 +236,19 @@ static void __test_privilege_info_get_display_name_by_pkgtype() ret = privilege_info_get_display_name_by_pkgtype("PRVINFO_PACKAGE_TYPE_WEB", "2.3", "http://tizen.org/privilege/mediacapture", &display_name); __check_get_privilege_display_name_result(PRVINFO_ERROR_NONE, ret, display_name); - printf("-----------------------------------------------------------\n"); - printf("Mismatched package type: write WEB as NATIVE\n"); - printf("pkgtype : PRVINFO_PACKAGE_TYPE_NATIVE\n"); - printf("api_version : 2.3\n"); - printf("privilege : http://tizen.org/privilege/mediacapture\n"); + free(display_name); +} + +static void __test_negative_privilege_info_get_display_name_by_pkgtype() +{ + int ret; + char* display_name = NULL; + + printf("TEST NAME: %s #1\n",__func__); + printf("--- Mismatched package type: write WEB as NATIVE\n"); + printf("--- pkgtype : PRVINFO_PACKAGE_TYPE_NATIVE\n"); + printf("--- api_version : 2.3\n"); + printf("--- privilege : http://tizen.org/privilege/mediacapture\n"); if (display_name != NULL) { free(display_name); display_name = NULL; @@ -250,11 +256,10 @@ static void __test_privilege_info_get_display_name_by_pkgtype() ret = privilege_info_get_display_name_by_pkgtype("PRVINFO_PACKAGE_TYPE_NATIVE", "2.3", "http://tizen.org/privilege/mediacapture", &display_name); __check_get_privilege_display_name_result(PRVINFO_ERROR_NO_MATCHING_PRIVILEGE, ret, display_name); - - printf("-----------------------------------------------------------\n"); - printf("Not existing privilege\n"); - printf("api_version : 2.3\n"); - printf("privilege : http://tizen.org/privilege/RRRRRRRRRR\n"); + printf("TEST NAME: %s #2\n",__func__); + printf("--- Not existing privilege\n"); + printf("--- api_version : 2.3\n"); + printf("--- privilege : http://tizen.org/privilege/RRRRRRRRRR\n"); if (display_name != NULL) { free(display_name); display_name = NULL; @@ -262,10 +267,10 @@ static void __test_privilege_info_get_display_name_by_pkgtype() ret = privilege_info_get_display_name_by_pkgtype("PRVINFO_PACKAGE_TYPE_WEB", "2.3", "http://tizen.org/privilege/RRRRRRRRRR", &display_name); __check_get_privilege_display_name_result(PRVINFO_ERROR_NO_MATCHING_PRIVILEGE, ret, display_name); - printf("-----------------------------------------------------------\n"); - printf("Invalid parameter\n"); - printf("api_version : 2.3\n"); - printf("privilege : http://tizen.org/privilege/mediacapture\n"); + printf("TEST NAME: %s #3\n",__func__); + printf("--- Invalid parameter\n"); + printf("--- api_version : 2.3\n"); + printf("--- privilege : http://tizen.org/privilege/mediacapture\n"); if (display_name != NULL) { free(display_name); display_name = NULL; @@ -276,20 +281,21 @@ static void __test_privilege_info_get_display_name_by_pkgtype() free(display_name); } -static void __test_privilege_info_get_description() + +static void __test_positive_privilege_info_get_description() { int ret; char* description = NULL; - printf("-----------------------------------------------------------\n"); - printf("api_version : 2.3\n"); - printf("privilege : http://tizen.org/privilege/window.priority.set\n"); + printf("TEST NAME: %s #1\n",__func__); + printf("--- api_version : 2.3\n"); + printf("--- privilege : http://tizen.org/privilege/window.priority.set\n"); ret = privilege_info_get_description("2.3", "http://tizen.org/privilege/window.priority.set", &description); __check_get_privilege_description_result(PRVINFO_ERROR_NONE, ret, description); - printf("-----------------------------------------------------------\n"); - printf("api_version : 2.3\n"); - printf("privilege : http://tizen.org/privilege/mediacapture\n"); + printf("TEST NAME: %s #2\n",__func__); + printf("--- api_version : 2.3\n"); + printf("--- privilege : http://tizen.org/privilege/mediacapture\n"); if (description != NULL) { free(description); description = NULL; @@ -297,10 +303,18 @@ static void __test_privilege_info_get_description() ret = privilege_info_get_description("2.3", "http://tizen.org/privilege/mediacapture", &description); __check_get_privilege_description_result(PRVINFO_ERROR_NONE, ret, description); - printf("-----------------------------------------------------------\n"); - printf("Not existing privilege\n"); - printf("api_version : 2.3\n"); - printf("privilege : http://tizen.org/privilege/RRRRRRRRRR\n"); + free(description); +} + +static void __test_negative_privilege_info_get_description() +{ + int ret; + char* description = NULL; + + printf("TEST NAME: %s #1\n",__func__); + printf("--- Not existing privilege\n"); + printf("--- api_version : 2.3\n"); + printf("--- privilege : http://tizen.org/privilege/RRRRRRRRRR\n"); if (description != NULL) { free(description); description = NULL; @@ -308,10 +322,10 @@ static void __test_privilege_info_get_description() ret = privilege_info_get_description("2.3", "http://tizen.org/privilege/RRRRRRRRRR", &description); __check_get_privilege_description_result(PRVINFO_ERROR_NO_MATCHING_PRIVILEGE, ret, description); - printf("-----------------------------------------------------------\n"); - printf("Invalid parameter\n"); - printf("api_version : 2.3\n"); - printf("privilege : http://tizen.org/privilege/mediacapture\n"); + printf("TEST NAME: %s #2\n",__func__); + printf("--- Invalid parameter\n"); + printf("--- api_version : 2.3\n"); + printf("--- privilege : http://tizen.org/privilege/mediacapture\n"); if (description != NULL) { free(description); description = NULL; @@ -322,20 +336,20 @@ static void __test_privilege_info_get_description() free(description); } -static void __test_privilege_info_get_description_by_pkgtype() +static void __test_positive_privilege_info_get_description_by_pkgtype() { int ret; char* description = NULL; - printf("-----------------------------------------------------------\n"); - printf("api_version : 2.3\n"); - printf("privilege : http://tizen.org/privilege/window.priority.set\n"); + printf("TEST NAME: %s #1\n",__func__); + printf("--- api_version : 2.3\n"); + printf("--- privilege : http://tizen.org/privilege/window.priority.set\n"); ret = privilege_info_get_description_by_pkgtype("PRVINFO_PACKAGE_TYPE_NATIVE", "2.3", "http://tizen.org/privilege/window.priority.set", &description); __check_get_privilege_description_result(PRVINFO_ERROR_NONE, ret, description); - printf("-----------------------------------------------------------\n"); - printf("api_version : 2.3\n"); - printf("privilege : http://tizen.org/privilege/mediacapture\n"); + printf("TEST NAME: %s #2\n",__func__); + printf("--- api_version : 2.3\n"); + printf("--- privilege : http://tizen.org/privilege/mediacapture\n"); if (description != NULL) { free(description); description = NULL; @@ -343,11 +357,19 @@ static void __test_privilege_info_get_description_by_pkgtype() ret = privilege_info_get_description_by_pkgtype("PRVINFO_PACKAGE_TYPE_WEB", "2.3", "http://tizen.org/privilege/mediacapture", &description); __check_get_privilege_description_result(PRVINFO_ERROR_NONE, ret, description); - printf("-----------------------------------------------------------\n"); - printf("Mismatched package type: write WEB as NATIVE\n"); - printf("pkgtype : PRVINFO_PACKAGE_TYPE_NATIVE\n"); - printf("api_version : 2.3\n"); - printf("privilege : http://tizen.org/privilege/mediacapture\n"); + free(description); +} + +static void __test_negative_privilege_info_get_description_by_pkgtype() +{ + int ret; + char* description = NULL; + + printf("TEST NAME: %s #1\n",__func__); + printf("--- Mismatched package type: write WEB as NATIVE\n"); + printf("--- pkgtype : PRVINFO_PACKAGE_TYPE_NATIVE\n"); + printf("--- api_version : 2.3\n"); + printf("--- privilege : http://tizen.org/privilege/mediacapture\n"); if (description != NULL) { free(description); description = NULL; @@ -355,10 +377,10 @@ static void __test_privilege_info_get_description_by_pkgtype() ret = privilege_info_get_description_by_pkgtype("PRVINFO_PACKAGE_TYPE_NATIVE", "2.3", "http://tizen.org/privilege/mediacapture", &description); __check_get_privilege_description_result(PRVINFO_ERROR_NO_MATCHING_PRIVILEGE, ret, description); - printf("-----------------------------------------------------------\n"); - printf("Not existing privilege\n"); - printf("api_version : 2.3\n"); - printf("privilege : http://tizen.org/privilege/RRRRRRRRRR\n"); + printf("TEST NAME: %s #2\n",__func__); + printf("--- Not existing privilege\n"); + printf("--- api_version : 2.3\n"); + printf("--- privilege : http://tizen.org/privilege/RRRRRRRRRR\n"); if (description != NULL) { free(description); description = NULL; @@ -366,10 +388,10 @@ static void __test_privilege_info_get_description_by_pkgtype() ret = privilege_info_get_description_by_pkgtype("PRVINFO_PACKAGE_TYPE_NATIVE", "2.3", "http://tizen.org/privilege/RRRRRRRRRR", &description); __check_get_privilege_description_result(PRVINFO_ERROR_NO_MATCHING_PRIVILEGE, ret, description); - printf("-----------------------------------------------------------\n"); - printf("Invalid parameter\n"); - printf("api_version : 2.3\n"); - printf("privilege : NULL\n"); + printf("TEST NAME: %s #3\n",__func__); + printf("--- Invalid parameter\n"); + printf("--- api_version : 2.3\n"); + printf("--- privilege : NULL\n"); if (description != NULL) { free(description); description = NULL; @@ -380,14 +402,28 @@ static void __test_privilege_info_get_description_by_pkgtype() free(description); } -static void __test_privilege_info_get_privacy_display_name() +static void __test_positive_privilege_info_get_privacy_display_name() { int ret; char* privacy_display_name = NULL; - printf("-----------------------------------------------------------\n"); - printf("Invalid parameter\n"); - printf("no input privilege\n"); + printf("TEST NAME: %s #1\n",__func__); + printf("--- Privacy related privilege\n"); + printf("--- privilege: http://tizen.org/privilege/account.read\n"); + ret = privilege_info_get_privacy_display_name("http://tizen.org/privilege/account.read", &privacy_display_name); + __check_get_privacy_display_name_result(PRVINFO_ERROR_NONE, ret, privacy_display_name); + + free(privacy_display_name); +} + +static void __test_negative_privilege_info_get_privacy_display_name() +{ + int ret; + char* privacy_display_name = NULL; + + printf("TEST NAME: %s #1\n",__func__); + printf("--- Invalid parameter\n"); + printf("--- no input privilege\n"); ret = privilege_info_get_privacy_display_name(NULL, &privacy_display_name); __check_get_privacy_display_name_result(PRVINFO_ERROR_INVALID_PARAMETER, ret, privacy_display_name); @@ -396,9 +432,9 @@ static void __test_privilege_info_get_privacy_display_name() privacy_display_name = NULL; } - printf("-----------------------------------------------------------\n"); - printf("Not a privacy related privilege\n"); - printf("privilege: http://tizen.org/privilege/internet\n"); + printf("TEST NAME: %s #2\n",__func__); + printf("--- Not a privacy related privilege\n"); + printf("--- privilege: http://tizen.org/privilege/internet\n"); ret = privilege_info_get_privacy_display_name("http://tizen.org/privilege/internet", &privacy_display_name); __check_get_privacy_display_name_result(PRVINFO_ERROR_INVALID_PARAMETER, ret, privacy_display_name); @@ -407,9 +443,9 @@ static void __test_privilege_info_get_privacy_display_name() privacy_display_name = NULL; } - printf("-----------------------------------------------------------\n"); - printf("Not existing privilege\n"); - printf("privilege: http://tizen.org/privilege/wrong.privilege.name\n"); + printf("TEST NAME: %s #3\n",__func__); + printf("--- Not existing privilege\n"); + printf("--- privilege: http://tizen.org/privilege/wrong.privilege.name\n"); ret = privilege_info_get_privacy_display_name("http://tizen.org/privilege/wrong.privilege.name", &privacy_display_name); __check_get_privacy_display_name_result(PRVINFO_ERROR_INVALID_PARAMETER, ret, privacy_display_name); @@ -418,38 +454,34 @@ static void __test_privilege_info_get_privacy_display_name() privacy_display_name = NULL; } - printf("-----------------------------------------------------------\n"); - printf("Privacy related privilege\n"); - printf("privilege: http://tizen.org/privilege/account.read\n"); - ret = privilege_info_get_privacy_display_name("http://tizen.org/privilege/account.read", &privacy_display_name); - __check_get_privacy_display_name_result(PRVINFO_ERROR_NONE, ret, privacy_display_name); - free(privacy_display_name); } static void __check_privilege_info_get_privilege_info(privilege_info_error_e expected_result, privilege_info_error_e result, GList* privilege_info_list, int return_result) { - printf("expected : %s\n result : %s\n", __get_result_string(expected_result), __get_result_string(result)); + printf("--- expected : %s\n result : %s\n", __get_result_string(expected_result), __get_result_string(result)); if (expected_result != result) { - __change_color_to_yellow(); - printf("not matched\n"); + __change_color_to_red(); + printf("TEST RESULT: FAILED\n"); + fail_cnt++; __change_color_to_origin(); } else { __change_color_to_green(); - printf("matched\n"); + printf("TEST RESULT: SUCCESS\n"); + success_cnt++; __change_color_to_origin(); } - printf("return_result = %d\n", return_result); + printf("--- return_result = %d\n", return_result); GList* l; if (result == PRVINFO_ERROR_NONE) { for (l = privilege_info_list; l != NULL; l = l->next) { privilege_info_s* privilege_info = (privilege_info_s*)l->data; - printf("privilege_info->privilege_name = %s\n", privilege_info->privilege_name); - printf("privilege_info->display_name = %s\n", privilege_info->display_name); - printf("privilege_info->description = %s\n", privilege_info->description); + printf("--- privilege_info->privilege_name = %s\n", privilege_info->privilege_name); + printf("--- privilege_info->display_name = %s\n", privilege_info->display_name); + printf("--- privilege_info->description = %s\n", privilege_info->description); printf("\n"); } } @@ -457,18 +489,18 @@ static void __check_privilege_info_get_privilege_info(privilege_info_error_e exp printf("\n"); } -static void __test_privilege_info_get_privilege_info_list() +static void __test_positive_privilege_info_get_privilege_info_list() { GList* privilege_name_list = NULL; GList* privilege_info_list = NULL; privilege_consumer_return_code_e return_result; int ret; - printf("case : SUCCESS\n"); - printf("locale : ko_KR.UTF8\n"); - printf("privilege name : http://tizen.org/privilege/call\n"); - printf("privilege name : http://tizen.org/privilege/content.read\n"); - printf("privilege name : http://tizen.org/privilege/filesystem.read\n"); + printf("TEST NAME: %s #1\n",__func__); + printf("--- locale : ko_KR.UTF8\n"); + printf("--- privilege name : http://tizen.org/privilege/call\n"); + printf("--- privilege name : http://tizen.org/privilege/content.read\n"); + printf("--- privilege name : http://tizen.org/privilege/filesystem.read\n"); privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/call"); privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/content.read"); privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/filesystem.read"); @@ -481,11 +513,11 @@ static void __test_privilege_info_get_privilege_info_list() privilege_info_list = NULL; printf("-----------------------------------------------------------\n"); - printf("case : SUCCESS2\n"); - printf("locale : ko_KR.UTF8\n"); - printf("privilege name : http://tizen.org/privilege/call\n"); - printf("privilege name : http://tizen.org/privilege/systemsettings.admin\n"); - printf("privilege name : http://tizen.org/privilege/bookmark.admin\n"); + printf("TEST NAME: %s #2\n",__func__); + printf("--- locale : ko_KR.UTF8\n"); + printf("--- privilege name : http://tizen.org/privilege/call\n"); + printf("--- privilege name : http://tizen.org/privilege/systemsettings.admin\n"); + printf("--- privilege name : http://tizen.org/privilege/bookmark.admin\n"); privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/call"); privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/systemsettings.admin"); privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/bookmark.admin"); @@ -498,11 +530,11 @@ static void __test_privilege_info_get_privilege_info_list() privilege_info_list = NULL; printf("-----------------------------------------------------------\n"); - printf("case : SUCCESS3\n"); - printf("locale : ko_KR.UTF8\n"); - printf("privilege name : http://tizen.org/privilege/call\n"); - printf("privilege name : http://tizen.org/privilege/alarm.xxxx\n"); - printf("privilege name : http://tizen.org/privilege/account.xxx\n"); + printf("TEST NAME: %s #3\n",__func__); + printf("--- locale : ko_KR.UTF8\n"); + printf("--- privilege name : http://tizen.org/privilege/call\n"); + printf("--- privilege name : http://tizen.org/privilege/alarm.xxxx\n"); + printf("--- privilege name : http://tizen.org/privilege/account.xxx\n"); privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/call"); privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/alarm.xxxx"); privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/account.xxx"); @@ -514,12 +546,21 @@ static void __test_privilege_info_get_privilege_info_list() privilege_info_free_privilege_info_list(privilege_info_list); privilege_info_list = NULL; printf("-----------------------------------------------------------\n"); +} - printf("case : UNKNOWN_LOCAL_CODE\n"); - printf("locale : xx_XX.UTF8\n"); - printf("privilege name : http://tizen.org/privilege/call\n"); - printf("privilege name : http://tizen.org/privilege/content.read\n"); - printf("privilege name : http://tizen.org/privilege/filesystem.read\n"); +static void __test_negative_privilege_info_get_privilege_info_list() +{ + GList* privilege_name_list = NULL; + GList* privilege_info_list = NULL; + privilege_consumer_return_code_e return_result; + int ret; + + printf("TEST NAME: %s #1\n",__func__); + printf("--- UNKNOWN_LOCAL_CODE\n"); + printf("--- locale : xx_XX.UTF8\n"); + printf("--- privilege name : http://tizen.org/privilege/call\n"); + printf("--- privilege name : http://tizen.org/privilege/content.read\n"); + printf("--- privilege name : http://tizen.org/privilege/filesystem.read\n"); privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/call"); privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/content.read"); privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/filesystem.read"); @@ -530,13 +571,13 @@ static void __test_privilege_info_get_privilege_info_list() privilege_name_list = NULL; privilege_info_free_privilege_info_list(privilege_info_list); privilege_info_list = NULL; - printf("-----------------------------------------------------------\n"); - printf("case : INVAILD_PARAMETER\n"); - printf("locale : ko_KR.UTF8\n"); - printf("privilege name : http://tizen.org/privilege/xxxx\n"); - printf("privilege name : http://tizen.org/privilege/alarm.xxxx\n"); - printf("privilege name : http://tizen.org/privilege/account.xxx\n"); + printf("TEST NAME: %s #2\n",__func__); + printf("--- INVAILD_PARAMETER\n"); + printf("--- locale : ko_KR.UTF8\n"); + printf("--- privilege name : http://tizen.org/privilege/xxxx\n"); + printf("--- privilege name : http://tizen.org/privilege/alarm.xxxx\n"); + printf("--- privilege name : http://tizen.org/privilege/account.xxx\n"); privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/xxxx"); privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/alarm.xxxx"); privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/account.xxx"); @@ -548,40 +589,33 @@ static void __test_privilege_info_get_privilege_info_list() privilege_info_free_privilege_info_list(privilege_info_list); privilege_info_list = NULL; printf("-----------------------------------------------------------\n"); - } int main() { - __change_color_to_yellow(); - printf("Test function : privilege_info_get_display_name\n"); __change_color_to_origin(); - __test_privilege_info_get_display_name(); + __test_positive_privilege_info_get_display_name(); + __test_negative_privilege_info_get_display_name(); - __change_color_to_yellow(); - printf("Test function : privilege_info_get_display_name_by_pkgtype\n"); __change_color_to_origin(); - __test_privilege_info_get_display_name_by_pkgtype(); + __test_positive_privilege_info_get_display_name_by_pkgtype(); + __test_negative_privilege_info_get_display_name_by_pkgtype(); - __change_color_to_yellow(); - printf("Test function : privilege_info_get_description\n"); __change_color_to_origin(); - __test_privilege_info_get_description(); + __test_positive_privilege_info_get_description(); + __test_negative_privilege_info_get_description(); - __change_color_to_yellow(); - printf("Test function : privilege_info_get_description_by_pkgtype\n"); __change_color_to_origin(); - __test_privilege_info_get_description_by_pkgtype(); + __test_positive_privilege_info_get_description_by_pkgtype(); + __test_negative_privilege_info_get_description_by_pkgtype(); - __change_color_to_yellow(); - printf("Test function : privilege_info_get_privacy_display_name\n"); __change_color_to_origin(); - __test_privilege_info_get_privacy_display_name(); + __test_positive_privilege_info_get_privacy_display_name(); + __test_negative_privilege_info_get_privacy_display_name(); - __change_color_to_yellow(); - printf("Test function : privilege_info_get_privilege_info_list\n"); __change_color_to_origin(); - __test_privilege_info_get_privilege_info_list(); + __test_positive_privilege_info_get_privilege_info_list(); + __test_negative_privilege_info_get_privilege_info_list(); __change_color_to_green(); printf("Test Complete\n"); -- 2.7.4 From 89500046a7424ffe0c52c3a511199437f86ab437 Mon Sep 17 00:00:00 2001 From: Yunjin Lee Date: Thu, 19 Jan 2023 12:06:27 +0900 Subject: [PATCH 11/16] Deprecate privacy related API and enum Change-Id: I14c986028c23b2f68959cc08fd0106348c089589 Signed-off-by: Yunjin Lee --- src/include/privilege_information.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/include/privilege_information.h b/src/include/privilege_information.h index 9006dbc..429100f 100644 --- a/src/include/privilege_information.h +++ b/src/include/privilege_information.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2020 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2014-2023 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. @@ -46,7 +46,7 @@ typedef enum { PRVINFO_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid function parameter */ PRVINFO_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */ PRVINFO_ERROR_INTERNAL_ERROR = TIZEN_ERROR_UNKNOWN, /**< Unknown error */ - PRVINFO_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported (Since 5.0) */ + PRVINFO_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< @deprecated Not supported (Deprecated since 7.5) */ PRVINFO_ERROR_NO_MATCHING_PRIVILEGE = TIZEN_ERROR_PRIVILEGE_INFORMATION | 0x01 /**< No matched privilege (Since 6.0) */ } privilege_info_error_e; @@ -132,6 +132,7 @@ int privilege_info_get_description_by_pkgtype(const char *package_type, const ch /** + * @deprecated Deprecated since 7.5. * @brief Gets the display name of the privacy group in which the given privilege is included. * @since_tizen 3.0 * @remarks @a privacy_name must be released using free(). @@ -146,7 +147,7 @@ int privilege_info_get_description_by_pkgtype(const char *package_type, const ch * @retval #PRVINFO_ERROR_INTERNAL_ERROR Unknown error * @retval #PRVINFO_ERROR_NOT_SUPPORTED Not supported */ -int privilege_info_get_privacy_display_name(const char *privilege, char **privacy_name); +int privilege_info_get_privacy_display_name(const char *privilege, char **privacy_name) TIZEN_DEPRECATED_API; /** -- 2.7.4 From 0a92a0b530e84948e07f1ec493d3c75192256d4f Mon Sep 17 00:00:00 2001 From: Yunjin Lee Date: Wed, 1 Feb 2023 17:41:00 +0900 Subject: [PATCH 12/16] Release version 0.0.8 - Deprecate privacy related API and enum - Categorize tests into positive and negative - Add license to test file - Fix coverage generation in rpm 4.14.1 - Automate code coverage measurement - Cleanup cmake/spec infrastructure - Fix source files access rights - remove hyperlink from feature name of doc Change-Id: I9dcc2f6f964f443e487a6739aa8890bfb9ef6724 Signed-off-by: Yunjin Lee --- packaging/privilege-info.changes | 10 ++++++++++ packaging/privilege-info.spec | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/packaging/privilege-info.changes b/packaging/privilege-info.changes index 2b479eb..867f41e 100644 --- a/packaging/privilege-info.changes +++ b/packaging/privilege-info.changes @@ -1,3 +1,13 @@ +Release version 0.0.8 +- Deprecate privacy related API and enum +- Categorize tests into positive and negative +- Add license to test file +- Fix coverage generation in rpm 4.14.1 +- Automate code coverage measurement +- Cleanup cmake/spec infrastructure +- Fix source files access rights +- remove hyperlink from feature name of doc + Release version 0.0.7 - Check after getting return diff --git a/packaging/privilege-info.spec b/packaging/privilege-info.spec index 29b8410..5764e4e 100644 --- a/packaging/privilege-info.spec +++ b/packaging/privilege-info.spec @@ -2,7 +2,7 @@ Name: privilege-info Summary: Privilege Information -Version: 0.0.7 +Version: 0.0.8 Release: 1 Group: Security/API License: Apache-2.0 -- 2.7.4 From 918277972df43a5c78cc334bb3474bf36f4ca102 Mon Sep 17 00:00:00 2001 From: Dariusz Michaluk Date: Wed, 8 Feb 2023 10:49:36 +0100 Subject: [PATCH 13/16] Change release version in cmake Change-Id: I64cbe3ae6d964244a223bd4a9d0700b3869c51ca --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0e024a8..7336285 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.0) -PROJECT(privilege-info VERSION 0.0.7 LANGUAGES C) +PROJECT(privilege-info VERSION 0.0.8 LANGUAGES C) INCLUDE(GNUInstallDirs) INCLUDE(FindPkgConfig) -- 2.7.4 From 365aac61d27d4953026632ed97bd000f180f75b9 Mon Sep 17 00:00:00 2001 From: Dariusz Michaluk Date: Thu, 11 May 2023 11:54:26 +0200 Subject: [PATCH 14/16] Fix privacy privilege tests Privacy privilege feature is not supported anymore. https://review.tizen.org/gerrit/#/c/tools/building-blocks/+/290856/ Change-Id: I0822aa2cc9f86d3fea7d41833bc7b033a72604eb --- test/tc_privilege_info.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/tc_privilege_info.c b/test/tc_privilege_info.c index 1ce7d77..821ce4b 100644 --- a/test/tc_privilege_info.c +++ b/test/tc_privilege_info.c @@ -411,7 +411,7 @@ static void __test_positive_privilege_info_get_privacy_display_name() printf("--- Privacy related privilege\n"); printf("--- privilege: http://tizen.org/privilege/account.read\n"); ret = privilege_info_get_privacy_display_name("http://tizen.org/privilege/account.read", &privacy_display_name); - __check_get_privacy_display_name_result(PRVINFO_ERROR_NONE, ret, privacy_display_name); + __check_get_privacy_display_name_result(PRVINFO_ERROR_NOT_SUPPORTED, ret, privacy_display_name); free(privacy_display_name); } @@ -425,7 +425,7 @@ static void __test_negative_privilege_info_get_privacy_display_name() printf("--- Invalid parameter\n"); printf("--- no input privilege\n"); ret = privilege_info_get_privacy_display_name(NULL, &privacy_display_name); - __check_get_privacy_display_name_result(PRVINFO_ERROR_INVALID_PARAMETER, ret, privacy_display_name); + __check_get_privacy_display_name_result(PRVINFO_ERROR_NOT_SUPPORTED, ret, privacy_display_name); if (privacy_display_name != NULL) { free(privacy_display_name); @@ -436,7 +436,7 @@ static void __test_negative_privilege_info_get_privacy_display_name() printf("--- Not a privacy related privilege\n"); printf("--- privilege: http://tizen.org/privilege/internet\n"); ret = privilege_info_get_privacy_display_name("http://tizen.org/privilege/internet", &privacy_display_name); - __check_get_privacy_display_name_result(PRVINFO_ERROR_INVALID_PARAMETER, ret, privacy_display_name); + __check_get_privacy_display_name_result(PRVINFO_ERROR_NOT_SUPPORTED, ret, privacy_display_name); if (privacy_display_name != NULL) { free(privacy_display_name); @@ -447,7 +447,7 @@ static void __test_negative_privilege_info_get_privacy_display_name() printf("--- Not existing privilege\n"); printf("--- privilege: http://tizen.org/privilege/wrong.privilege.name\n"); ret = privilege_info_get_privacy_display_name("http://tizen.org/privilege/wrong.privilege.name", &privacy_display_name); - __check_get_privacy_display_name_result(PRVINFO_ERROR_INVALID_PARAMETER, ret, privacy_display_name); + __check_get_privacy_display_name_result(PRVINFO_ERROR_NOT_SUPPORTED, ret, privacy_display_name); if (privacy_display_name != NULL) { free(privacy_display_name); -- 2.7.4 From 5027b3e59b2aaf5c863a2262181e35da205917a9 Mon Sep 17 00:00:00 2001 From: Yunjin Lee Date: Wed, 17 May 2023 15:29:25 +0900 Subject: [PATCH 15/16] Fix platform version 7.5 to 8.0 - Tizen platform version policy is changed. There would be no x.5 version anymore. Change-Id: I60f081e551c3edbce49e578c9f87bd4251aa5089 Signed-off-by: Yunjin Lee --- src/include/privilege_information.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/include/privilege_information.h b/src/include/privilege_information.h index 429100f..8b5aa61 100644 --- a/src/include/privilege_information.h +++ b/src/include/privilege_information.h @@ -46,7 +46,7 @@ typedef enum { PRVINFO_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid function parameter */ PRVINFO_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */ PRVINFO_ERROR_INTERNAL_ERROR = TIZEN_ERROR_UNKNOWN, /**< Unknown error */ - PRVINFO_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< @deprecated Not supported (Deprecated since 7.5) */ + PRVINFO_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< @deprecated Not supported (Deprecated since 8.0) */ PRVINFO_ERROR_NO_MATCHING_PRIVILEGE = TIZEN_ERROR_PRIVILEGE_INFORMATION | 0x01 /**< No matched privilege (Since 6.0) */ } privilege_info_error_e; @@ -132,7 +132,7 @@ int privilege_info_get_description_by_pkgtype(const char *package_type, const ch /** - * @deprecated Deprecated since 7.5. + * @deprecated Deprecated since 8.0. * @brief Gets the display name of the privacy group in which the given privilege is included. * @since_tizen 3.0 * @remarks @a privacy_name must be released using free(). -- 2.7.4 From 177bb456c853d470834e741b772fc1251820caf2 Mon Sep 17 00:00:00 2001 From: Yunjin Lee Date: Wed, 31 May 2023 16:43:07 +0900 Subject: [PATCH 16/16] Release version 0.0.9 - Fix platform version 7.5 to 8.0 - Fix privacy privilege tests - Change release version in cmake Change-Id: I7b6a556b8d8aa9500110019ef49238d7f45e8dde Signed-off-by: Yunjin Lee --- CMakeLists.txt | 2 +- packaging/privilege-info.changes | 5 +++++ packaging/privilege-info.spec | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7336285..781a207 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.0) -PROJECT(privilege-info VERSION 0.0.8 LANGUAGES C) +PROJECT(privilege-info VERSION 0.0.9 LANGUAGES C) INCLUDE(GNUInstallDirs) INCLUDE(FindPkgConfig) diff --git a/packaging/privilege-info.changes b/packaging/privilege-info.changes index 867f41e..8d05b8d 100644 --- a/packaging/privilege-info.changes +++ b/packaging/privilege-info.changes @@ -1,3 +1,8 @@ +Release version 0.0.9 +- Fix platform version 7.5 to 8.0 +- Fix privacy privilege tests +- Change release version in cmake + Release version 0.0.8 - Deprecate privacy related API and enum - Categorize tests into positive and negative diff --git a/packaging/privilege-info.spec b/packaging/privilege-info.spec index 5764e4e..f8824e5 100644 --- a/packaging/privilege-info.spec +++ b/packaging/privilege-info.spec @@ -2,7 +2,7 @@ Name: privilege-info Summary: Privilege Information -Version: 0.0.8 +Version: 0.0.9 Release: 1 Group: Security/API License: Apache-2.0 -- 2.7.4