From 7dd86f1fbd1291721e61573c2a50cac1dcdd2d65 Mon Sep 17 00:00:00 2001 From: Jean-Benoit MARTIN Date: Thu, 12 Dec 2013 15:54:15 +0100 Subject: [PATCH] Remove hardcoded path for multiuser support Bug-Tizen: PTREL-372 Change-Id: I64cc7d795014f8ab25d13f7bdae0a2acb314e1e2 Signed-off-by: Jean-Benoit MARTIN --- etc/wrt_commons_create_clean_db.sh | 10 +++-- etc/wrt_commons_reset_db.sh | 16 ++++---- modules/certificate_dao/CMakeLists.txt | 1 + .../certificate_dao/dao/certificate_dao.cpp | 5 ++- modules/custom_handler_dao/CMakeLists.txt | 1 + .../dao/CustomHandlerDatabase.cpp | 3 +- modules/i18n/dao/CMakeLists.txt | 5 +++ modules/i18n/dao/src/i18n_database.cpp | 3 +- modules/security_origin_dao/CMakeLists.txt | 1 + .../dao/security_origin_dao.cpp | 5 ++- modules/widget_dao/CMakeLists.txt | 1 + .../include/dpl/wrt-dao-ro/global_config.h | 41 ++++++++++--------- modules/widget_interface_dao/CMakeLists.txt | 1 + .../dao/widget_interface_dao.cpp | 5 ++- packaging/wrt-commons.spec | 29 ++++++------- tests/dao/wrt_dao_tests_prepare_db.sh | 4 +- .../wrt_db_localization_prepare.sh | 10 +++-- tests/utils/CMakeLists.txt | 5 +++ tests/utils/path_tests.cpp | 5 ++- tests/utils/wrt_utility.cpp | 3 +- 20 files changed, 93 insertions(+), 61 deletions(-) diff --git a/etc/wrt_commons_create_clean_db.sh b/etc/wrt_commons_create_clean_db.sh index 206359a..6f54b57 100755 --- a/etc/wrt_commons_create_clean_db.sh +++ b/etc/wrt_commons_create_clean_db.sh @@ -14,8 +14,10 @@ # limitations under the License. # -DB_PATH=/opt/dbspace/ -DB_USER_PATH=/opt/usr/dbspace/ +source /etc/tizen-platform.conf + +DB_PATH=$TZ_SYS_DB/ +DB_USER_PATH=$TZ_USER_DB/ function create_db { name=$1 @@ -30,8 +32,8 @@ function create_db { SQL=".read /usr/share/wrt-engine/"$name"_db.sql" sqlite3 $dbpath.$name.db "$SQL" touch $dbpath.$name.db-journal - chown 0:6026 $dbpath.$name.db - chown 0:6026 $dbpath.$name.db-journal + chown 0:db_wrt $dbpath.$name.db + chown 0:db_wrt $dbpath.$name.db-journal chmod 660 $dbpath.$name.db chmod 660 $dbpath.$name.db-journal diff --git a/etc/wrt_commons_reset_db.sh b/etc/wrt_commons_reset_db.sh index 8fd3f3c..46f0ae7 100755 --- a/etc/wrt_commons_reset_db.sh +++ b/etc/wrt_commons_reset_db.sh @@ -14,7 +14,9 @@ # limitations under the License. # -rm -rf /opt/share/widget/system/* +source /etc/tizen-platform.conf + +rm -rf $TZ_SYS_RW_WIDGET/system/* uninstall_widgets=1 if [ "$1" == "--old" ] then @@ -22,12 +24,12 @@ then uninstall_widgets=0 fi #Removing of widget desktop icons -WIDGET_EXEC_PATH=/opt/usr/apps/ -WIDGET_PRELOAD_EXEC_PATH=/usr/apps/ -WIDGET_DESKTOP_PATH=/opt/share/applications/ -SMACK_RULES_PATH=/etc/smack/accesses.d/ -WRT_DB=/opt/dbspace/.wrt.db -PLUGINS_INSTALLATION_REQUIRED_PATH=/opt/share/widget/ +WIDGET_EXEC_PATH=$TZ_USER_APP/ +WIDGET_PRELOAD_EXEC_PATH=$TZ_SYS_RO_APP/ +WIDGET_DESKTOP_PATH=$TZ_SYS_RW_DESKTOP_APP/ +SMACK_RULES_PATH=$TZ_SYS_SMACK/accesses.d/ +WRT_DB=$TZ_SYS_DB/.wrt.db +PLUGINS_INSTALLATION_REQUIRED_PATH=$TZ_SYS_RW_WIDGET/ PLUGINS_INSTALLATION_REQUIRED=plugin-installation-required if [ -f ${WRT_DB} ] diff --git a/modules/certificate_dao/CMakeLists.txt b/modules/certificate_dao/CMakeLists.txt index 067603e..f3d8f96 100755 --- a/modules/certificate_dao/CMakeLists.txt +++ b/modules/certificate_dao/CMakeLists.txt @@ -21,6 +21,7 @@ INCLUDE(FindPkgConfig) PKG_CHECK_MODULES(CERTIFICATE_DAO_DEPS glib-2.0 + libtzplatform-config REQUIRED) SET(CERTIFICATE_DAO_INCLUDE_DIRS diff --git a/modules/certificate_dao/dao/certificate_dao.cpp b/modules/certificate_dao/dao/certificate_dao.cpp index 877d5a8..c0aa21e 100755 --- a/modules/certificate_dao/dao/certificate_dao.cpp +++ b/modules/certificate_dao/dao/certificate_dao.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include /* GCC versions 4.7 had changes to the C++ standard. It * no longer includes to remove namespace pollution. @@ -60,8 +61,8 @@ const char* const CERTIFICATE_DB_SQL_PATH = "/usr/share/wrt-engine/certificate_db.sql"; const char* const CERTIFICATE_DATABASE_JOURNAL_FILENAME = "-journal"; -const int WEB_APPLICATION_UID = 5000; -const int WEB_APPLICATION_GUID = 5000; +const int WEB_APPLICATION_UID = tzplatform_getuid(TZ_USER_NAME); +const int WEB_APPLICATION_GUID = tzplatform_getgid(TZ_SYS_USER_GROUP); std::string createDatabasePath(const WrtDB::TizenPkgId &pkgName) { diff --git a/modules/custom_handler_dao/CMakeLists.txt b/modules/custom_handler_dao/CMakeLists.txt index 7954bb7..3aba1b2 100644 --- a/modules/custom_handler_dao/CMakeLists.txt +++ b/modules/custom_handler_dao/CMakeLists.txt @@ -31,6 +31,7 @@ INCLUDE(FindPkgConfig) PKG_CHECK_MODULES(CUSTOM_HANDLER_DAO_DEPS glib-2.0 + libtzplatform-config REQUIRED) SET(CUSTOM_HANDLER_DAO_INCLUDE_DIRS diff --git a/modules/custom_handler_dao/dao/CustomHandlerDatabase.cpp b/modules/custom_handler_dao/dao/CustomHandlerDatabase.cpp index 5f26fd7..c53cc15 100644 --- a/modules/custom_handler_dao/dao/CustomHandlerDatabase.cpp +++ b/modules/custom_handler_dao/dao/CustomHandlerDatabase.cpp @@ -14,11 +14,12 @@ * limitations under the License. */ #include +#include namespace CustomHandlerDB { namespace Interface { namespace { -const char* CustomHandler_DB_DATABASE = "/opt/usr/dbspace/.wrt_custom_handler.db"; +const char* CustomHandler_DB_DATABASE = tzplatform_mkpath(TZ_USER_DB,".wrt_custom_handler.db"); DPL::DB::SqlConnection::Flag::Type CustomHandler_DB_FLAGS = DPL::DB::SqlConnection::Flag::UseLucene; } diff --git a/modules/i18n/dao/CMakeLists.txt b/modules/i18n/dao/CMakeLists.txt index e7f873e..aebf71b 100644 --- a/modules/i18n/dao/CMakeLists.txt +++ b/modules/i18n/dao/CMakeLists.txt @@ -26,6 +26,11 @@ ADD_CUSTOM_TARGET(${TARGET_I18N_DAO_DB} ALL DEPENDS .wrt_i18n.db .wrt_i18n.db-jo INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/wrt_i18n_db.sql DESTINATION share/wrt-engine/) ############################################################################### +INCLUDE(FindPkgConfig) + +PKG_CHECK_MODULES(I18N_DAO_DEPS + libtzplatform-config + REQUIRED) SET(I18N_DAO_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/modules/i18n/dao/include diff --git a/modules/i18n/dao/src/i18n_database.cpp b/modules/i18n/dao/src/i18n_database.cpp index e1a1fc5..958d059 100644 --- a/modules/i18n/dao/src/i18n_database.cpp +++ b/modules/i18n/dao/src/i18n_database.cpp @@ -14,12 +14,13 @@ * limitations under the License. */ #include +#include namespace I18n { namespace DB { namespace Interface { namespace { -const char* const I18N_DB_FILE_PATH = "/opt/usr/dbspace/.wrt_i18n.db"; +const char* const I18N_DB_FILE_PATH = tzplatform_mkpath(TZ_USER_DB,".wrt_i18n.db"); DPL::DB::SqlConnection::Flag::Type I18N_DB_FLAGS = DPL::DB::SqlConnection::Flag::UseLucene; diff --git a/modules/security_origin_dao/CMakeLists.txt b/modules/security_origin_dao/CMakeLists.txt index dce86f5..459cbcb 100644 --- a/modules/security_origin_dao/CMakeLists.txt +++ b/modules/security_origin_dao/CMakeLists.txt @@ -21,6 +21,7 @@ INCLUDE(FindPkgConfig) PKG_CHECK_MODULES(SECURITY_ORIGIN_DAO_DEPS glib-2.0 + libtzplatform-config REQUIRED) SET(SECURITY_ORIGIN_DAO_INCLUDE_DIRS diff --git a/modules/security_origin_dao/dao/security_origin_dao.cpp b/modules/security_origin_dao/dao/security_origin_dao.cpp index 7551189..382b821 100644 --- a/modules/security_origin_dao/dao/security_origin_dao.cpp +++ b/modules/security_origin_dao/dao/security_origin_dao.cpp @@ -32,6 +32,7 @@ #include #include #include +#include using namespace DPL::DB::ORM; using namespace DPL::DB::ORM::security_origin; @@ -74,8 +75,8 @@ const char* const SECURITY_ORIGIN_DB_SQL_PATH = "/usr/share/wrt-engine/security_origin_db.sql"; const char* const SECURITY_DATABASE_JOURNAL_FILENAME = "-journal"; -const int WEB_APPLICATION_UID = 5000; -const int WEB_APPLICATION_GUID = 5000; +const int WEB_APPLICATION_UID = tzplatform_getuid(TZ_USER_NAME); +const int WEB_APPLICATION_GUID = tzplatform_getgid(TZ_SYS_USER_GROUP); std::string createDatabasePath(const WrtDB::TizenPkgId &pkgName) { diff --git a/modules/widget_dao/CMakeLists.txt b/modules/widget_dao/CMakeLists.txt index 1445e7f..c1d1468 100755 --- a/modules/widget_dao/CMakeLists.txt +++ b/modules/widget_dao/CMakeLists.txt @@ -37,6 +37,7 @@ PKG_CHECK_MODULES(WRT_DAO_DEPS appcore-efl libxml-2.0 openssl + libtzplatform-config REQUIRED) set(WRT_DAO_RO_SOURCES diff --git a/modules/widget_dao/include/dpl/wrt-dao-ro/global_config.h b/modules/widget_dao/include/dpl/wrt-dao-ro/global_config.h index 832f9e2..9f481ab 100644 --- a/modules/widget_dao/include/dpl/wrt-dao-ro/global_config.h +++ b/modules/widget_dao/include/dpl/wrt-dao-ro/global_config.h @@ -25,6 +25,7 @@ #include #include +#include namespace WrtDB { namespace GlobalConfig { @@ -33,7 +34,7 @@ namespace GlobalConfig { */ inline const char* GetWrtDatabaseFilePath() { - return "/opt/dbspace/.wrt.db"; + return tzplatform_mkpath(TZ_SYS_DB,".wrt.db"); } /** @@ -49,7 +50,7 @@ inline const char* GetDevicePluginPath() */ inline const char* GetUserInstalledWidgetPath() { - return "/opt/usr/apps"; + return tzplatform_getenv(TZ_USER_APP); } /** @@ -57,7 +58,7 @@ inline const char* GetUserInstalledWidgetPath() */ inline const char* GetUserPreloadedWidgetPath() { - return "/usr/apps"; + return tzplatform_getenv(TZ_SYS_RO_APP); } /** @@ -65,7 +66,7 @@ inline const char* GetUserPreloadedWidgetPath() */ inline const char* GetWidgetUserDataPath() { - return "/opt/usr/apps"; + return tzplatform_getenv(TZ_USER_APP); } /** @@ -81,7 +82,7 @@ inline const char* GetWidgetSrcPath() */ inline const char* GetPublicVirtualRootPath() { - return "/opt/share/widget/data/Public"; + return tzplatform_mkpath(TZ_SYS_RW_WIDGET,"data/Public"); } /** @@ -97,7 +98,7 @@ inline const char* GetWidgetLocalStoragePath() */ inline const char* GetTestsDataPath() { - return "/opt/share/widget/tests"; + return tzplatform_mkpath(TZ_SYS_RW_WIDGET,"tests"); } /** @@ -129,7 +130,7 @@ inline const char* GetWidgetPrivateTempStoragePath() */ inline const char* GetUserWidgetDesktopPath() { - return "/opt/share/applications"; + return tzplatform_getenv(TZ_SYS_RW_DESKTOP_APP); } /** @@ -137,7 +138,7 @@ inline const char* GetUserWidgetDesktopPath() */ inline const char* GetWrtClientExec() { - return "/usr/bin/wrt-client"; + return tzplatform_mkpath(TZ_SYS_BIN,"wrt-client"); } /** @@ -145,7 +146,7 @@ inline const char* GetWrtClientExec() */ inline const char* GetUserWidgetDesktopIconPath() { - return "/opt/share/icons/default/small"; + return tzplatform_mkpath(TZ_SYS_SHARE,"icons/default/small"); } /** @@ -153,13 +154,13 @@ inline const char* GetUserWidgetDesktopIconPath() */ inline const char* GetUserWidgetDefaultIconFile() { - return "/usr/share/wrt-engine/wrt_widget_default_icon.png"; + return tzplatform_mkpath(TZ_SYS_RO_WRT_ENGINE,"wrt_widget_default_icon.png"); } inline const char* GetSignatureXmlSchema() { //TODO please rename, this filename is not descriptive enough - return "/usr/share/wrt-engine/schema.xsd"; + return tzplatform_mkpath(TZ_SYS_RO_WRT_ENGINE,"schema.xsd"); } /** @@ -209,7 +210,7 @@ inline const char* GetPluginSuffix() */ inline const char* GetPluginInstallInitializerName() { - return "/opt/share/widget/plugin-installation-required"; + return tzplatform_mkpath(TZ_SYS_RW_WIDGET,"plugin-installation-required"); } /** @@ -218,17 +219,17 @@ inline const char* GetPluginInstallInitializerName() inline const char* GetFingerprintListFile() { - return "/usr/share/wrt-engine/fingerprint_list.xml"; + return tzplatform_mkpath(TZ_SYS_RO_WRT_ENGINE,"fingerprint_list.xml"); } inline const char* GetFingerprintListSchema() { - return "/usr/share/wrt-engine/fingerprint_list.xsd"; + return tzplatform_mkpath(TZ_SYS_RO_WRT_ENGINE,"fingerprint_list.xsd"); } inline const char* GetVCoreDatabaseFilePath() { - return "/opt/dbspace/.cert_svc_vcore.db"; + return tzplatform_mkpath(TZ_SYS_DB,".cert_svc_vcore.db"); } /** @@ -251,12 +252,12 @@ inline const char* GetTizenVersion() inline const char* GetShareDirectoryPath() { - return "/opt/share"; + return tzplatform_getenv(TZ_SYS_SHARE); } inline const char* GetTempInstallInfoPath() { - return "/opt/share/widget/temp_info"; + return tzplatform_mkpath(TZ_SYS_RW_WIDGET,"temp_info"); } inline const char* GetWidgetSharedPath() @@ -295,17 +296,17 @@ inline const char* GetBackupDatabaseSuffix() inline const char* GetManifestPath() { - return "/opt/share/packages"; + return tzplatform_getenv(TZ_SYS_RW_PACKAGES); } inline const char* GetPreloadManifestPath() { - return "/usr/share/packages"; + return tzplatform_getenv(TZ_SYS_RO_PACKAGES); } inline const char* GetRecoveryStatusPath() { - return "/usr/share/packages/.recovery/wgt"; + return tzplatform_mkpath(TZ_SYS_RO_PACKAGES,".recovery/wgt"); } } // namespace GlobalConfig } // namespace WrtDB diff --git a/modules/widget_interface_dao/CMakeLists.txt b/modules/widget_interface_dao/CMakeLists.txt index 8133b0a..0d5fd45 100644 --- a/modules/widget_interface_dao/CMakeLists.txt +++ b/modules/widget_interface_dao/CMakeLists.txt @@ -14,6 +14,7 @@ INCLUDE(FindPkgConfig) PKG_CHECK_MODULES(WIDGET_INTERFACE_DAO_DEPS glib-2.0 + libtzplatform-config REQUIRED) SET(WIDGET_INTERFACE_DAO_INCLUDE_DIRS diff --git a/modules/widget_interface_dao/dao/widget_interface_dao.cpp b/modules/widget_interface_dao/dao/widget_interface_dao.cpp index e56ce42..d5af1be 100644 --- a/modules/widget_interface_dao/dao/widget_interface_dao.cpp +++ b/modules/widget_interface_dao/dao/widget_interface_dao.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include "orm_generator_widget_interface.h" namespace WidgetInterfaceDB { @@ -59,8 +60,8 @@ const char* const DATABASE_FILE_PATH = "/usr/share/wrt-engine/widget_interface_db.sql"; const char* const DATABASE_JOURNAL_FILENAME = "-journal"; -const int APP_UID = 5000; -const int APP_GUID = 5000; +const int APP_UID = tzplatform_getuid(TZ_USER_NAME); +const int APP_GUID = tzplatform_getgid(TZ_SYS_USER_GROUP); } // anonymous namespace WidgetInterfaceDAO::WidgetInterfaceDAO(int widgetHandle) : diff --git a/packaging/wrt-commons.spec b/packaging/wrt-commons.spec index c6d2ca6..c68b829 100644 --- a/packaging/wrt-commons.spec +++ b/packaging/wrt-commons.spec @@ -24,7 +24,8 @@ BuildRequires: pkgconfig(openssl) BuildRequires: pkgconfig(libiri) BuildRequires: pkgconfig(libidn) BuildRequires: pkgconfig(minizip) - +BuildRequires: pkgconfig(libtzplatform-config) +Requires: libtzplatform-config %description Wrt common library @@ -79,10 +80,10 @@ make %{?jobs:-j%jobs} %post /sbin/ldconfig -mkdir -p /opt/share/widget/system -mkdir -p /opt/share/widget/user -mkdir -p /opt/share/widget/exec -mkdir -p /opt/share/widget/data/Public +mkdir -p ${TZ_SYS_RW_WIDGET}/system +mkdir -p ${TZ_SYS_RW_WIDGET}/user +mkdir -p ${TZ_SYS_RW_WIDGET}/exec +mkdir -p ${TZ_SYS_RW_WIDGET}/data/Public mkdir -p %{_libdir}/wrt-plugins #Don't reset DB when install on QEMU (during other packages building witch GBS) @@ -90,11 +91,11 @@ if [ -z "$EMULATOR_ARCHS" ]; then if [ -z ${2} ]; then echo "This is new install of wrt-commons" echo "Calling /usr/bin/wrt_commons_reset_db.sh" - /usr/bin/wrt_commons_reset_db.sh + %{_bindir}/wrt_commons_reset_db.sh else # Find out old and new version of databases - WRT_OLD_DB_VERSION=`sqlite3 /opt/dbspace/.wrt.db ".tables" | grep "DB_VERSION_"` - WRT_NEW_DB_VERSION=`cat /usr/share/wrt-engine/wrt_db.sql | tr '[:blank:]' '\n' | grep DB_VERSION_` + WRT_OLD_DB_VERSION=`sqlite3 %{TZ_SYS_DB}/.wrt.db ".tables" | grep "DB_VERSION_"` + WRT_NEW_DB_VERSION=`cat %{TZ_SYS_RO_WRT_ENGINE}/wrt_db.sql | tr '[:blank:]' '\n' | grep DB_VERSION_` echo "OLD wrt database version ${WRT_OLD_DB_VERSION}" echo "NEW wrt database version ${WRT_NEW_DB_VERSION}" @@ -105,17 +106,17 @@ if [ -z "$EMULATOR_ARCHS" ]; then echo "Equal database detected so db installation ignored" else echo "Calling /usr/bin/wrt_commons_reset_db.sh" - /usr/bin/wrt_commons_reset_db.sh + %{_bindir}/wrt_commons_reset_db.sh fi else echo "Calling /usr/bin/wrt_commons_reset_db.sh" - /usr/bin/wrt_commons_reset_db.sh + %{_bindir}/wrt_commons_reset_db.sh fi fi fi -mkdir -p /usr/etc/ace -mkdir -p /usr/apps/org.tizen.policy +mkdir -p %{TZ_SYS_ACE_CONF} +mkdir -p %{TZ_SYS_RO_APP}/org.tizen.policy # DBUS services fix # WARNING: THIS IS TEMPORARY SOLUTION, AS THIS SHOULD NOT BE OUR @@ -161,8 +162,8 @@ echo "[WRT] wrt-commons postinst done ..." %attr(755,root,root) %{_bindir}/wrt_dao_tests_prepare_db.sh %attr(755,root,root) %{_bindir}/wrt_db_localization_prepare.sh %{_datadir}/dbus-1/services/org.tizen.DBusTestService.service - /opt/share/wrt/wrt-commons/tests/* - /opt/share/widget/tests/localization/* + %{TZ_SYS_SHARE}/wrt/wrt-commons/tests/* + %{TZ_SYS_RW_WIDGET}/tests/localization/* %endif %files devel diff --git a/tests/dao/wrt_dao_tests_prepare_db.sh b/tests/dao/wrt_dao_tests_prepare_db.sh index 9666e87..3796cdd 100755 --- a/tests/dao/wrt_dao_tests_prepare_db.sh +++ b/tests/dao/wrt_dao_tests_prepare_db.sh @@ -14,7 +14,9 @@ # limitations under the License. # -WRT_DB=/opt/dbspace/.wrt.db +source /etc/tizen-platform.conf + +WRT_DB=$TZ_SYS_DB/.wrt.db WRT_DB_BCK=/tmp/wrt.db_backup if [ "x$1" == "xstart" ]; then diff --git a/tests/files_localization/wrt_db_localization_prepare.sh b/tests/files_localization/wrt_db_localization_prepare.sh index 67bed04..e3c74a2 100644 --- a/tests/files_localization/wrt_db_localization_prepare.sh +++ b/tests/files_localization/wrt_db_localization_prepare.sh @@ -17,11 +17,13 @@ set -e +source /etc/tizen-platform.conf + trap 'echo "Script failed"; exit 1' ERR -WRT_DB=/opt/dbspace/.wrt.db +WRT_DB=$TZ_SYS_DB/.wrt.db WRT_DB_BCK=/tmp/wrt.db_backup -WIDGET_INSTALL_PATH=/opt/usr/apps +WIDGET_INSTALL_PATH=$TZ_USER_APP case $1 in start) @@ -35,8 +37,8 @@ case $1 in sqlite3 $WRT_DB "${INS_ALL_WIDGET} VALUES(1, 'tizenid201')"; sqlite3 $WRT_DB "${INS_ALL_WIDGET} VALUES(2, 'tizenid202')"; - sqlite3 $WRT_DB "${INS_ALL_WIDGETEXT} VALUES(1, '/opt/share/widget/tests/localization/widget1')"; - sqlite3 $WRT_DB "${INS_ALL_WIDGETEXT} VALUES(2, '/opt/share/widget/tests/localization/widget2')"; + sqlite3 $WRT_DB "${INS_ALL_WIDGETEXT} VALUES(1, '${TZ_SYS_RW_WIDGET}/tests/localization/widget1')"; + sqlite3 $WRT_DB "${INS_ALL_WIDGETEXT} VALUES(2, '${TZ_SYS_RW_WIDGET}/tests/localization/widget2')"; exit 0 ;; stop) diff --git a/tests/utils/CMakeLists.txt b/tests/utils/CMakeLists.txt index f17421b..10d9c60 100644 --- a/tests/utils/CMakeLists.txt +++ b/tests/utils/CMakeLists.txt @@ -17,6 +17,11 @@ # @version 1.0 # @brief # +INCLUDE(FindPkgConfig) + +PKG_CHECK_MODULES(DPL_TESTS_UTIL_DEPS + libtzplatform-config + REQUIRED) SET(TARGET_NAME "wrt-commons-tests-utils") diff --git a/tests/utils/path_tests.cpp b/tests/utils/path_tests.cpp index eac35fd..2e5a846 100644 --- a/tests/utils/path_tests.cpp +++ b/tests/utils/path_tests.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -936,8 +937,8 @@ Expected: temp dir exists RUNNER_TEST(path_create_temp_dir) { Path p1 = CreateTempPath(Path("/usr/tmp/")); - Path p2 = CreateTempPath(Path("/opt/usr/apps/tmp/")); - Path p3 = CreateTempPath(Path("/opt/usr/apps/tmp/")); + Path p2 = CreateTempPath(Path(tzplatform_mkpath(TZ_USER_APP,"tmp/"))); + Path p3 = CreateTempPath(Path(tzplatform_mkpath(TZ_USER_APP,"tmp/"))); RUNNER_ASSERT_MSG(p1.Exists(), "Temp dir doesn't exists"); RUNNER_ASSERT_MSG(p2.Exists(), "Temp dir doesn't exists"); diff --git a/tests/utils/wrt_utility.cpp b/tests/utils/wrt_utility.cpp index 710b578..d23b7e9 100644 --- a/tests/utils/wrt_utility.cpp +++ b/tests/utils/wrt_utility.cpp @@ -29,6 +29,7 @@ #include #include #include +#include RUNNER_TEST_GROUP_INIT(DPL_WRT_UTILITY) @@ -99,7 +100,7 @@ RUNNER_TEST(wrt_utility_WrtUtilMakeDir_PermissionError) char *buffer = new char[bufsize]; struct passwd p; struct passwd *result = NULL; - int return_value = getpwnam_r("app", &p, buffer, bufsize, &result); + int return_value = getpwnam_r(tzplatform_getenv(TZ_USER_NAME), &p, buffer, bufsize, &result); delete[] buffer; if (return_value != 0 || !result) { -- 2.34.1