Remove hardcoded path for multiuser support 47/16447/1
authorJean-Benoit MARTIN <jean-benoit.martin@open.eurogiciel.org>
Thu, 12 Dec 2013 14:54:15 +0000 (15:54 +0100)
committerJean-Benoit MARTIN <jean-benoit.martin@open.eurogiciel.org>
Mon, 17 Feb 2014 13:30:27 +0000 (14:30 +0100)
Bug-Tizen: PTREL-372

Change-Id: I64cc7d795014f8ab25d13f7bdae0a2acb314e1e2
Signed-off-by: Jean-Benoit MARTIN <jean-benoit.martin@open.eurogiciel.org>
20 files changed:
etc/wrt_commons_create_clean_db.sh
etc/wrt_commons_reset_db.sh
modules/certificate_dao/CMakeLists.txt
modules/certificate_dao/dao/certificate_dao.cpp
modules/custom_handler_dao/CMakeLists.txt
modules/custom_handler_dao/dao/CustomHandlerDatabase.cpp
modules/i18n/dao/CMakeLists.txt
modules/i18n/dao/src/i18n_database.cpp
modules/security_origin_dao/CMakeLists.txt
modules/security_origin_dao/dao/security_origin_dao.cpp
modules/widget_dao/CMakeLists.txt
modules/widget_dao/include/dpl/wrt-dao-ro/global_config.h
modules/widget_interface_dao/CMakeLists.txt
modules/widget_interface_dao/dao/widget_interface_dao.cpp
packaging/wrt-commons.spec
tests/dao/wrt_dao_tests_prepare_db.sh
tests/files_localization/wrt_db_localization_prepare.sh
tests/utils/CMakeLists.txt
tests/utils/path_tests.cpp
tests/utils/wrt_utility.cpp

index 206359a4351347c8102513ea17f206e7486c5b0a..6f54b5788d81495320213aa49769cbe9ea792f58 100755 (executable)
 #    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
 
index 8fd3f3cb47307a888f977ee008212b6f5fa89fb8..46f0ae7b4de591f39ec0566262d0aa16c2504f5e 100755 (executable)
@@ -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} ]
index 067603e6f1fc3f8df338039f10b065b1d6c13af6..f3d8f96fefb9e8f34ad1654fd08f979a49310522 100755 (executable)
@@ -21,6 +21,7 @@ INCLUDE(FindPkgConfig)
 
 PKG_CHECK_MODULES(CERTIFICATE_DAO_DEPS
     glib-2.0
+    libtzplatform-config
     REQUIRED)
 
 SET(CERTIFICATE_DAO_INCLUDE_DIRS
index 877d5a8e06ecf322d4e1b94b279cf0b2d493a5f2..c0aa21e72d1806a299185a0a3c1b55a23c87bba6 100755 (executable)
@@ -31,6 +31,7 @@
 #include <dpl/wrt-dao-ro/global_config.h>
 #include <dpl/wrt-dao-ro/common_dao_types.h>
 #include <sys/stat.h>
+#include <tzplatform_config.h>
 #include <fstream>
 /* GCC versions 4.7 had changes to the C++ standard. It
  * no longer includes <unistd.h> 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)
 {
index 7954bb776bdeb071abd7ad57320452bcb89fa59b..3aba1b29fa550d842228e91982840794b1636ccb 100644 (file)
@@ -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
index 5f26fd728b2ccdaee30c5153a28106684837f82f..c53cc1544096215a7b8810901ab28c2d04fdb573 100644 (file)
  *    limitations under the License.
  */
 #include <wrt-commons/custom-handler-dao-ro/CustomHandlerDatabase.h>
+#include <tzplatform_config.h>
 
 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;
 }
index e7f873e7e4c5c82f70dd9558e9a1cc48df260ee9..aebf71b2f6801b187ff6d596202ea8f98414cdb7 100644 (file)
@@ -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
index e1a1fc5bb4c15774e3fcd3ef32a7fa13df5d693a..958d059eae7af3b18f9f9eaaa3dbca8c4dd372db 100644 (file)
  *    limitations under the License.
  */
 #include <wrt-commons/i18n-dao-ro/i18n_database.h>
+#include <tzplatform_config.h>
 
 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;
index dce86f5a7a485e59f2a764fbdccdbeb027fad2e4..459cbcb9e418ae0650caa95b6424522d5681ee30 100644 (file)
@@ -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
index 75511890cd6eae5809cd853ffffa5aeb84a65b3c..382b821fe01346cdec9795572d7670941520f5ff 100644 (file)
@@ -32,6 +32,7 @@
 #include <sys/stat.h>
 #include <fstream>
 #include <unistd.h>
+#include <tzplatform_config.h>
 
 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)
 {
index 1445e7fb49f25b19ad7a6b33aaf128fd56ed1b1f..c1d14685f17b8742e5e5f6907f746b737cc4627a 100755 (executable)
@@ -37,6 +37,7 @@ PKG_CHECK_MODULES(WRT_DAO_DEPS
     appcore-efl
     libxml-2.0
     openssl
+    libtzplatform-config
     REQUIRED)
 
 set(WRT_DAO_RO_SOURCES
index 832f9e2b821000aa65321428d851eeff117b7831..9f481ab3f8c52473cb67c74442e29bb815fd9527 100644 (file)
@@ -25,6 +25,7 @@
 
 #include <string>
 #include <list>
+#include <tzplatform_config.h>
 
 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
index 8133b0a4911426943639cefff75bbce4c5246bcb..0d5fd458aa3212e7b9dfe739c9ca87c7db9d6267 100644 (file)
@@ -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
index e56ce42b9f0f63898c703c226a08d837a226feeb..d5af1be076b7b66546b734ef5a7cbefed6355aec 100644 (file)
@@ -33,6 +33,7 @@
 #include <dpl/wrt-dao-ro/widget_dao_read_only.h>
 #include <dpl/wrt-dao-ro/WrtDatabase.h>
 #include <dpl/wrt-dao-ro/widget_config.h>
+#include <tzplatform_config.h>
 #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) :
index c6d2ca6b0ee8c136a52d63b9ad46cbc2545e3034..c68b8292d1742e9c1c4ef33a8c088185a43df854 100644 (file)
@@ -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
index 9666e8713da7b2bab0cc48875dd8ed171163664a..3796cddd8952ce1c4f4bd56bf50c78c65f789b87 100755 (executable)
@@ -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
index 67bed042beacf670c299e36c73f4c04453d05204..e3c74a2747a8c5175668c91a1a0a77607ebd5ab0 100644 (file)
 
 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)
index f17421bd6102bac545455d815dc2b2f211d27740..10d9c60f8762005fb719f382110b689e74a6dee0 100644 (file)
 # @version     1.0
 # @brief
 #
+INCLUDE(FindPkgConfig)
+
+PKG_CHECK_MODULES(DPL_TESTS_UTIL_DEPS
+    libtzplatform-config
+    REQUIRED)
 
 SET(TARGET_NAME "wrt-commons-tests-utils")
 
index eac35fdb1569fd310e9b6d7926f2f9fdcd41a14e..2e5a8462bc0b8d69457f633f687fa1047d5aeab0 100644 (file)
@@ -31,6 +31,7 @@
 #include <dpl/binary_queue.h>
 #include <dpl/file_input.h>
 #include <dpl/file_output.h>
+#include <tzplatform_config.h>
 
 #include <sys/stat.h>
 #include <unistd.h>
@@ -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");
index 710b5785c37758ca09004ad98230c4593d5c0c08..d23b7e9d4fc7148d3d9cb5c3bfc1f1532eed9984 100644 (file)
@@ -29,6 +29,7 @@
 #include <dpl/test/test_runner.h>
 #include <dpl/utils/wrt_utility.h>
 #include <dpl/log/log.h>
+#include <tzplatform_config.h>
 
 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) {