summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>2016-01-08 13:32:28 +0100
committerKrzysztof Jackiewicz <k.jackiewicz@samsung.com>2016-01-14 09:38:36 +0100
commita61e9ce01fa45323b381e6456d07117516d2e55d (patch)
tree033ada39d5a6212a9c4d0d5282c53c551d0e9c20 /tests
parent8bc7217902a49348d31647251fe9f4937b08a5f3 (diff)
downloadkey-manager-a61e9ce01fa45323b381e6456d07117516d2e55d.tar.gz
key-manager-a61e9ce01fa45323b381e6456d07117516d2e55d.tar.bz2
key-manager-a61e9ce01fa45323b381e6456d07117516d2e55d.zip
Get dir locations from environment
[Problem] Key manager data dir location was hardcoded to /opt/data/ckm/. On common profile image key-manager fails to start because of lack of /opt/data. [Solution] Get directory locations from tizen platform config. Copy files from old location if necessary. Make installation fail if runtime and compile time settings differ. Provide upgrade script. [Verification] Install key-manager package. Make sure all the content from /opt/data/ckm/ has been moved to new location (/usr/data/ckm). Run tests. Make sure all data is placed in new location. Run upgrade scripts (/etc/opt/upgrad/*key-manager*.sh) on old version of ckm and check results. Change-Id: Idafbe0fe43f1140c137f87883273b609a499b4cc
Diffstat (limited to 'tests')
-rw-r--r--tests/CMakeLists.txt1
-rw-r--r--tests/encryption-scheme/CMakeLists.txt3
-rw-r--r--tests/encryption-scheme/scheme-test.cpp6
-rw-r--r--tests/test_db_crypto.cpp6
-rw-r--r--tests/test_xml-parser.cpp2
5 files changed, 9 insertions, 9 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 8cadd638..dcad88cd 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -5,6 +5,7 @@ PKG_CHECK_MODULES(KEY_MANAGER_TEST_DEP
FIND_PACKAGE(Threads REQUIRED)
ADD_DEFINITIONS( "-DBOOST_TEST_DYN_LINK" )
+ADD_DEFINITIONS("-DDB_TEST_DIR=\"${DB_TEST_DIR}\"")
SET(KEY_MANAGER_SRC_PATH ${PROJECT_SOURCE_DIR}/src)
SET(KEY_MANAGER_PATH ${PROJECT_SOURCE_DIR}/src/manager)
diff --git a/tests/encryption-scheme/CMakeLists.txt b/tests/encryption-scheme/CMakeLists.txt
index 10cea932..bfd0a6c5 100644
--- a/tests/encryption-scheme/CMakeLists.txt
+++ b/tests/encryption-scheme/CMakeLists.txt
@@ -85,5 +85,4 @@ TARGET_LINK_LIBRARIES(${TARGET_CKM_GENERATOR}
INSTALL(TARGETS ${TARGET_CKM_GENERATOR} DESTINATION bin)
-
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/encryption-scheme.p12 DESTINATION /usr/share/ckm-db-test) \ No newline at end of file
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/encryption-scheme.p12 DESTINATION ${DB_TEST_DIR}) \ No newline at end of file
diff --git a/tests/encryption-scheme/scheme-test.cpp b/tests/encryption-scheme/scheme-test.cpp
index 9abf27eb..cdf90dda 100644
--- a/tests/encryption-scheme/scheme-test.cpp
+++ b/tests/encryption-scheme/scheme-test.cpp
@@ -268,8 +268,8 @@ gid_t getGid(const char *name) {
void restoreFile(const string& filename) {
static uid_t CKM_UID = getUid(USER_NAME);
static gid_t CKM_GID = getGid(GROUP_NAME);
- string sourcePath = "/usr/share/ckm-db-test/" + filename;
- string targetPath = "/opt/data/ckm/" + filename;
+ string sourcePath = string(DB_TEST_DIR) + filename;
+ string targetPath = string(RW_DATA_DIR) + filename;
int err, ret;
@@ -400,7 +400,7 @@ void SchemeTest::SwitchToRoot() {
void SchemeTest::FillDb() {
// pkcs
- ifstream is("/usr/share/ckm-db-test/encryption-scheme.p12");
+ ifstream is(DB_TEST_DIR "/encryption-scheme.p12");
if(!is)
throw runtime_error("Failed to read pkcs");
istreambuf_iterator<char> begin(is), end;
diff --git a/tests/test_db_crypto.cpp b/tests/test_db_crypto.cpp
index c5681b49..c8b85d2c 100644
--- a/tests/test_db_crypto.cpp
+++ b/tests/test_db_crypto.cpp
@@ -289,19 +289,19 @@ void verifyDBisValid(DBFixture & fixture)
struct DBVer1Migration : public DBFixture
{
- DBVer1Migration() : DBFixture("/usr/share/ckm-db-test/testme_ver1.db")
+ DBVer1Migration() : DBFixture(DB_TEST_DIR "/testme_ver1.db")
{}
};
struct DBVer2Migration : public DBFixture
{
- DBVer2Migration() : DBFixture("/usr/share/ckm-db-test/testme_ver2.db")
+ DBVer2Migration() : DBFixture(DB_TEST_DIR "/testme_ver2.db")
{}
};
struct DBVer3Migration : public DBFixture
{
- DBVer3Migration() : DBFixture("/usr/share/ckm-db-test/testme_ver3.db")
+ DBVer3Migration() : DBFixture(DB_TEST_DIR "/testme_ver3.db")
{}
};
}
diff --git a/tests/test_xml-parser.cpp b/tests/test_xml-parser.cpp
index b12cbd6d..514683bd 100644
--- a/tests/test_xml-parser.cpp
+++ b/tests/test_xml-parser.cpp
@@ -41,7 +41,7 @@ const char *XSD_4_device_key = "XML_4_device_key.xsd";
std::string format_test_path(const char *file)
{
- return std::string("/usr/share/ckm-db-test/") + std::string(file);
+ return std::string(DB_TEST_DIR) + std::string(file);
}
bool startCallbackFlag = false;