Merge branch 'tizen' into security-manager 34/41134/1
authorTomasz Swierczek <t.swierczek@samsung.com>
Thu, 11 Jun 2015 08:40:00 +0000 (10:40 +0200)
committerTomasz Swierczek <t.swierczek@samsung.com>
Thu, 11 Jun 2015 08:41:01 +0000 (10:41 +0200)
Change-Id: I2fdb870ce012cedf1930644ce0ec47ce1a10a94c

30 files changed:
README
packaging/security-tests.manifest
src/ckm/async-api.cpp
src/ckm/capi-access_control.cpp
src/ckm/main.cpp
src/ckm/test-certs.cpp
src/ckm/test-certs.h
src/common/tests_common.h
src/cynara-tests/common/cynara_test_commons.cpp
src/cynara-tests/common/cynara_test_commons.h
src/cynara-tests/common/cynara_test_env.cpp
src/cynara-tests/common/cynara_test_env.h
src/cynara-tests/test_cases.cpp
src/cynara-tests/test_cases_agent.cpp
src/cynara-tests/test_cases_async.cpp
src/cynara-tests/test_cases_db.cpp
src/framework/include/dpl/test/test_case.h [new file with mode: 0644]
src/framework/include/dpl/test/test_case_extended.h [new file with mode: 0644]
src/framework/include/dpl/test/test_runner.h
src/framework/include/dpl/test/test_runner_child.h
src/framework/include/dpl/test/test_runner_multiprocess.h
src/framework/src/test_runner.cpp
src/framework/src/test_runner_child.cpp
src/framework/src/test_runner_multiprocess.cpp
src/libprivilege-control-tests/CMakeLists.txt
src/libprivilege-control-tests/common/libprivilege-control_test_common.h
src/libprivilege-control-tests/test_cases.cpp
src/libprivilege-control-tests/test_cases_nosmack.cpp
src/libprivilege-control-tests/test_cases_stress.cpp
src/security-manager-tests/security_manager_tests.cpp

diff --git a/README b/README
index c946fe7..83c2c05 100644 (file)
--- a/README
+++ b/README
@@ -84,6 +84,22 @@ dpl-test-framework
 Adding/removing those macro calls will add/remove test cases they provide. To
 change tests, change body of those macro calls. Registered tests are run within
 group alphabetically.
+Those macros allow additional arguments which are classes with mandatory
+methods:
+* (constructor) ()
+    Called while registering test.
+    Should not throw any exceptions
+* init(const std::string &testName)
+    Called before test case function in order of classes passed to macro.
+    Should not be forked.
+    testName argument is name of the test (first macro argument).
+* finish(void)
+    called after test case function in reversed order of classes passed to
+    macro.
+    Should not be forked.
+Created instances of those classes may be accessed from within test case body
+as argument of test case funtion is
+  std::tuple<ClassesPassed> &optionalArgsTuple
 
 dpl-test-framework
   test_runner.h
@@ -231,6 +247,30 @@ RUNNER_CHILD_TEST_NOSMACK(bar_file2_dropped_root)
                             "Wrong errno on opening " << " file");
 }
 
+class Env
+{
+public:
+    Env() { ... }
+    void init(const std::string &testName) { ... }
+    void finish() { ... }
+    void doEnv() { ... }
+};
+
+class Restore
+{
+public:
+    Restore() { ... }
+    void init(const std::string &testName) { ... }
+    void finish() { ... }
+    void doRestore() { ... }
+};
+
+RUNNER_TEST(bar_optional_args, Env, Restore)
+{
+    std::get<0>(optionalArgsTuple).doEnv();
+    std::get<1>(optionalArgsTuple).doRestore();
+}
+
 int main(int argc, char *argv[])
 {
     SummaryCollector::Register();
index 7395a84..e6064d1 100644 (file)
@@ -19,6 +19,7 @@
         <filesystem path="/usr/bin/cynara-tests" exec_label="_" />
         <filesystem path="/usr/bin/ckm-tests" exec_label="_" />
 
+        <filesystem path="/usr/bin/test-app-wgt" exec_label="User" />
         <filesystem path="/usr/bin/test-app-efl" exec_label="User" />
         <filesystem path="/usr/bin/test-app-osp" exec_label="User" />
     </assign>
index 27284c4..1f678f2 100644 (file)
@@ -314,29 +314,62 @@ typedef void (ManagerAsync::*certChainFn2)(const ManagerAsync::ObserverPtr&,
                                            const AliasVector&,
                                            const AliasVector&,
                                            bool);
-} // namespace anonymous
 
+class CKMAsyncAPIEnv
+{
+public:
+    void init(const std::string &) {
+        reset_user_data(0, TEST_PASS);
+        reset_user_data(APP_UID, TEST_PASS);
+    }
+    void finish() {
+        remove_user_data(APP_UID);
+        remove_user_data(0);
+    }
+};
 
-RUNNER_TEST_GROUP_INIT(CKM_ASYNC_API);
+CKM::Alias alias_PKCS_exportable = "async-test-PKCS-export";
+CKM::Alias alias_PKCS_not_exportable = "async-test-PKCS-no-export";
 
-RUNNER_TEST(TA0000_init)
+CKM::PKCS12ShPtr loadPkcs()
 {
-    int temp;
-    ControlShPtr control = Control::create();
+    std::ifstream is("/usr/share/ckm-test/pkcs.p12");
+    std::istreambuf_iterator<char> begin(is), end;
+    std::vector<char> buff(begin, end);
+
+    CKM::RawBuffer buffer(buff.size());
+    memcpy(buffer.data(), buff.data(), buff.size());
+
+    auto pkcs = CKM::PKCS12::create(buffer, CKM::Password());
+    RUNNER_ASSERT_MSG(
+        NULL != pkcs.get(),
+        "Error in PKCS12::create()");
+
+    auto cert = pkcs->getCertificate();
+    RUNNER_ASSERT_MSG(
+        NULL != cert.get(),
+        "Error in PKCS12::getCertificate()");
+
+    auto key = pkcs->getKey();
+    RUNNER_ASSERT_MSG(
+        NULL != key.get(),
+        "Error in PKCS12::getKey()");
 
-    RUNNER_ASSERT_MSG(CKM_API_SUCCESS == (temp = control->removeUserData(0)),
-                      "Error=" << CKM::ErrorToString(temp));
-    RUNNER_ASSERT_MSG(CKM_API_SUCCESS == (temp = control->unlockUserKey(0, TEST_PASS)),
-                      "Error=" << CKM::ErrorToString(temp));
+    auto caVector = pkcs->getCaCertificateShPtrVector();
+    RUNNER_ASSERT_MSG(
+        2 == caVector.size(),
+        "Wrong size of vector");
 
-    RUNNER_ASSERT_MSG(CKM_API_SUCCESS == (temp = control->removeUserData(APP_UID)),
-                      "Error=" << ErrorToString(temp));
-    RUNNER_ASSERT_MSG(CKM_API_SUCCESS == (temp = control->unlockUserKey(APP_UID, TEST_PASS)),
-                      "Error=" << ErrorToString(temp));
+    return pkcs;
 }
 
+} // namespace anonymous
+
+
+RUNNER_TEST_GROUP_INIT(CKM_ASYNC_API);
+
 // saveKey
-RUNNER_CHILD_TEST(TA0010_save_key_invalid_param)
+RUNNER_CHILD_TEST(TA0010_save_key_invalid_param, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -345,7 +378,7 @@ RUNNER_CHILD_TEST(TA0010_save_key_invalid_param)
     test_invalid_param(&ManagerAsync::saveKey, "alias", KeyShPtr(), Policy());
 }
 
-RUNNER_CHILD_TEST(TA0020_save_key_already_exists)
+RUNNER_CHILD_TEST(TA0020_save_key_already_exists, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -358,7 +391,7 @@ RUNNER_CHILD_TEST(TA0020_save_key_already_exists)
                   Policy());
 }
 
-RUNNER_CHILD_TEST(TA0050_save_key_positive)
+RUNNER_CHILD_TEST(TA0050_save_key_positive, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -368,7 +401,7 @@ RUNNER_CHILD_TEST(TA0050_save_key_positive)
 
 
 // saveCertificate
-RUNNER_CHILD_TEST(TA0110_save_cert_invalid_param)
+RUNNER_CHILD_TEST(TA0110_save_cert_invalid_param, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -378,7 +411,7 @@ RUNNER_CHILD_TEST(TA0110_save_cert_invalid_param)
     test_invalid_param(&ManagerAsync::saveCertificate, "alias", CertificateShPtr(), Policy());
 }
 
-RUNNER_CHILD_TEST(TA0120_save_cert_already_exists)
+RUNNER_CHILD_TEST(TA0120_save_cert_already_exists, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -391,7 +424,7 @@ RUNNER_CHILD_TEST(TA0120_save_cert_already_exists)
                   Policy());
 }
 
-RUNNER_CHILD_TEST(TA0150_save_cert_positive)
+RUNNER_CHILD_TEST(TA0150_save_cert_positive, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -401,7 +434,7 @@ RUNNER_CHILD_TEST(TA0150_save_cert_positive)
 
 
 // saveData
-RUNNER_CHILD_TEST(TA0210_save_data_invalid_param)
+RUNNER_CHILD_TEST(TA0210_save_data_invalid_param, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -410,7 +443,7 @@ RUNNER_CHILD_TEST(TA0210_save_data_invalid_param)
     test_invalid_param(&ManagerAsync::saveData, "alias", RawBuffer(), Policy());
 }
 
-RUNNER_CHILD_TEST(TA0220_save_data_already_exists)
+RUNNER_CHILD_TEST(TA0220_save_data_already_exists, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -423,7 +456,7 @@ RUNNER_CHILD_TEST(TA0220_save_data_already_exists)
                   Policy());
 }
 
-RUNNER_CHILD_TEST(TA0250_save_data_positive)
+RUNNER_CHILD_TEST(TA0250_save_data_positive, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -433,7 +466,7 @@ RUNNER_CHILD_TEST(TA0250_save_data_positive)
 
 
 // removeKey
-RUNNER_CHILD_TEST(TA0310_remove_alias_invalid_param)
+RUNNER_CHILD_TEST(TA0310_remove_alias_invalid_param, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -441,14 +474,14 @@ RUNNER_CHILD_TEST(TA0310_remove_alias_invalid_param)
     test_invalid_param(&ManagerAsync::removeAlias, "");
 }
 
-RUNNER_CHILD_TEST(TA0330_remove_alias_unknown_alias)
+RUNNER_CHILD_TEST(TA0330_remove_alias_unknown_alias, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
     test_negative(&ManagerAsync::removeAlias, CKM_API_ERROR_DB_ALIAS_UNKNOWN, "non-existing-alias");
 }
 
-RUNNER_CHILD_TEST(TA0350_remove_key_positive)
+RUNNER_CHILD_TEST(TA0350_remove_key_positive, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -458,7 +491,7 @@ RUNNER_CHILD_TEST(TA0350_remove_key_positive)
 }
 
 
-RUNNER_CHILD_TEST(TA0450_remove_cert_positive)
+RUNNER_CHILD_TEST(TA0450_remove_cert_positive, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -468,7 +501,7 @@ RUNNER_CHILD_TEST(TA0450_remove_cert_positive)
 }
 
 
-RUNNER_CHILD_TEST(TA0550_remove_data_positive)
+RUNNER_CHILD_TEST(TA0550_remove_data_positive, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -479,7 +512,7 @@ RUNNER_CHILD_TEST(TA0550_remove_data_positive)
 
 
 // getKey
-RUNNER_CHILD_TEST(TA0610_get_key_invalid_param)
+RUNNER_CHILD_TEST(TA0610_get_key_invalid_param, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -487,14 +520,14 @@ RUNNER_CHILD_TEST(TA0610_get_key_invalid_param)
     test_invalid_param(&ManagerAsync::getKey, "", "");
 }
 
-RUNNER_CHILD_TEST(TA0630_get_key_unknown_alias)
+RUNNER_CHILD_TEST(TA0630_get_key_unknown_alias, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
     test_negative(&ManagerAsync::getKey, CKM_API_ERROR_DB_ALIAS_UNKNOWN, "non-existing-alias", "");
 }
 
-RUNNER_CHILD_TEST(TA0640_get_key_wrong_password)
+RUNNER_CHILD_TEST(TA0640_get_key_wrong_password, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -506,7 +539,7 @@ RUNNER_CHILD_TEST(TA0640_get_key_wrong_password)
                   "wrong-password");
 }
 
-RUNNER_CHILD_TEST(TA0650_get_key_positive)
+RUNNER_CHILD_TEST(TA0650_get_key_positive, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -517,7 +550,7 @@ RUNNER_CHILD_TEST(TA0650_get_key_positive)
 
 
 // getCertificate
-RUNNER_CHILD_TEST(TA0710_get_cert_invalid_param)
+RUNNER_CHILD_TEST(TA0710_get_cert_invalid_param, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -525,7 +558,7 @@ RUNNER_CHILD_TEST(TA0710_get_cert_invalid_param)
     test_invalid_param(&ManagerAsync::getCertificate, "", "");
 }
 
-RUNNER_CHILD_TEST(TA0730_get_cert_unknown_alias)
+RUNNER_CHILD_TEST(TA0730_get_cert_unknown_alias, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -535,7 +568,7 @@ RUNNER_CHILD_TEST(TA0730_get_cert_unknown_alias)
                   "");
 }
 
-RUNNER_CHILD_TEST(TA0740_get_cert_wrong_password)
+RUNNER_CHILD_TEST(TA0740_get_cert_wrong_password, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -550,7 +583,7 @@ RUNNER_CHILD_TEST(TA0740_get_cert_wrong_password)
                   "wrong-password");
 }
 
-RUNNER_CHILD_TEST(TA0750_get_cert_positive)
+RUNNER_CHILD_TEST(TA0750_get_cert_positive, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -561,7 +594,7 @@ RUNNER_CHILD_TEST(TA0750_get_cert_positive)
 
 
 // getData
-RUNNER_CHILD_TEST(TA0810_get_data_invalid_param)
+RUNNER_CHILD_TEST(TA0810_get_data_invalid_param, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -569,14 +602,14 @@ RUNNER_CHILD_TEST(TA0810_get_data_invalid_param)
     test_invalid_param(&ManagerAsync::getData, "", "");
 }
 
-RUNNER_CHILD_TEST(TA0830_get_data_unknown_alias)
+RUNNER_CHILD_TEST(TA0830_get_data_unknown_alias, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
     test_negative(&ManagerAsync::getData, CKM_API_ERROR_DB_ALIAS_UNKNOWN, "non-existing-alias", "");
 }
 
-RUNNER_CHILD_TEST(TA0840_get_data_wrong_password)
+RUNNER_CHILD_TEST(TA0840_get_data_wrong_password, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -588,7 +621,7 @@ RUNNER_CHILD_TEST(TA0840_get_data_wrong_password)
                   "wrong-password");
 }
 
-RUNNER_CHILD_TEST(TA0850_get_data_positive)
+RUNNER_CHILD_TEST(TA0850_get_data_positive, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -599,14 +632,14 @@ RUNNER_CHILD_TEST(TA0850_get_data_positive)
 
 
 // getKeyAliasVector
-RUNNER_CHILD_TEST(TA0910_get_key_alias_vector_invalid_param)
+RUNNER_CHILD_TEST(TA0910_get_key_alias_vector_invalid_param, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
     test_no_observer(&ManagerAsync::getKeyAliasVector);
 }
 
-RUNNER_CHILD_TEST(TA0950_get_key_alias_vector_positive)
+RUNNER_CHILD_TEST(TA0950_get_key_alias_vector_positive, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -624,14 +657,14 @@ RUNNER_CHILD_TEST(TA0950_get_key_alias_vector_positive)
 
 
 // getCertificateAliasVector
-RUNNER_CHILD_TEST(TA1010_get_cert_alias_vector_invalid_param)
+RUNNER_CHILD_TEST(TA1010_get_cert_alias_vector_invalid_param, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
     test_no_observer(&ManagerAsync::getCertificateAliasVector);
 }
 
-RUNNER_CHILD_TEST(TA1050_get_cert_alias_vector_positive)
+RUNNER_CHILD_TEST(TA1050_get_cert_alias_vector_positive, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -649,14 +682,14 @@ RUNNER_CHILD_TEST(TA1050_get_cert_alias_vector_positive)
 
 
 // getDataAliasVector
-RUNNER_CHILD_TEST(TA1110_get_data_alias_vector_invalid_param)
+RUNNER_CHILD_TEST(TA1110_get_data_alias_vector_invalid_param, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
     test_no_observer(&ManagerAsync::getDataAliasVector);
 }
 
-RUNNER_CHILD_TEST(TA1150_get_data_alias_vector_positive)
+RUNNER_CHILD_TEST(TA1150_get_data_alias_vector_positive, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -674,7 +707,7 @@ RUNNER_CHILD_TEST(TA1150_get_data_alias_vector_positive)
 
 
 // createKeyPairRSA
-RUNNER_CHILD_TEST(TA1210_create_key_pair_rsa_invalid_param)
+RUNNER_CHILD_TEST(TA1210_create_key_pair_rsa_invalid_param, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -686,7 +719,7 @@ RUNNER_CHILD_TEST(TA1210_create_key_pair_rsa_invalid_param)
                      Policy());
 }
 
-RUNNER_CHILD_TEST(TA1220_create_key_pair_rsa_already_exists)
+RUNNER_CHILD_TEST(TA1220_create_key_pair_rsa_already_exists, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -701,7 +734,7 @@ RUNNER_CHILD_TEST(TA1220_create_key_pair_rsa_already_exists)
                   Policy());
 }
 
-RUNNER_CHILD_TEST(TA1250_create_key_pair_rsa_positive)
+RUNNER_CHILD_TEST(TA1250_create_key_pair_rsa_positive, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -718,7 +751,7 @@ RUNNER_CHILD_TEST(TA1250_create_key_pair_rsa_positive)
 }
 
 // createKeyPairDSA
-RUNNER_CHILD_TEST(TA1270_create_key_pair_dsa_invalid_param)
+RUNNER_CHILD_TEST(TA1270_create_key_pair_dsa_invalid_param, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -730,7 +763,7 @@ RUNNER_CHILD_TEST(TA1270_create_key_pair_dsa_invalid_param)
                      Policy());
 }
 
-RUNNER_CHILD_TEST(TA1280_create_key_pair_dsa_already_exists)
+RUNNER_CHILD_TEST(TA1280_create_key_pair_dsa_already_exists, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -745,7 +778,7 @@ RUNNER_CHILD_TEST(TA1280_create_key_pair_dsa_already_exists)
                   Policy());
 }
 
-RUNNER_CHILD_TEST(TA1290_create_key_pair_dsa_positive)
+RUNNER_CHILD_TEST(TA1290_create_key_pair_dsa_positive, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -762,7 +795,7 @@ RUNNER_CHILD_TEST(TA1290_create_key_pair_dsa_positive)
 }
 
 // createKeyPairECDSA
-RUNNER_CHILD_TEST(TA1310_create_key_pair_ecdsa_invalid_param)
+RUNNER_CHILD_TEST(TA1310_create_key_pair_ecdsa_invalid_param, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -774,7 +807,7 @@ RUNNER_CHILD_TEST(TA1310_create_key_pair_ecdsa_invalid_param)
                      Policy());
 }
 
-RUNNER_CHILD_TEST(TA1320_create_key_pair_ecdsa_already_exists)
+RUNNER_CHILD_TEST(TA1320_create_key_pair_ecdsa_already_exists, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -789,7 +822,7 @@ RUNNER_CHILD_TEST(TA1320_create_key_pair_ecdsa_already_exists)
                   Policy());
 }
 
-RUNNER_CHILD_TEST(TA1350_create_key_pair_ecdsa_positive)
+RUNNER_CHILD_TEST(TA1350_create_key_pair_ecdsa_positive, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -807,7 +840,7 @@ RUNNER_CHILD_TEST(TA1350_create_key_pair_ecdsa_positive)
 
 
 // getCertificateChain
-RUNNER_CHILD_TEST(TA1410_get_certificate_chain_invalid_param)
+RUNNER_CHILD_TEST(TA1410_get_certificate_chain_invalid_param, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -838,7 +871,7 @@ RUNNER_CHILD_TEST(TA1410_get_certificate_chain_invalid_param)
                                      true);
 }
 
-RUNNER_CHILD_TEST(TA1420_get_certificate_chain_negative)
+RUNNER_CHILD_TEST(TA1420_get_certificate_chain_negative, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -873,7 +906,7 @@ RUNNER_CHILD_TEST(TA1420_get_certificate_chain_negative)
                                 true);
 }
 
-RUNNER_CHILD_TEST(TA1450_get_certificate_chain_positive)
+RUNNER_CHILD_TEST(TA1450_get_certificate_chain_positive, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -899,7 +932,7 @@ RUNNER_CHILD_TEST(TA1450_get_certificate_chain_positive)
 
 
 // createSignature
-RUNNER_CHILD_TEST(TA1510_create_signature_invalid_param)
+RUNNER_CHILD_TEST(TA1510_create_signature_invalid_param, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -923,7 +956,7 @@ RUNNER_CHILD_TEST(TA1510_create_signature_invalid_param)
                        RSAPaddingAlgorithm::PKCS1);
 }
 
-RUNNER_CHILD_TEST(TA1520_create_signature_invalid_password)
+RUNNER_CHILD_TEST(TA1520_create_signature_invalid_password, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -938,7 +971,7 @@ RUNNER_CHILD_TEST(TA1520_create_signature_invalid_password)
                   RSAPaddingAlgorithm::PKCS1);
 }
 
-RUNNER_CHILD_TEST(TA1550_create_signature_positive)
+RUNNER_CHILD_TEST(TA1550_create_signature_positive, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -954,7 +987,7 @@ RUNNER_CHILD_TEST(TA1550_create_signature_positive)
 
 
 // verifySignature
-RUNNER_CHILD_TEST(TA1610_verify_signature_invalid_param)
+RUNNER_CHILD_TEST(TA1610_verify_signature_invalid_param, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -974,7 +1007,7 @@ RUNNER_CHILD_TEST(TA1610_verify_signature_invalid_param)
                        RSAPaddingAlgorithm::PKCS1);
 }
 
-RUNNER_CHILD_TEST(TA1620_verify_signature_invalid_password)
+RUNNER_CHILD_TEST(TA1620_verify_signature_invalid_password, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -998,7 +1031,7 @@ RUNNER_CHILD_TEST(TA1620_verify_signature_invalid_password)
                   RSAPaddingAlgorithm::PKCS1);
 }
 
-RUNNER_CHILD_TEST(TA1630_verify_signature_invalid_message)
+RUNNER_CHILD_TEST(TA1630_verify_signature_invalid_message, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -1023,7 +1056,7 @@ RUNNER_CHILD_TEST(TA1630_verify_signature_invalid_message)
                   RSAPaddingAlgorithm::PKCS1);
 }
 
-RUNNER_CHILD_TEST(TA1640_verify_signature_invalid_signature)
+RUNNER_CHILD_TEST(TA1640_verify_signature_invalid_signature, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -1040,7 +1073,7 @@ RUNNER_CHILD_TEST(TA1640_verify_signature_invalid_signature)
                   RSAPaddingAlgorithm::PKCS1);
 }
 
-RUNNER_CHILD_TEST(TA1650_verify_signature_wrong_key)
+RUNNER_CHILD_TEST(TA1650_verify_signature_wrong_key, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -1063,7 +1096,7 @@ RUNNER_CHILD_TEST(TA1650_verify_signature_wrong_key)
                   RSAPaddingAlgorithm::PKCS1);
 }
 
-RUNNER_CHILD_TEST(TA1660_verify_signature_positive)
+RUNNER_CHILD_TEST(TA1660_verify_signature_positive, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -1088,13 +1121,13 @@ RUNNER_CHILD_TEST(TA1660_verify_signature_positive)
 
 
 // ocspCheck
-RUNNER_CHILD_TEST(TA1710_ocsp_check_invalid_param)
+RUNNER_CHILD_TEST(TA1710_ocsp_check_invalid_param, CKMAsyncAPIEnv)
 {
     test_no_observer(&ManagerAsync::ocspCheck, EMPTY_CERT_VECTOR);
     test_invalid_param(&ManagerAsync::ocspCheck, EMPTY_CERT_VECTOR);
 }
 
-RUNNER_CHILD_TEST(TA1720_ocsp_check_negative)
+RUNNER_CHILD_TEST(TA1720_ocsp_check_negative, CKMAsyncAPIEnv)
 {
     switch_to_storage_ocsp_user(TEST_LABEL);
 
@@ -1106,7 +1139,7 @@ RUNNER_CHILD_TEST(TA1720_ocsp_check_negative)
                          "Verification should fail. Got: " << obs->m_ocspStatus);
 }
 
-RUNNER_CHILD_TEST(TA1750_ocsp_check_positive)
+RUNNER_CHILD_TEST(TA1750_ocsp_check_positive, CKMAsyncAPIEnv)
 {
     switch_to_storage_ocsp_user(TEST_LABEL);
 
@@ -1125,7 +1158,7 @@ RUNNER_CHILD_TEST(TA1750_ocsp_check_positive)
 }
 
 // setPermission
-RUNNER_CHILD_TEST(TA1810_allow_access_invalid_param)
+RUNNER_CHILD_TEST(TA1810_allow_access_invalid_param, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -1134,7 +1167,7 @@ RUNNER_CHILD_TEST(TA1810_allow_access_invalid_param)
     test_invalid_param(&ManagerAsync::setPermission, "alias", "", CKM::Permission::READ | CKM::Permission::REMOVE);
 }
 
-RUNNER_TEST(TA1820_allow_access)
+RUNNER_TEST(TA1820_allow_access, CKMAsyncAPIEnv)
 {
     DBCleanup dbc;
     CharPtr top_label = get_label();
@@ -1171,7 +1204,7 @@ RUNNER_TEST(TA1820_allow_access)
 }
 
 // denyAccess
-RUNNER_CHILD_TEST(TA1910_deny_access_invalid_param)
+RUNNER_CHILD_TEST(TA1910_deny_access_invalid_param, CKMAsyncAPIEnv)
 {
     switch_to_storage_user(TEST_LABEL);
 
@@ -1180,7 +1213,7 @@ RUNNER_CHILD_TEST(TA1910_deny_access_invalid_param)
     test_invalid_param(&ManagerAsync::setPermission, "alias", "", CKM::Permission::NONE);
 }
 
-RUNNER_TEST(TA1920_deny_access)
+RUNNER_TEST(TA1920_deny_access, CKMAsyncAPIEnv)
 {
     DBCleanup dbc;
     CharPtr top_label = get_label();
@@ -1200,76 +1233,60 @@ RUNNER_TEST(TA1920_deny_access)
     }
 }
 
-namespace
-{
-CKM::Alias alias_PKCS_exportable = "async-test-PKCS-export";
-CKM::Alias alias_PKCS_not_exportable = "async-test-PKCS-no-export";
-}
-
-RUNNER_TEST(TA2000_PKCS_add_bundle_with_chain_certs)
+RUNNER_TEST(TA2000_PKCS_add_bundle_with_chain_certs, CKMAsyncAPIEnv)
 {
     DBCleanup dbc;
-    auto manager = CKM::Manager::create();
-    std::ifstream is("/usr/share/ckm-test/pkcs.p12");
-    std::istreambuf_iterator<char> begin(is), end;
-    std::vector<char> buff(begin, end);
-
-    CKM::RawBuffer buffer(buff.size());
-    memcpy(buffer.data(), buff.data(), buff.size());
-
-    auto pkcs = CKM::PKCS12::create(buffer, CKM::Password());
-    RUNNER_ASSERT_MSG(
-        NULL != pkcs.get(),
-        "Error in PKCS12::create()");
-
-    auto cert = pkcs->getCertificate();
-    RUNNER_ASSERT_MSG(
-        NULL != cert.get(),
-        "Error in PKCS12::getCertificate()");
-
-    auto key = pkcs->getKey();
-    RUNNER_ASSERT_MSG(
-        NULL != key.get(),
-        "Error in PKCS12::getKey()");
-
-    auto caVector = pkcs->getCaCertificateShPtrVector();
-    RUNNER_ASSERT_MSG(
-        2 == caVector.size(),
-        "Wrong size of vector");
+    auto pkcs = loadPkcs();
 
     // save to the CKM
     CKM::Policy exportable;
     CKM::Policy notExportable(CKM::Password(), false);
 
     test_positive(&ManagerAsync::savePKCS12,
-                  alias_PKCS_exportable,
+                  dbc.alias(alias_PKCS_exportable.c_str()),
                   pkcs,
                   exportable,
                   exportable);
     test_negative(&ManagerAsync::savePKCS12,
                   CKM_API_ERROR_DB_ALIAS_EXISTS,
-                  alias_PKCS_exportable,
+                  dbc.alias(alias_PKCS_exportable.c_str()),
                   pkcs,
                   exportable,
                   exportable);
 
     test_positive(&ManagerAsync::savePKCS12,
-                  alias_PKCS_not_exportable,
+                  dbc.alias(alias_PKCS_not_exportable.c_str()),
                   pkcs,
                   notExportable,
                   notExportable);
     test_negative(&ManagerAsync::savePKCS12,
                   CKM_API_ERROR_DB_ALIAS_EXISTS,
-                  alias_PKCS_not_exportable,
+                  dbc.alias(alias_PKCS_not_exportable.c_str()),
                   pkcs,
                   notExportable,
                   notExportable);
 }
 
-RUNNER_TEST(TA2010_PKCS_get)
+RUNNER_TEST(TA2010_PKCS_get, CKMAsyncAPIEnv)
 {
     DBCleanup dbc;
-    auto manager = CKM::Manager::create();
+
+    auto pkcs = loadPkcs();
+
+    // save to the CKM
+    CKM::Policy exportable;
+    CKM::Policy notExportable(CKM::Password(), false);
+
+    test_positive(&ManagerAsync::savePKCS12,
+                  dbc.alias(alias_PKCS_exportable.c_str()),
+                  pkcs,
+                  exportable,
+                  exportable);
+    test_positive(&ManagerAsync::savePKCS12,
+                  dbc.alias(alias_PKCS_not_exportable.c_str()),
+                  pkcs,
+                  notExportable,
+                  notExportable);
 
     // fail - no entry
     test_negative(&ManagerAsync::getPKCS12,
@@ -1307,18 +1324,3 @@ RUNNER_TEST(TA2010_PKCS_get)
         2 == caVector.size(),
         "Wrong size of vector");
 }
-
-RUNNER_TEST(TA9999_deinit)
-{
-    int temp;
-    ControlShPtr control = Control::create();
-    RUNNER_ASSERT_MSG(CKM_API_SUCCESS == (temp = control->lockUserKey(APP_UID)),
-                         "Error=" << ErrorToString(temp));
-    RUNNER_ASSERT_MSG(CKM_API_SUCCESS == (temp = control->removeUserData(APP_UID)),
-                         "Error=" << ErrorToString(temp));
-
-    RUNNER_ASSERT_MSG(CKM_API_SUCCESS == (temp = control->lockUserKey(0)),
-                         "Error=" << ErrorToString(temp));
-    RUNNER_ASSERT_MSG(CKM_API_SUCCESS == (temp = control->removeUserData(0)),
-                         "Error=" << ErrorToString(temp));
-}
index b985503..6d8b7d0 100644 (file)
@@ -671,6 +671,8 @@ RUNNER_TEST(T3106_control_allow_access_to_myself)
 // tries to use admin API as a user
 RUNNER_CHILD_TEST(T3110_control_allow_access_as_user)
 {
+    RUNNER_IGNORED_MSG("Disabled until labeled sockets not available");
+
     switch_to_storage_user(TEST_LABEL);
     int ret = ckmc_set_permission_by_adm(USER_ROOT, aliasWithLabel("owner", "alias").c_str(), "accessor", CKMC_PERMISSION_READ);
     RUNNER_ASSERT_MSG(CKMC_ERROR_PERMISSION_DENIED == ret,
@@ -680,6 +682,8 @@ RUNNER_CHILD_TEST(T3110_control_allow_access_as_user)
 // tries to use admin API as a user
 RUNNER_CHILD_TEST(T3111_control_allow_access_as_user)
 {
+    RUNNER_IGNORED_MSG("Disabled until labeled sockets not available");
+
     switch_to_storage_user(TEST_LABEL);
     int ret = ckmc_set_permission_by_adm(USER_ROOT, aliasWithLabel("owner", "alias").c_str(), "accessor", CKMC_PERMISSION_NONE);
     RUNNER_ASSERT_MSG(CKMC_ERROR_PERMISSION_DENIED == ret,
index 2668247..9c41077 100644 (file)
@@ -1221,6 +1221,7 @@ RUNNER_TEST(T1311_init)
     RUNNER_ASSERT_MSG(time(0) > 1405343457,
         "Time error. Device date is before 14th of July 2014. You must set proper time on device before run this tests!");
 
+    ScopedLabel sl("System");
     struct hostent* he = gethostbyname("google.com");
 
     RUNNER_ASSERT_MSG(he != NULL, "There is problem with translate domain google.com into ip address. Probably network "
@@ -2311,52 +2312,57 @@ RUNNER_TEST(T14189_deinit)
 
 RUNNER_TEST_GROUP_INIT(T151_CKM_STORAGE_PERNAMENT_TESTS);
 
+namespace {
+CKM::Alias certeeAlias("CertEE");
+CKM::Alias certimAlias("CertIM");
+}
 RUNNER_CHILD_TEST(T1510_init_unlock_key)
 {
-    int tmp;
+    reset_user_data(USER_TEST, "strong-password");
+
+    // initial DB feed
     AccessProvider ap("my-label");
-    ap.allowAPI("key-manager::api-control", "rw");
+    ap.allowAPI("key-manager::api-storage", "rw");
     ap.applyAndSwithToUser(USER_TEST, GROUP_APP);
 
-    auto control = CKM::Control::create();
-    RUNNER_ASSERT_MSG(
-        CKM_API_SUCCESS == (tmp = control->unlockUserKey(USER_TEST, "strong-password")),
-        "Error=" << CKM::ErrorToString(tmp));
+    auto manager = CKM::Manager::create();
+    auto certee = TestData::getTestCertificate(TestData::MBANK);
+    auto certim = TestData::getTestCertificate(TestData::SYMANTEC);
+    RUNNER_ASSERT(CKM_API_SUCCESS == manager->saveCertificate(certeeAlias, certee, CKM::Policy()));
+    RUNNER_ASSERT(CKM_API_SUCCESS == manager->saveCertificate(certimAlias, certim, CKM::Policy()));
+}
+
+RUNNER_TEST(T1511_restart_CKM)
+{
+    // restart CKM
+    stop_service(MANAGER);
+    start_service(MANAGER);
+    unlock_user_data(USER_TEST, "strong-password");
 }
 
-RUNNER_CHILD_TEST(T1511_insert_data)
+RUNNER_CHILD_TEST(T1512_check_data_exists)
 {
+    // actual test
     AccessProvider ap("my-label");
     ap.allowAPI("key-manager::api-storage", "rw");
     ap.applyAndSwithToUser(USER_TEST, GROUP_APP);
 
+    auto manager = CKM::Manager::create();
     auto certee = TestData::getTestCertificate(TestData::MBANK);
     auto certim = TestData::getTestCertificate(TestData::SYMANTEC);
-
-    auto manager = CKM::Manager::create();
-    int status1 = manager->saveCertificate(CKM::Alias("CertEE"), certee, CKM::Policy());
-    int status2 = manager->saveCertificate(CKM::Alias("CertIM"), certim, CKM::Policy());
-
+    int status1 = manager->saveCertificate(certeeAlias, certee, CKM::Policy());
+    int status2 = manager->saveCertificate(certimAlias, certim, CKM::Policy());
     RUNNER_ASSERT_MSG(
         CKM_API_ERROR_DB_ALIAS_EXISTS == status1,
         "Certificate should be in database already. Error=" << CKM::ErrorToString(status1));
-
     RUNNER_ASSERT_MSG(
         CKM_API_ERROR_DB_ALIAS_EXISTS == status2,
         "Certificate should be in database already. Error=" << CKM::ErrorToString(status2));
 }
 
-RUNNER_CHILD_TEST(T1519_deinit)
+RUNNER_TEST(T1519_deinit)
 {
-    int tmp;
-    AccessProvider ap("my-label");
-    ap.allowAPI("key-manager::api-control", "rw");
-    ap.applyAndSwithToUser(USER_APP, GROUP_APP);
-
-    auto control = CKM::Control::create();
-    RUNNER_ASSERT_MSG(
-        CKM_API_SUCCESS == (tmp = control->lockUserKey(USER_TEST)),
-        "Error=" << CKM::ErrorToString(tmp));
+    remove_user_data(USER_TEST);
 }
 
 
index 0c615e0..0cbea40 100644 (file)
@@ -281,18 +281,18 @@ CertMap initializeTestCerts()
         cm[TestData::EQUIFAX] = std::make_pair(raw_base64, createCert(raw_base64));
     }
 
-    // GOOGLE_COM, *.google.com - signed by GIAG2, expires 12 May 2015
+    // GOOGLE_COM, *.google.com - signed by GIAG2, expires 21 Jul 2015
     {
         std::string raw_base64 = std::string(
             "-----BEGIN CERTIFICATE-----\n"
-            "MIIGxTCCBa2gAwIBAgIIBIsVw6gw3hgwDQYJKoZIhvcNAQEFBQAwSTELMAkGA1UE\n"
+            "MIIGxTCCBa2gAwIBAgIIF4oWRtoEsZgwDQYJKoZIhvcNAQEFBQAwSTELMAkGA1UE\n"
             "BhMCVVMxEzARBgNVBAoTCkdvb2dsZSBJbmMxJTAjBgNVBAMTHEdvb2dsZSBJbnRl\n"
-            "cm5ldCBBdXRob3JpdHkgRzIwHhcNMTUwMjExMTI0NzAyWhcNMTUwNTEyMDAwMDAw\n"
+            "cm5ldCBBdXRob3JpdHkgRzIwHhcNMTUwNDIyMTM0NzM5WhcNMTUwNzIxMDAwMDAw\n"
             "WjBmMQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwN\n"
             "TW91bnRhaW4gVmlldzETMBEGA1UECgwKR29vZ2xlIEluYzEVMBMGA1UEAwwMKi5n\n"
-            "b29nbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEmokK6sw/osw7yrkc\n"
-            "rSJZk5FAod6yrCptxyq7AssrJbcTCpuxGbG9Ip6/jR8QP4109kZxadoaZ/0ICOh5\n"
-            "bHx44qOCBF0wggRZMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjCCAyYG\n"
+            "b29nbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEeI/HfDmnVdpQ4JNA\n"
+            "9z7aYLzV30SZp0EFfrC5iV4l4AVNRfnCjOdYrdx387n9mhVPghWVWDkb05JtRZqr\n"
+            "9vgwMqOCBF0wggRZMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjCCAyYG\n"
             "A1UdEQSCAx0wggMZggwqLmdvb2dsZS5jb22CDSouYW5kcm9pZC5jb22CFiouYXBw\n"
             "ZW5naW5lLmdvb2dsZS5jb22CEiouY2xvdWQuZ29vZ2xlLmNvbYIWKi5nb29nbGUt\n"
             "YW5hbHl0aWNzLmNvbYILKi5nb29nbGUuY2GCCyouZ29vZ2xlLmNsgg4qLmdvb2ds\n"
@@ -312,16 +312,16 @@ CertMap initializeTestCerts()
             "YmWCC3lvdXR1YmUuY29tghR5b3V0dWJlZWR1Y2F0aW9uLmNvbTALBgNVHQ8EBAMC\n"
             "B4AwaAYIKwYBBQUHAQEEXDBaMCsGCCsGAQUFBzAChh9odHRwOi8vcGtpLmdvb2ds\n"
             "ZS5jb20vR0lBRzIuY3J0MCsGCCsGAQUFBzABhh9odHRwOi8vY2xpZW50czEuZ29v\n"
-            "Z2xlLmNvbS9vY3NwMB0GA1UdDgQWBBShZRhQFOqlCCt51oEJBD94sL7K4zAMBgNV\n"
+            "Z2xlLmNvbS9vY3NwMB0GA1UdDgQWBBTgUFAZJ8fMjqEj8KpwMspvje7cSzAMBgNV\n"
             "HRMBAf8EAjAAMB8GA1UdIwQYMBaAFErdBhYbvPZotXb1gba7Yhq6WoEvMBcGA1Ud\n"
             "IAQQMA4wDAYKKwYBBAHWeQIFATAwBgNVHR8EKTAnMCWgI6Ahhh9odHRwOi8vcGtp\n"
-            "Lmdvb2dsZS5jb20vR0lBRzIuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQBOQBrolcUp\n"
-            "UFh/5O369pXbuxDZajpSKAjX4Zu6L5LxS9NQRuWqheWNsNcZMRzZ6dP6xpeqf522\n"
-            "zUjzUEzDCOaxCbccakucnXUvg3/m5qgYhxUmLdZjXZ53mTCy4tHbswQrwnxZH+t+\n"
-            "Y4rlJFr4bzPNPx7ucB7wRvxFGCjWXflK1JpgXmUcjFFu8/xrlqJdCwmrjEOJaVRq\n"
-            "urh11t2o4N/DjdboKWBdv+reuijPjzJTKmTbjuZU/bty6COIqtu8vWD39xRCK2y+\n"
-            "W6und7oGKIEvisrLIoHRRgBPfiFBxuzLbvOg/mGbz34pSuBJEzMxrAbkOnGWEQOm\n"
-            "B3KPgoV0lPFo\n"
+            "Lmdvb2dsZS5jb20vR0lBRzIuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQA2YKaE9hJu\n"
+            "96a81VC53Qrk1JbhMeVRL+uLsidRNK2uBCzJs4zkKT8QTp2m0w792djprAMDuzKx\n"
+            "GUaVj9TyAX5b1ObcRh2cvom1bzakjWpr1sLW+71vPIeRK8XZvbkVpvgbUF5pQFda\n"
+            "xZmS49iTG4+8yH6jSnlC/GLSFBihIYmKhU4HSOvzhRBbMNc6ldfvyomE0DtGJXDs\n"
+            "qOQqfwpyUopGZIIiETLw3PQrdrXSxhoTaVdvL0V9+SGS4Dp7D+WsNl23a7nhxUv3\n"
+            "PSl6FTRcANKzXflSpdbu9BsuD78KQNnK2cl0mlcE8PETflMFjogi7OhEEQitwp3S\n"
+            "043LZ7LBy0m5\n"
             "-----END CERTIFICATE-----\n");
         cm[TestData::GOOGLE_COM] = std::make_pair(raw_base64, createCert(raw_base64));
     }
index f920eaf..7f55b7d 100644 (file)
@@ -39,7 +39,7 @@ enum certificateID {
     SYMANTEC,                       // SYMANTEC, signed by VERISIGN, expires 30 Oct 2023
     GEOTRUST,                       // GEOTRUST, GeoTrust Global CA - signed by EQUIFAX, expires 21 Aug 2018
     EQUIFAX,                        // EQUIFAX (root CA), expires 22 Aug 2018
-    GOOGLE_COM,                     // GOOGLE_COM, *.google.com - signed by GIAG2, expires 12 May 2015
+    GOOGLE_COM,                     // GOOGLE_COM, *.google.com - signed by GIAG2, expires 21 Jul 2015
 
     // footer - last element in the set
     NO_CERT
index ac398f0..0cca754 100644 (file)
 #define _TESTS_COMMON_H_
 
 #include <sys/smack.h>
+#include <dpl/test/test_case_extended.h>
 #include <dpl/test/test_runner.h>
 #include <dpl/test/test_runner_child.h>
 #include <dpl/test/test_runner_multiprocess.h>
 #include <privilege-control.h>
 #include <sys/smack.h>
 #include <string>
+#include <tuple>
 #include <errno.h>
 #include <string.h>
 
@@ -53,89 +55,94 @@ void creatSafe(const std::string &path, mode_t mode);
 void symlinkSafe(const std::string &targetPath, const std::string &linkPath);
 void removeDir(const std::string &path);
 
-#define RUNNER_TEST_SMACK(Proc)                                                     \
-    void Proc();                                                                    \
-    static int Static##Proc##Init()                                                 \
-    {                                                                               \
-        if(smack_check())                                                           \
-            DPL::Test::TestRunnerSingleton::Instance().RegisterTest(#Proc, &Proc);  \
-                                                                                    \
-        return 0;                                                                   \
-    }                                                                               \
-    const int DPL_UNUSED Static##Proc##InitVar = Static##Proc##Init();              \
-    void Proc()
-
-#define RUNNER_TEST_NOSMACK(Proc)                                                   \
-    void Proc();                                                                    \
-    static int Static##Proc##Init()                                                 \
-    {                                                                               \
-        if(!(smack_check()))                                                        \
-            DPL::Test::TestRunnerSingleton::Instance().RegisterTest(#Proc, &Proc);  \
-                                                                                    \
-        return 0;                                                                   \
-    }                                                                               \
-    const int DPL_UNUSED Static##Proc##InitVar = Static##Proc##Init();              \
-    void Proc()
-
-#define RUNNER_CHILD_TEST_SMACK(Proc)                                                \
-    void Proc();                                                                     \
-    void Proc##Child();                                                              \
-    static int Static##Proc##Init()                                                  \
-    {                                                                                \
-        if(smack_check())                                                            \
-            DPL::Test::TestRunnerSingleton::Instance().RegisterTest(#Proc, &Proc);   \
-        return 0;                                                                    \
-    }                                                                                \
-    const int DPL_UNUSED Static##Proc##InitVar = Static##Proc##Init();               \
-    void Proc(){                                                                     \
-            DPL::Test::RunChildProc(&Proc##Child);                                   \
-    }                                                                                \
-    void Proc##Child()
-
-#define RUNNER_CHILD_TEST_NOSMACK(Proc)                                              \
-    void Proc();                                                                     \
-    void Proc##Child();                                                              \
-    static int Static##Proc##Init()                                                  \
-    {                                                                                \
-        if(!(smack_check()))                                                         \
-            DPL::Test::TestRunnerSingleton::Instance().RegisterTest(#Proc, &Proc);   \
-        return 0;                                                                    \
-    }                                                                                \
-    const int DPL_UNUSED Static##Proc##InitVar = Static##Proc##Init();               \
-    void Proc(){                                                                     \
-            DPL::Test::RunChildProc(&Proc##Child);                                   \
-    }                                                                                \
-    void Proc##Child()
-
-#define RUNNER_MULTIPROCESS_TEST_SMACK(Proc)                                         \
-    void Proc();                                                                     \
-    void Proc##Multi();                                                              \
-    static int Static##Proc##Init()                                                  \
-    {                                                                                \
-        if(smack_check())                                                            \
-            DPL::Test::TestRunnerSingleton::Instance().RegisterTest(#Proc, &Proc);   \
-        return 0;                                                                    \
-    }                                                                                \
-    const int DPL_UNUSED Static##Proc##InitVar = Static##Proc##Init();               \
-    void Proc(){                                                                     \
-            DPL::Test::RunMultiProc(&Proc##Multi);                                   \
-    }                                                                                \
-    void Proc##Multi()
-
-#define RUNNER_MULTIPROCESS_TEST_NOSMACK(Proc)                                       \
-    void Proc();                                                                     \
-    void Proc##Multi();                                                              \
-    static int Static##Proc##Init()                                                  \
-    {                                                                                \
-        if(!(smack_check()))                                                         \
-            DPL::Test::TestRunnerSingleton::Instance().RegisterTest(#Proc, &Proc);   \
-        return 0;                                                                    \
-    }                                                                                \
-    const int DPL_UNUSED Static##Proc##InitVar = Static##Proc##Init();               \
-    void Proc(){                                                                     \
-            DPL::Test::RunMultiProc(&Proc##Multi);                                   \
-    }                                                                                \
-    void Proc##Multi()
+
+#define RUNNER_TEST_SMACK(Proc, ...)                                                        \
+    void Proc(std::tuple<__VA_ARGS__> &optionalArgsTuple);                                  \
+    static int Static##Proc##Init()                                                         \
+    {                                                                                       \
+        if (smack_check())                                                                  \
+            DPL::Test::TestRunnerSingleton::Instance().RegisterTest(                        \
+                new DPL::Test::TestCaseExtended<__VA_ARGS__>(#Proc, &Proc));                \
+        return 0;                                                                           \
+    }                                                                                       \
+    const int DPL_UNUSED Static##Proc##InitVar = Static##Proc##Init();                      \
+    void Proc(std::tuple<__VA_ARGS__> &optionalArgsTuple DPL_UNUSED)
+
+#define RUNNER_TEST_NOSMACK(Proc, ...)                                                      \
+    void Proc(std::tuple<__VA_ARGS__> &optionalArgsTuple);                                  \
+    static int Static##Proc##Init()                                                         \
+    {                                                                                       \
+        if (!smack_check())                                                                 \
+            DPL::Test::TestRunnerSingleton::Instance().RegisterTest(                        \
+                new DPL::Test::TestCaseExtended<__VA_ARGS__>(#Proc, &Proc));                \
+        return 0;                                                                           \
+    }                                                                                       \
+    const int DPL_UNUSED Static##Proc##InitVar = Static##Proc##Init();                      \
+    void Proc(std::tuple<__VA_ARGS__> &optionalArgsTuple DPL_UNUSED)
+
+#define RUNNER_CHILD_TEST_SMACK(Proc, ...)                                                  \
+    void Proc(std::tuple<__VA_ARGS__> &optionalArgsTuple);                                  \
+    void Proc##Child(std::tuple<__VA_ARGS__> &optionalArgsTuple);                           \
+    static int Static##Proc##Init()                                                         \
+    {                                                                                       \
+        if (smack_check())                                                                  \
+            DPL::Test::TestRunnerSingleton::Instance().RegisterTest(                        \
+                new DPL::Test::TestCaseExtended<__VA_ARGS__>(#Proc, &Proc));                \
+        return 0;                                                                           \
+    }                                                                                       \
+    const int DPL_UNUSED Static##Proc##InitVar = Static##Proc##Init();                      \
+    void Proc(std::tuple<__VA_ARGS__> &optionalArgsTuple) {                                 \
+        DPL::Test::RunChildProc(std::bind(Proc##Child, optionalArgsTuple));                 \
+    }                                                                                       \
+    void Proc##Child(std::tuple<__VA_ARGS__> &optionalArgsTuple DPL_UNUSED)
+
+#define RUNNER_CHILD_TEST_NOSMACK(Proc, ...)                                                \
+    void Proc(std::tuple<__VA_ARGS__> &optionalArgsTuple);                                  \
+    void Proc##Child(std::tuple<__VA_ARGS__> &optionalArgsTuple);                           \
+    static int Static##Proc##Init()                                                         \
+    {                                                                                       \
+        if (!smack_check())                                                                 \
+            DPL::Test::TestRunnerSingleton::Instance().RegisterTest(                        \
+                new DPL::Test::TestCaseExtended<__VA_ARGS__>(#Proc, &Proc));                \
+        return 0;                                                                           \
+    }                                                                                       \
+    const int DPL_UNUSED Static##Proc##InitVar = Static##Proc##Init();                      \
+    void Proc(std::tuple<__VA_ARGS__> &optionalArgsTuple) {                                 \
+        DPL::Test::RunChildProc(std::bind(Proc##Child, optionalArgsTuple));                 \
+    }                                                                                       \
+    void Proc##Child(std::tuple<__VA_ARGS__> &optionalArgsTuple DPL_UNUSED)
+
+#define RUNNER_MULTIPROCESS_TEST_SMACK(Proc, ...)                                           \
+    void Proc(std::tuple<__VA_ARGS__> &optionalArgsTuple);                                  \
+    void Proc##Multi(std::tuple<__VA_ARGS__> &optionalArgsTuple);                           \
+    static int Static##Proc##Init()                                                         \
+    {                                                                                       \
+        if (smack_check())                                                                  \
+            DPL::Test::TestRunnerSingleton::Instance().RegisterTest(                        \
+                new DPL::Test::TestCaseExtended<__VA_ARGS__>(#Proc, &Proc));                \
+        return 0;                                                                           \
+    }                                                                                       \
+    const int DPL_UNUSED Static##Proc##InitVar = Static##Proc##Init();                      \
+    void Proc(std::tuple<__VA_ARGS__> &optionalArgsTuple) {                                 \
+        DPL::Test::RunMultiProc(std::bind(Proc##Multi, optionalArgsTuple));                 \
+    }                                                                                       \
+    void Proc##Multi(std::tuple<__VA_ARGS__> &optionalArgsTuple DPL_UNUSED)
+
+#define RUNNER_MULTIPROCESS_TEST_NOSMACK(Proc, ...)                                         \
+    void Proc(std::tuple<__VA_ARGS__> &optionalArgsTuple);                                  \
+    void Proc##Multi(std::tuple<__VA_ARGS__> &optionalArgsTuple);                           \
+    static int Static##Proc##Init()                                                         \
+    {                                                                                       \
+        if (!smack_check())                                                                 \
+            DPL::Test::TestRunnerSingleton::Instance().RegisterTest(                        \
+                new DPL::Test::TestCaseExtended<__VA_ARGS__>(#Proc, &Proc));                \
+        return 0;                                                                           \
+    }                                                                                       \
+    const int DPL_UNUSED Static##Proc##InitVar = Static##Proc##Init();                      \
+    void Proc(std::tuple<__VA_ARGS__> &optionalArgsTuple) {                                 \
+        DPL::Test::RunMultiProc(std::bind(Proc##Multi, optionalArgsTuple));                 \
+    }                                                                                       \
+    void Proc##Multi(std::tuple<__VA_ARGS__> &optionalArgsTuple DPL_UNUSED)
 
 namespace DB {
 
index 38c17dd..4e06b4b 100644 (file)
@@ -15,7 +15,6 @@
  */
 
 #include <cynara_test_commons.h>
-#include <cynara_test_env.h>
 #include <cynara_test_file_operations.h>
 #include <cynara_test_cynara_mask.h>
 
@@ -39,30 +38,6 @@ const std::string SERVICE_PLUGINS_DIR("/usr/lib/cynara/plugin/service/");
 
 }
 
-void environmentWrap(const char *testName, const std::function<void(void)> &func)
-{
-    CynaraTestEnv env(testName);
-    env.save();
-    env.loadDefaultDatabase();
-
-    try {
-        func();
-    } catch (const DPL::Test::TestException &e) {
-        env.restore();
-        throw;
-    } catch (const DPL::Exception &e) {
-        env.restore();
-        throw;
-    } catch (const std::exception &e) {
-        env.restore();
-        throw;
-    } catch (...) {
-        env.restore();
-        throw std::runtime_error("Unknown exception");
-    }
-    env.restore();
-}
-
 void loadServicePlugins(const DirectoryPaths &pluginDirectories)
 {
     CynaraMask mask;
index af8ac96..6df3a83 100644 (file)
 #ifndef CYNARA_TEST_COMMONS_H_
 #define CYNARA_TEST_COMMONS_H_
 
-#include <functional>
 #include <string>
 #include <vector>
 
+#include <cynara_test_env.h>
+
+#include <dpl/test/test_runner.h>
+
 namespace CynaraTestConsts
 {
 
@@ -49,13 +52,8 @@ struct CheckKey
     const char *m_privilege;
 };
 
-void environmentWrap(const char *testName, const std::function<void(void)> &func);
-
 #define RUN_CYNARA_TEST(Proc)                \
-    RUNNER_TEST(Proc)                        \
-    {                                        \
-        environmentWrap(#Proc, Proc##_func); \
-    }
+    RUNNER_TEST(Proc, CynaraTestEnv)         \
 
 typedef std::vector<std::string> DirectoryPaths;
 void loadServicePlugins(const DirectoryPaths &pluginDirectories);
index ba3350a..4af7659 100644 (file)
 
 using namespace FileOperations;
 
-CynaraTestEnv::CynaraTestEnv(const char *dirName)
+CynaraTestEnv::CynaraTestEnv()
     : m_dbPresent(false)
 {
-    m_saveDir = TMP_DIR + "/" + dirName;
-    m_dbSaveDir = m_saveDir + "/db";
-    m_pluginsSaveDir = m_saveDir + "/plugins";
-    m_defaultDir = "/etc/security-tests/db_patterns/default";
 }
 
 CynaraTestEnv::~CynaraTestEnv()
 {
 }
 
-void CynaraTestEnv::save()
+void CynaraTestEnv::init(const std::string &testName)
 {
+    m_saveDir = TMP_DIR + "/" + testName;
+    m_dbSaveDir = m_saveDir + "/db";
+    m_pluginsSaveDir = m_saveDir + "/plugins";
+    m_defaultDir = "/etc/security-tests/db_patterns/default";
+
     CynaraMask mask;
 
     removeDirFiles(m_dbSaveDir);
@@ -54,9 +55,10 @@ void CynaraTestEnv::save()
     }
     makeDir(m_pluginsSaveDir);
     copyCynaraFiles(CynaraTestConsts::SERVICE_PLUGINS_DIR, m_pluginsSaveDir);
+    unmaskedLoadDefaultDatabase();
 }
 
-void CynaraTestEnv::restore()
+void CynaraTestEnv::finish()
 {
     CynaraMask mask;
 
@@ -76,12 +78,16 @@ void CynaraTestEnv::restore()
     removeDirIfExists(m_saveDir);
 }
 
-void CynaraTestEnv::loadDefaultDatabase()
+void CynaraTestEnv::unmaskedLoadDefaultDatabase()
 {
-    CynaraMask mask;
-
     if (m_dbPresent) {
         removeDirFiles(CynaraTestConsts::DB_DIR);
         copyCynaraFiles(m_defaultDir, CynaraTestConsts::DB_DIR);
     }
 }
+
+void CynaraTestEnv::loadDefaultDatabase()
+{
+    CynaraMask mask;
+    unmaskedLoadDefaultDatabase();
+}
index 6c528f7..387d6ba 100644 (file)
 class CynaraTestEnv
 {
 public:
-    explicit CynaraTestEnv(const char *dirName);
-    virtual ~CynaraTestEnv();
-
-    void save();
-    void restore();
+    explicit CynaraTestEnv();
+    ~CynaraTestEnv();
+    void init(const std::string &testName);
+    void finish();
     void loadDefaultDatabase();
 
 private:
+    void unmaskedLoadDefaultDatabase();
     std::string m_saveDir;
     std::string m_dbSaveDir;
     std::string m_pluginsSaveDir;
index 104cd83..f9bbdcb 100644 (file)
 using namespace CynaraTestAdmin;
 using namespace CynaraTestClient;
 
-void tc01_cynara_initialize_func()
+RUNNER_TEST_GROUP_INIT(cynara_tests)
+
+RUN_CYNARA_TEST(tc01_cynara_initialize)
 {
     Client();
 }
 
-void tc02_admin_initialize_func()
+RUN_CYNARA_TEST(tc02_admin_initialize)
 {
     Admin admin;
 }
 
-void tc03_cynara_check_invalid_params_func()
+RUN_CYNARA_TEST(tc03_cynara_check_invalid_params)
 {
     Client cynara;
 
@@ -75,7 +77,7 @@ void checkInvalidPolicy(Admin &admin,
     admin.setPolicies(cp, CYNARA_API_INVALID_PARAM);
 }
 
-void tc04_admin_set_policies_invalid_params_func()
+RUN_CYNARA_TEST(tc04_admin_set_policies_invalid_params)
 {
     Admin admin;
 
@@ -97,7 +99,7 @@ void tc04_admin_set_policies_invalid_params_func()
     checkInvalidPolicy(admin, bucket,  client,  user,    privilege, resultNone,   resultExtra);
 }
 
-void tc05_admin_set_bucket_invalid_params_func()
+RUN_CYNARA_TEST(tc05_admin_set_bucket_invalid_params)
 {
     Admin admin;
 
@@ -113,7 +115,7 @@ void tc05_admin_set_bucket_invalid_params_func()
     admin.setBucket(bucket,  operationNone,    extra, CYNARA_API_OPERATION_NOT_ALLOWED);
 }
 
-void tc06_cynara_check_empty_admin1_func()
+RUN_CYNARA_TEST(tc06_cynara_check_empty_admin1)
 {
     Client cynara;
 
@@ -125,7 +127,7 @@ void tc06_cynara_check_empty_admin1_func()
     cynara.check(client, session, user, privilege, CYNARA_API_ACCESS_DENIED);
 }
 
-void tc06_cynara_check_empty_admin2_func()
+RUN_CYNARA_TEST(tc06_cynara_check_empty_admin2)
 {
     Client cynara;
 
@@ -137,7 +139,7 @@ void tc06_cynara_check_empty_admin2_func()
     cynara.check(client, session, user, privilege, CYNARA_API_ACCESS_DENIED);
 }
 
-void tc07_admin_set_bucket_admin_allow_deny_func()
+RUN_CYNARA_TEST(tc07_admin_set_bucket_admin_allow_deny)
 {
     Admin admin;
     Client cynara;
@@ -158,7 +160,7 @@ void tc07_admin_set_bucket_admin_allow_deny_func()
     cynara.check(client, session, user, privilege, CYNARA_API_ACCESS_DENIED);
 }
 
-void tc08_admin_set_policies_allow_remove1_func()
+RUN_CYNARA_TEST(tc08_admin_set_policies_allow_remove1)
 {
     Admin admin;
     Client cynara;
@@ -214,7 +216,7 @@ void tc08_admin_set_policies_allow_remove1_func()
     cynara.check(data[1][0], session, data[1][1], data[1][2], CYNARA_API_ACCESS_DENIED);
 }
 
-void tc08_admin_set_policies_allow_remove2_func()
+RUN_CYNARA_TEST(tc08_admin_set_policies_allow_remove2)
 {
     Admin admin;
     Client cynara;
@@ -263,7 +265,7 @@ void tc08_admin_set_policies_allow_remove2_func()
     cynara.check(data[1][0], session, data[1][1], data[1][2], CYNARA_API_ACCESS_DENIED);
 }
 
-void tc08_admin_set_policies_allow_remove3_func()
+RUN_CYNARA_TEST(tc08_admin_set_policies_allow_remove3)
 {
     Admin admin;
     Client cynara;
@@ -374,7 +376,7 @@ void setSingleWildcardPolicies(const char *bucket,
     admin.setPolicies(cp);
 }
 
-void tc09_admin_set_policies_wildcard_accesses_func()
+RUN_CYNARA_TEST(tc09_admin_set_policies_wildcard_accesses)
 {
     const char *bucket = CYNARA_ADMIN_DEFAULT_BUCKET;
     const char *session = "session09";
@@ -397,7 +399,7 @@ void tc09_admin_set_policies_wildcard_accesses_func()
     checkAllDeny(data, session);
 }
 
-void tc10_admin_change_extra_bucket_func()
+RUN_CYNARA_TEST(tc10_admin_change_extra_bucket)
 {
     Admin admin;
     Client cynara;
@@ -457,7 +459,7 @@ void tc10_admin_change_extra_bucket_func()
     admin.setBucket(bucket, CYNARA_ADMIN_DELETE, extra);
 }
 
-void tc11_admin_bucket_not_found_func()
+RUN_CYNARA_TEST(tc11_admin_bucket_not_found)
 {
     Admin admin;
     Client cynara;
@@ -481,7 +483,7 @@ void tc11_admin_bucket_not_found_func()
     cynara.check(client, session, user, privilege, CYNARA_API_ACCESS_DENIED);
 }
 
-void tc12_admin_delete_bucket_with_policies_pointing_to_it_func()
+RUN_CYNARA_TEST(tc12_admin_delete_bucket_with_policies_pointing_to_it)
 {
     Admin admin;
     Client cynara;
@@ -515,7 +517,7 @@ void tc12_admin_delete_bucket_with_policies_pointing_to_it_func()
     cynara.check(client, session, user, privilege, CYNARA_API_ACCESS_DENIED);
 }
 
-void tc13_admin_set_policies_to_extra_bucket_func()
+RUN_CYNARA_TEST(tc13_admin_set_policies_to_extra_bucket)
 {
     Admin admin;
     Client cynara;
@@ -548,7 +550,7 @@ void tc13_admin_set_policies_to_extra_bucket_func()
     cynara.check(client, session, user, privilege, CYNARA_API_ACCESS_DENIED);
 }
 
-void tc14_admin_set_policies_integrity_func()
+RUN_CYNARA_TEST(tc14_admin_set_policies_integrity)
 {
     const char *bucketDefault = CYNARA_ADMIN_DEFAULT_BUCKET;
     const char *bucket = "bucket14";
@@ -581,7 +583,7 @@ void tc14_admin_set_policies_integrity_func()
     }
 }
 
-void tc15_admin_set_bucket_admin_none1_func()
+RUN_CYNARA_TEST(tc15_admin_set_bucket_admin_none1)
 {
     Admin admin;
     Client cynara;
@@ -610,7 +612,7 @@ void tc15_admin_set_bucket_admin_none1_func()
     cynara.check(client, session, user, privilege, CYNARA_API_ACCESS_ALLOWED);
 }
 
-void tc15_admin_set_bucket_admin_none2_func()
+RUN_CYNARA_TEST(tc15_admin_set_bucket_admin_none2)
 {
     Admin admin;
     Client cynara;
@@ -635,7 +637,7 @@ void tc15_admin_set_bucket_admin_none2_func()
     cynara.check(client, session, user, privilege, CYNARA_API_ACCESS_DENIED);
 }
 
-void tc15_admin_set_bucket_admin_none3_func()
+RUN_CYNARA_TEST(tc15_admin_set_bucket_admin_none3)
 {
     Admin admin;
     Client cynara;
@@ -664,7 +666,7 @@ void tc15_admin_set_bucket_admin_none3_func()
     cynara.check(client, session, user, privilege, CYNARA_API_ACCESS_ALLOWED);
 }
 
-void tc16_admin_check_single_bucket_func()
+RUN_CYNARA_TEST(tc16_admin_check_single_bucket)
 {
     const char *bucketDefault = CYNARA_ADMIN_DEFAULT_BUCKET;
     const char *client = "client16";
@@ -693,7 +695,7 @@ void tc16_admin_check_single_bucket_func()
                      CYNARA_ADMIN_ALLOW, nullptr, CYNARA_API_SUCCESS);
 }
 
-void tc17_admin_check_nested_bucket_func()
+RUN_CYNARA_TEST(tc17_admin_check_nested_bucket)
 {
     const char *bucketDefault = CYNARA_ADMIN_DEFAULT_BUCKET;
     const char *bucket = "bucket17";
@@ -738,7 +740,7 @@ void tc17_admin_check_nested_bucket_func()
                      CYNARA_ADMIN_ALLOW, nullptr, CYNARA_API_SUCCESS);
 }
 
-void tc18_admin_check_multiple_matches_func()
+RUN_CYNARA_TEST(tc18_admin_check_multiple_matches)
 {
     const char *bucketDefault = CYNARA_ADMIN_DEFAULT_BUCKET;
     const char *client = "client18";
@@ -807,7 +809,7 @@ void tc18_admin_check_multiple_matches_func()
     check(CYNARA_ADMIN_ALLOW);
 }
 
-void tc19_admin_check_none_bucket_func()
+RUN_CYNARA_TEST(tc19_admin_check_none_bucket)
 {
     const char *bucketDefault = CYNARA_ADMIN_DEFAULT_BUCKET;
     const char *bucket1 = "bucket19_a";
@@ -861,7 +863,7 @@ void tc19_admin_check_none_bucket_func()
                      CYNARA_ADMIN_ALLOW, nullptr, CYNARA_API_SUCCESS);
 }
 
-void tc20_admin_list_empty_bucket_func()
+RUN_CYNARA_TEST(tc20_admin_list_empty_bucket)
 {
     const char *emptyBucket = "empty_bucket20";
     const char *client = "client20";
@@ -877,7 +879,7 @@ void tc20_admin_list_empty_bucket_func()
     admin.listPolicies(emptyBucket, client, user, privilege, emptyPolicies);
 }
 
-void tc21_admin_list_no_bucket_func()
+RUN_CYNARA_TEST(tc21_admin_list_no_bucket)
 {
     const char *emptyBucket = "empty_bucket21";
     const char *notExistingBucket = "not_existing_bucket21";
@@ -895,7 +897,7 @@ void tc21_admin_list_no_bucket_func()
                        CYNARA_API_BUCKET_NOT_FOUND);
 }
 
-void tc22_admin_list_bucket_func()
+RUN_CYNARA_TEST(tc22_admin_list_bucket)
 {
     const char *bucket = "bucket22";
     const char *emptyBucket = "empty_bucket22";
@@ -954,7 +956,7 @@ void tc22_admin_list_bucket_func()
     admin.listPolicies(bucket, client, wildcard, any, expectedPolicies);
 }
 
-void tc23_admin_erase_empty_bucket_func()
+RUN_CYNARA_TEST(tc23_admin_erase_empty_bucket)
 {
     const char *emptyBucket = "empty_bucket23";
     const char *client = "client23";
@@ -969,7 +971,7 @@ void tc23_admin_erase_empty_bucket_func()
     admin.erasePolicies(emptyBucket, recursive, client, user, privilege);
 }
 
-void tc24_admin_erase_no_bucket_func()
+RUN_CYNARA_TEST(tc24_admin_erase_no_bucket)
 {
     const char *emptyBucket = "empty_bucket24";
     const char *notExistingBucket = "not_existing_bucket24";
@@ -986,7 +988,7 @@ void tc24_admin_erase_no_bucket_func()
                         CYNARA_API_BUCKET_NOT_FOUND);
 }
 
-void tc25_admin_erase_single_bucket_func()
+RUN_CYNARA_TEST(tc25_admin_erase_single_bucket)
 {
     const char *bucket = "bucket25";
     const char *emptyBucket = "empty_bucket25";
@@ -1076,7 +1078,7 @@ void tc25_admin_erase_single_bucket_func()
     }
 }
 
-void tc26_admin_erase_recursive_not_linked_buckets_func()
+RUN_CYNARA_TEST(tc26_admin_erase_recursive_not_linked_buckets)
 {
     const char *bucket = "bucket26";
     const char *subBucket = "sub_bucket26";
@@ -1120,7 +1122,7 @@ void tc26_admin_erase_recursive_not_linked_buckets_func()
     }
 }
 
-void tc27_admin_erase_recursive_linked_buckets_func()
+RUN_CYNARA_TEST(tc27_admin_erase_recursive_linked_buckets)
 {
     const char *bucket = "bucket27";
     const char *subBucket = "sub_bucket27";
@@ -1165,7 +1167,7 @@ void tc27_admin_erase_recursive_linked_buckets_func()
     }
 }
 
-void tc28_admin_erase_non_recursive_linked_buckets_func()
+RUN_CYNARA_TEST(tc28_admin_erase_non_recursive_linked_buckets)
 {
     const char *bucket = "bucket28";
     const char *subBucket = "sub_bucket28";
@@ -1212,7 +1214,7 @@ void tc28_admin_erase_non_recursive_linked_buckets_func()
     }
 }
 
-void tc29_admin_erase_recursive_from_sub_bucket_func()
+RUN_CYNARA_TEST(tc29_admin_erase_recursive_from_sub_bucket)
 {
     const char *bucket = "bucket29";
     const char *subBucket = "sub_bucket29";
@@ -1280,64 +1282,23 @@ void testPlugins(const std::vector<std::string> &plugins)
     admin.listPoliciesDescriptions(expectedDescriptions);
 }
 
-void tc30_admin_list_descriptions_no_plugins_func()
+RUN_CYNARA_TEST(tc30_admin_list_descriptions_no_plugins)
 {
     testPlugins({});
 }
 
-void tc31_admin_list_descriptions_1_plugin_single_policy_func()
+RUN_CYNARA_TEST(tc31_admin_list_descriptions_1_plugin_single_policy)
 {
     testPlugins({CynaraTestPlugins::SINGLE_POLICY});
 }
 
-void tc32_admin_list_descriptions_1_plugin_multiple_policy_func()
+RUN_CYNARA_TEST(tc32_admin_list_descriptions_1_plugin_multiple_policy)
 {
     testPlugins({CynaraTestPlugins::MULTIPLE_POLICY});
 }
 
-void tc33_admin_list_descriptions_multiple_plugins_func()
+RUN_CYNARA_TEST(tc33_admin_list_descriptions_multiple_plugins)
 {
     testPlugins({CynaraTestPlugins::SINGLE_POLICY,
                  CynaraTestPlugins::MULTIPLE_POLICY});
 }
-
-RUNNER_TEST_GROUP_INIT(cynara_tests)
-
-RUN_CYNARA_TEST(tc01_cynara_initialize)
-RUN_CYNARA_TEST(tc02_admin_initialize)
-RUN_CYNARA_TEST(tc03_cynara_check_invalid_params)
-RUN_CYNARA_TEST(tc04_admin_set_policies_invalid_params)
-RUN_CYNARA_TEST(tc05_admin_set_bucket_invalid_params)
-RUN_CYNARA_TEST(tc06_cynara_check_empty_admin1)
-RUN_CYNARA_TEST(tc06_cynara_check_empty_admin2)
-RUN_CYNARA_TEST(tc07_admin_set_bucket_admin_allow_deny)
-RUN_CYNARA_TEST(tc08_admin_set_policies_allow_remove1)
-RUN_CYNARA_TEST(tc08_admin_set_policies_allow_remove2)
-RUN_CYNARA_TEST(tc08_admin_set_policies_allow_remove3)
-RUN_CYNARA_TEST(tc09_admin_set_policies_wildcard_accesses)
-RUN_CYNARA_TEST(tc10_admin_change_extra_bucket)
-RUN_CYNARA_TEST(tc11_admin_bucket_not_found)
-RUN_CYNARA_TEST(tc12_admin_delete_bucket_with_policies_pointing_to_it)
-RUN_CYNARA_TEST(tc13_admin_set_policies_to_extra_bucket)
-RUN_CYNARA_TEST(tc14_admin_set_policies_integrity)
-RUN_CYNARA_TEST(tc15_admin_set_bucket_admin_none1)
-RUN_CYNARA_TEST(tc15_admin_set_bucket_admin_none2)
-RUN_CYNARA_TEST(tc15_admin_set_bucket_admin_none3)
-RUN_CYNARA_TEST(tc16_admin_check_single_bucket)
-RUN_CYNARA_TEST(tc17_admin_check_nested_bucket)
-RUN_CYNARA_TEST(tc18_admin_check_multiple_matches)
-RUN_CYNARA_TEST(tc19_admin_check_none_bucket)
-RUN_CYNARA_TEST(tc20_admin_list_empty_bucket)
-RUN_CYNARA_TEST(tc21_admin_list_no_bucket)
-RUN_CYNARA_TEST(tc22_admin_list_bucket)
-RUN_CYNARA_TEST(tc23_admin_erase_empty_bucket)
-RUN_CYNARA_TEST(tc24_admin_erase_no_bucket)
-RUN_CYNARA_TEST(tc25_admin_erase_single_bucket)
-RUN_CYNARA_TEST(tc26_admin_erase_recursive_not_linked_buckets)
-RUN_CYNARA_TEST(tc27_admin_erase_recursive_linked_buckets)
-RUN_CYNARA_TEST(tc28_admin_erase_non_recursive_linked_buckets)
-RUN_CYNARA_TEST(tc29_admin_erase_recursive_from_sub_bucket)
-RUN_CYNARA_TEST(tc30_admin_list_descriptions_no_plugins)
-RUN_CYNARA_TEST(tc31_admin_list_descriptions_1_plugin_single_policy)
-RUN_CYNARA_TEST(tc32_admin_list_descriptions_1_plugin_multiple_policy)
-RUN_CYNARA_TEST(tc33_admin_list_descriptions_multiple_plugins)
index a8c74ae..5554e51 100644 (file)
@@ -86,19 +86,21 @@ void getAgentRequest(Agent &agent, AgentRequest &request, Client &client,
                          sendClientRequest, hangOnGetRequest);
 }
 
-void tcag01_set_agent_type_policy_without_plugin_func()
+RUNNER_TEST_GROUP_INIT(cynara_agent_tests)
+
+RUN_CYNARA_TEST(tcag01_set_agent_type_policy_without_plugin_func)
 {
     loadServicePlugins(DirectoryPaths());
     setAgentPolicy(CYNARA_API_INVALID_PARAM);
 }
 
-void tcag02_set_agent_type_policy_with_plugin_loaded_func()
+RUN_CYNARA_TEST(tcag02_set_agent_type_policy_with_plugin_loaded_func)
 {
     loadAgentPlugin();
     setAgentPolicy();
 }
 
-void tcag03_check_with_no_agent_func()
+RUN_CYNARA_TEST(tcag03_check_with_no_agent_func)
 {
     std::string testNo("03");
     cynara_check_id id;
@@ -118,12 +120,12 @@ void tcag03_check_with_no_agent_func()
     client.process(CYNARA_API_SUCCESS, Client::IGNORE_TIMEOUT);
 }
 
-void tcag04_agent_initialize_func()
+RUN_CYNARA_TEST(tcag04_agent_initialize_func)
 {
     Agent();
 }
 
-void tcag05_agent_request_timeout_func()
+RUN_CYNARA_TEST(tcag05_agent_request_timeout_func)
 {
     Agent agent;
     AgentRequest request;
@@ -137,7 +139,7 @@ void tcag05_agent_request_timeout_func()
                          restartCynaraServiceAndSockets, hangOnGetRequest);
 }
 
-void tcag06_check_with_unregistered_agent_func()
+RUN_CYNARA_TEST(tcag06_check_with_unregistered_agent_func)
 {
     std::string testNo("06");
     cynara_check_id id;
@@ -159,7 +161,7 @@ void tcag06_check_with_unregistered_agent_func()
     client.process(CYNARA_API_SUCCESS, Client::IGNORE_TIMEOUT);
 }
 
-void tcag07_get_request_func()
+RUN_CYNARA_TEST(tcag07_get_request_func)
 {
     std::string testNo("07");
     CheckData data(testNo);
@@ -188,7 +190,7 @@ void tcag07_get_request_func()
     client.process();
 }
 
-void tcag08_get_request_and_respond_with_wrong_id_func()
+RUN_CYNARA_TEST(tcag08_get_request_and_respond_with_wrong_id_func)
 {
     std::string testNo("08");
     CheckData data(testNo);
@@ -216,7 +218,7 @@ void tcag08_get_request_and_respond_with_wrong_id_func()
     client.process(CYNARA_API_SUCCESS, Client::TimeoutExpectation::EXPECT_TIMEOUT, 2);
 }
 
-void tcag09_get_request_and_correct_responded_id_func()
+RUN_CYNARA_TEST(tcag09_get_request_and_correct_responded_id_func)
 {
     std::string testNo("09");
     CheckData data(testNo);
@@ -246,7 +248,7 @@ void tcag09_get_request_and_correct_responded_id_func()
     client.process();
 }
 
-void tcag10_cancel_request_func()
+RUN_CYNARA_TEST(tcag10_cancel_request_func)
 {
     std::string testNo("10");
     CheckData data(testNo);
@@ -281,7 +283,7 @@ void tcag10_cancel_request_func()
     client.process(CYNARA_API_SUCCESS, Client::TimeoutExpectation::EXPECT_NO_TIMEOUT, 2);
 }
 
-void tcag11_cancel_processed_request_func()
+RUN_CYNARA_TEST(tcag11_cancel_processed_request_func)
 {
     std::string testNo("11");
     CheckData data(testNo);
@@ -316,7 +318,7 @@ void tcag11_cancel_processed_request_func()
     client.process(CYNARA_API_SUCCESS, Client::TimeoutExpectation::EXPECT_NO_TIMEOUT, 2);
 }
 
-void tcag12_create_two_requests_func()
+RUN_CYNARA_TEST(tcag12_create_two_requests_func)
 {
     std::string testNo("12");
     CheckData data1(testNo, 1), data2(testNo, 2);
@@ -365,7 +367,7 @@ void tcag12_create_two_requests_func()
     client.process(CYNARA_API_SUCCESS, Client::TimeoutExpectation::IGNORE_TIMEOUT, 1);
 }
 
-void tcag13_create_many_requests_func()
+RUN_CYNARA_TEST(tcag13_create_many_requests_func)
 {
     const int numberOfRequests = 4;
     std::string testNo("13");
@@ -396,7 +398,7 @@ void tcag13_create_many_requests_func()
     }
 }
 
-void tcag14_client_disconnects_func()
+RUN_CYNARA_TEST(tcag14_client_disconnects_func)
 {
     std::string testNo("14");
     CheckData data(testNo);
@@ -427,7 +429,7 @@ void tcag14_client_disconnects_func()
     agentRequest.assertCancel();
 }
 
-void tcag15_agent_disconnects_func()
+RUN_CYNARA_TEST(tcag15_agent_disconnects_func)
 {
     std::string testNo("15");
     CheckData data(testNo);
@@ -453,20 +455,3 @@ void tcag15_agent_disconnects_func()
     client.process(CYNARA_API_SUCCESS, Client::TimeoutExpectation::EXPECT_NO_TIMEOUT, 2);
 }
 
-RUNNER_TEST_GROUP_INIT(cynara_agent_tests)
-
-RUN_CYNARA_TEST(tcag01_set_agent_type_policy_without_plugin)
-RUN_CYNARA_TEST(tcag02_set_agent_type_policy_with_plugin_loaded)
-RUN_CYNARA_TEST(tcag03_check_with_no_agent)
-RUN_CYNARA_TEST(tcag04_agent_initialize)
-RUN_CYNARA_TEST(tcag05_agent_request_timeout)
-RUN_CYNARA_TEST(tcag06_check_with_unregistered_agent)
-RUN_CYNARA_TEST(tcag07_get_request)
-RUN_CYNARA_TEST(tcag08_get_request_and_respond_with_wrong_id)
-RUN_CYNARA_TEST(tcag09_get_request_and_correct_responded_id)
-RUN_CYNARA_TEST(tcag10_cancel_request)
-RUN_CYNARA_TEST(tcag11_cancel_processed_request)
-RUN_CYNARA_TEST(tcag12_create_two_requests)
-RUN_CYNARA_TEST(tcag13_create_many_requests)
-RUN_CYNARA_TEST(tcag14_client_disconnects)
-RUN_CYNARA_TEST(tcag15_agent_disconnects)
index 1412fcd..2f8eb48 100644 (file)
 using namespace CynaraTestClientAsync;
 using namespace CynaraTestAdmin;
 
-void tca01_initialize_func()
+RUNNER_TEST_GROUP_INIT(cynara_async_tests)
+
+RUN_CYNARA_TEST(tca01_initialize)
 {
     Client client;
 }
 
-void tca02_empty_cache_miss_func()
+RUN_CYNARA_TEST(tca02_empty_cache_miss)
 {
     std::string testNo("02");
     Client client;
@@ -50,7 +52,7 @@ void tca02_empty_cache_miss_func()
     client.checkCache({testNo}, CYNARA_API_CACHE_MISS);
 }
 
-void tca03_create_max_requests_func()
+RUN_CYNARA_TEST(tca03_create_max_requests)
 {
     std::string testNo("03");
     cynara_check_id id;
@@ -67,7 +69,7 @@ void tca03_create_max_requests_func()
     client.assertStatus(READWRITE);
 }
 
-void tca04_request_and_process_func()
+RUN_CYNARA_TEST(tca04_request_and_process)
 {
     std::string testNo("04");
     cynara_check_id id;
@@ -88,7 +90,7 @@ void tca04_request_and_process_func()
     client.process(CYNARA_API_SUCCESS, Client::IGNORE_TIMEOUT);
 }
 
-void tca05_request_and_cancel1_func()
+RUN_CYNARA_TEST(tca05_request_and_cancel1)
 {
     std::string testNo("05");
     int subtest = 1;
@@ -113,7 +115,7 @@ void tca05_request_and_cancel1_func()
     client.process(CYNARA_API_SUCCESS, Client::IGNORE_TIMEOUT);
 }
 
-void tca05_request_and_cancel2_func()
+RUN_CYNARA_TEST(tca05_request_and_cancel2)
 {
     std::string testNo("05");
     int subtest = 2;
@@ -137,7 +139,7 @@ void tca05_request_and_cancel2_func()
     client.process(CYNARA_API_SUCCESS, Client::IGNORE_TIMEOUT);
 }
 
-void tca05_request_and_cancel3_func()
+RUN_CYNARA_TEST(tca05_request_and_cancel3)
 {
     std::string testNo("05");
     int subtest = 3;
@@ -162,7 +164,7 @@ void tca05_request_and_cancel3_func()
     client.cancel(id, CYNARA_API_INVALID_PARAM);
 }
 
-void tca06_cancel_fail_func()
+RUN_CYNARA_TEST(tca06_cancel_fail)
 {
     cynara_check_id id = 0xDEAD;
 
@@ -171,7 +173,7 @@ void tca06_cancel_fail_func()
     client.cancel(id, CYNARA_API_INVALID_PARAM);
 }
 
-void tca07_request_with_data_insertion_func()
+RUN_CYNARA_TEST(tca07_request_with_data_insertion)
 {
     std::string testNo("07");
     Admin admin;
@@ -220,7 +222,7 @@ void tca07_request_with_data_insertion_func()
     client.checkCache(data[1], CYNARA_API_CACHE_MISS);
 }
 
-void tca08_disconnect1_func()
+RUN_CYNARA_TEST(tca08_disconnect1)
 {
     std::string testNo("08");
     int subtest = 1;
@@ -240,7 +242,7 @@ void tca08_disconnect1_func()
     client.process(CYNARA_API_SUCCESS, Client::IGNORE_TIMEOUT);
 }
 
-void tca08_disconnect2_func()
+RUN_CYNARA_TEST(tca08_disconnect2)
 {
     std::string testNo("08");
     int subtest = 2;
@@ -264,7 +266,7 @@ void tca08_disconnect2_func()
     client.process(CYNARA_API_SUCCESS, Client::IGNORE_TIMEOUT);
 }
 
-void tca08_disconnect3_func()
+RUN_CYNARA_TEST(tca08_disconnect3)
 {
     std::string testNo("08");
     int subtest = 2;
@@ -284,7 +286,7 @@ void tca08_disconnect3_func()
     client.process(CYNARA_API_SUCCESS, Client::IGNORE_TIMEOUT);
 }
 
-void tca09_disconnect_and_cancel1_func()
+RUN_CYNARA_TEST(tca09_disconnect_and_cancel1)
 {
     std::string testNo("09");
     int subtest = 1;
@@ -316,7 +318,7 @@ void tca09_disconnect_and_cancel1_func()
     client.assertStatus(READ);
 }
 
-void tca09_disconnect_and_cancel2_func()
+RUN_CYNARA_TEST(tca09_disconnect_and_cancel2)
 {
     std::string testNo("09");
     int subtest = 2;
@@ -348,7 +350,7 @@ void tca09_disconnect_and_cancel2_func()
     client.assertStatus(READ);
 }
 
-void tca10_double_request_func()
+RUN_CYNARA_TEST(tca10_double_request)
 {
     std::string testNo("10");
     cynara_check_id id, id2;
@@ -372,7 +374,7 @@ void tca10_double_request_func()
     client.process(CYNARA_API_SUCCESS, Client::IGNORE_TIMEOUT);
 }
 
-void tca11_double_request_with_restart_func()
+RUN_CYNARA_TEST(tca11_double_request_with_restart)
 {
     std::string testNo("11");
     cynara_check_id id, id2;
@@ -399,7 +401,7 @@ void tca11_double_request_with_restart_func()
     client.process(CYNARA_API_SUCCESS, Client::IGNORE_TIMEOUT);
 }
 
-void tca12_multiple_connections_without_requests_func()
+RUN_CYNARA_TEST(tca12_multiple_connections_without_requests)
 {
     std::string testNo("12");
 
@@ -435,23 +437,3 @@ void tca12_multiple_connections_without_requests_func()
                              << after << " / " << afterTimestamp.tv_sec << "."
                              << afterTimestamp.tv_usec);
 }
-
-RUNNER_TEST_GROUP_INIT(cynara_async_tests)
-
-RUN_CYNARA_TEST(tca01_initialize)
-RUN_CYNARA_TEST(tca02_empty_cache_miss)
-RUN_CYNARA_TEST(tca03_create_max_requests)
-RUN_CYNARA_TEST(tca04_request_and_process)
-RUN_CYNARA_TEST(tca05_request_and_cancel1)
-RUN_CYNARA_TEST(tca05_request_and_cancel2)
-RUN_CYNARA_TEST(tca05_request_and_cancel3)
-RUN_CYNARA_TEST(tca06_cancel_fail)
-RUN_CYNARA_TEST(tca07_request_with_data_insertion)
-RUN_CYNARA_TEST(tca08_disconnect1)
-RUN_CYNARA_TEST(tca08_disconnect2)
-RUN_CYNARA_TEST(tca08_disconnect3)
-RUN_CYNARA_TEST(tca09_disconnect_and_cancel1)
-RUN_CYNARA_TEST(tca09_disconnect_and_cancel2)
-RUN_CYNARA_TEST(tca10_double_request)
-RUN_CYNARA_TEST(tca11_double_request_with_restart)
-RUN_CYNARA_TEST(tca12_multiple_connections_without_requests)
index a0f4d78..237cf12 100644 (file)
@@ -187,6 +187,9 @@ void compareDbs(const std::string &source)
 
 } // anonymous namespace
 
+
+RUNNER_TEST_GROUP_INIT(cynara_db_tests)
+
 /**
  * @brief   Lockdown initialization failure caused by fake guard existence
  * @test    Expected result: refuse to write data to storage as long as guard file creation fails
@@ -196,7 +199,7 @@ void compareDbs(const std::string &source)
  * 4. Retry to make a change (ALLOW) in default bucket (data dump should proceed)
  * 5. Check if database is saved correctly
  */
-void tcdb01_lockdown_init_failure_func()
+RUN_CYNARA_TEST(tcdb01_lockdown_init_failure)
 {
     Admin admin;
     Client cynara;
@@ -225,7 +228,7 @@ void tcdb01_lockdown_init_failure_func()
  * 4. Try to make a change (DENY) in default bucket (data dump should fail)
  * 5. Reload Cynara - policies loaded from default bucket should still be ALLOW
  */
-void tcdb02_write_to_backup_failure_func()
+RUN_CYNARA_TEST(tcdb02_write_to_backup_failure)
 {
     Admin admin;
     Client cynara;
@@ -255,7 +258,7 @@ void tcdb02_write_to_backup_failure_func()
  * 5. Reload Cynara - policies should be loaded from primary (revalidated) database
  * 6. Check if all backup files were removed
  */
-void tcdb03_invalid_and_valid_backup_removal_func()
+RUN_CYNARA_TEST(tcdb03_invalid_and_valid_backup_removal)
 {
     Admin admin;
     Client cynara;
@@ -283,7 +286,7 @@ void tcdb03_invalid_and_valid_backup_removal_func()
  * 1. Write sample policy to database (and let it save to storage)
  * 2. Compare freshly saved files with samples from test patterns directory
  */
-void tcdb04_dumped_file_binary_comparison_func()
+RUN_CYNARA_TEST(tcdb04_dumped_file_binary_comparison)
 {
     Admin admin;
     Client cynara;
@@ -314,7 +317,7 @@ void tcdb04_dumped_file_binary_comparison_func()
  * 2. Reload Cynara
  * 3. Check if any of mentioned above files still remained
  */
-void tcdb05_non_indexed_files_removal_func()
+RUN_CYNARA_TEST(tcdb05_non_indexed_files_removal)
 {
     std::vector<std::string> filenames = { "_broken-backup~", "_non-indexed-bucket",
                                            "some-file-that-doesnt-belong-here" };
@@ -327,11 +330,3 @@ void tcdb05_non_indexed_files_removal_func()
     restartCynaraServiceAndSockets();
     compareDbs(defDb);
 }
-
-RUNNER_TEST_GROUP_INIT(cynara_db_tests)
-
-RUN_CYNARA_TEST(tcdb01_lockdown_init_failure)
-RUN_CYNARA_TEST(tcdb02_write_to_backup_failure)
-RUN_CYNARA_TEST(tcdb03_invalid_and_valid_backup_removal)
-RUN_CYNARA_TEST(tcdb04_dumped_file_binary_comparison)
-RUN_CYNARA_TEST(tcdb05_non_indexed_files_removal)
diff --git a/src/framework/include/dpl/test/test_case.h b/src/framework/include/dpl/test/test_case.h
new file mode 100644 (file)
index 0000000..d08d2e0
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2015 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.
+ */
+/*
+ * @file        test_case.h
+ * @author      Marcin Niesluchowski (m.niesluchow@samsung.com)
+ * @version     1.0
+ * @brief       This file is the header file of TestCase class
+ */
+
+#ifndef DPL_TEST_CASE_H
+#define DPL_TEST_CASE_H
+
+#include <string>
+
+#include <dpl/test/performance_result.h>
+
+namespace DPL {
+namespace Test {
+
+class TestCase
+{
+public:
+    TestCase(const std::string &name)
+        : m_name(name) {}
+    virtual ~TestCase() {}
+
+    bool operator <(const TestCase &other) const {
+        return m_name < other.m_name;
+    }
+    bool operator ==(const TestCase &other) const {
+        return m_name == other.m_name;
+    }
+
+    const std::string& GetName() const {
+        return m_name;
+    }
+    PerformanceResultPtr GetPerformance() const {
+        return m_performance;
+    }
+    void SetPerformance(PerformanceResultPtr performance) {
+        m_performance = performance;
+    }
+
+    virtual void Test() = 0;
+    virtual void Init() = 0;
+    virtual void Finish() = 0;
+
+private:
+    std::string m_name;
+    PerformanceResultPtr m_performance;
+};
+
+typedef TestCase* TestCasePtr;
+
+} // namespace Test
+} // namespace DPL
+
+#endif // DPL_TEST_CASE_H
diff --git a/src/framework/include/dpl/test/test_case_extended.h b/src/framework/include/dpl/test/test_case_extended.h
new file mode 100644 (file)
index 0000000..129365a
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2015 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.
+ */
+/*
+ * @file        test_case_extended.h
+ * @author      Marcin Niesluchowski (m.niesluchow@samsung.com)
+ * @version     1.0
+ * @brief       This file is the header file of TestCaseExtended class
+ */
+
+#ifndef DPL_TEST_CASE_EXTENDED_H
+#define DPL_TEST_CASE_EXTENDED_H
+
+#include <cstddef>
+#include <functional>
+#include <string>
+#include <tuple>
+
+#include <dpl/test/test_case.h>
+
+namespace DPL {
+namespace Test {
+namespace Operations {
+
+template<size_t N, class T>
+void init(T &t, const std::string &testName) {
+    (void) t;
+    (void) testName;
+}
+
+template<size_t N, class T>
+void finish(T &t) {
+    (void) t;
+}
+
+template<size_t N, class T, typename First, typename ...Rest>
+void init(T &t, const std::string &testName) {
+    std::get<N>(t).init(testName);
+    init<N+1, T, Rest...>(t, testName);
+}
+
+template<size_t N, class T, typename First, typename ...Rest>
+void finish(T &t) {
+    std::get<N>(t).finish();
+    finish<N-1, T, Rest...>(t);
+}
+
+} // namespace Operations
+
+template<typename ...Args>
+class TestCaseExtended
+    : public TestCase
+{
+public:
+    TestCaseExtended(const std::string &name,
+                     const std::function<void(std::tuple<Args...> &t)> &testFunc)
+        : TestCase(name), m_testFunc(testFunc) {}
+
+private:
+    virtual void Init() { Operations::init<0, std::tuple<Args...>, Args...>(m_tuple, GetName()); }
+    virtual void Finish() { Operations::finish<sizeof...(Args)-1, std::tuple<Args...>, Args...>(m_tuple); }
+    virtual void Test() { m_testFunc(m_tuple); }
+
+    std::tuple<Args...> m_tuple;
+    std::function<void(std::tuple<Args...> &t)> m_testFunc;
+};
+
+} // namespace Test
+} // namespace DPL
+
+#endif // DPL_TEST_CASE_EXTENDED_H
index ee1d7c3..8a14823 100644 (file)
@@ -17,6 +17,7 @@
  * @file        test_runner.h
  * @author      Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
  * @author      Lukasz Wrzosek (l.wrzosek@samsung.com)
+ * @author      Marcin Niesluchowski (m.niesluchow@samsung.com)
  * @version     1.0
  * @brief       This file is the header file of test runner
  */
@@ -28,6 +29,7 @@
 #include <cstdlib>
 #include <cstring>
 #include <exception>
+#include <functional>
 #include <iostream>
 #include <list>
 #include <map>
@@ -43,6 +45,8 @@
 #include <dpl/gdbbacktrace.h>
 #include <dpl/singleton.h>
 #include <dpl/test/performance_result.h>
+#include <dpl/test/test_case.h>
+#include <dpl/test/test_case_extended.h>
 #include <dpl/test/test_exception.h>
 #include <dpl/test/test_failed.h>
 #include <dpl/test/test_ignored.h>
@@ -78,36 +82,18 @@ class TestRunner
 
     void addFailReason(const std::string &reason);
 
-    typedef void (*TestCase)();
+    ~TestRunner();
 
   private:
-    struct TestCaseStruct
-    {
-        std::string name;
-        TestCase proc;
-        PerformanceResultPtr performance;
-
-        bool operator <(const TestCaseStruct &other) const
-        {
-            return name < other.name;
-        }
-
-        bool operator ==(const TestCaseStruct &other) const
-        {
-            return name == other.name;
-        }
-
-        TestCaseStruct(const std::string &n, TestCase p) :
-            name(n),
-            proc(p)
-        {}
-    };
-
-    typedef std::list<TestCaseStruct> TestCaseStructList;
-    typedef std::map<std::string, TestCaseStructList> TestCaseGroupMap;
+    typedef std::list<TestCasePtr> TestCaseList;
+    typedef std::map<std::string, TestCaseList> TestCaseGroupMap;
+    typedef std::set<TestCasePtr> TestCaseSet;
+
     TestCaseGroupMap m_testGroups;
+    TestCaseSet m_testCaseSet;
+
+    TestCasePtr m_currentTestCase;
 
-    TestCaseStruct * m_currentTestCase;
 
     std::string m_currentGroup;
 
@@ -125,10 +111,10 @@ class TestRunner
     bool filterByXML(std::map<std::string, bool> & casesMap);
     void normalizeXMLTag(std::string& str, const std::string& testcase);
 
-    void RunTestCase(const TestCaseStruct& testCase);
+    void RunTestCase(TestCasePtr testCase);
 
-    void setCurrentTestCase(TestCaseStruct* testCase);
-    TestCaseStruct *getCurrentTestCase();
+    void setCurrentTestCase(TestCasePtr testCase);
+    TestCasePtr getCurrentTestCase();
 
     void RunTests();
 
@@ -137,9 +123,8 @@ class TestRunner
     void CollectResult(const std::string& id, const TestResult &result);
 
   public:
-    void RegisterTest(const char *testName, TestCase proc);
     void InitGroup(const char* name);
-
+    void RegisterTest(TestCasePtr testCase);
     int ExecTestRunner(int argc, char *argv[]);
     typedef std::vector<std::string> ArgsList;
     int ExecTestRunner(ArgsList args);
@@ -164,6 +149,9 @@ private:
 };
 
 typedef DPL::Singleton<TestRunner> TestRunnerSingleton;
+
+TestResult::FailStatus TryCatch(const std::function<void(void)> &func, std::string &reason);
+
 }
 } // namespace DPL
 
@@ -176,16 +164,16 @@ typedef DPL::Singleton<TestRunner> TestRunnerSingleton;
     const int DPL_UNUSED Static##GroupName##InitVar =                     \
         Static##GroupName##Init();
 
-#define RUNNER_TEST(Proc)                                                      \
-    void Proc();                                                               \
-    static int Static##Proc##Init()                                            \
-    {                                                                          \
-        DPL::Test::TestRunnerSingleton::Instance().RegisterTest(#Proc, &Proc); \
-        return 0;                                                              \
-    }                                                                          \
-    const int DPL_UNUSED Static##Proc##InitVar = Static##Proc##Init();         \
-    void Proc()
-
+#define RUNNER_TEST(Proc, ...)                                                          \
+    void Proc(std::tuple<__VA_ARGS__> &optionalArgsTuple);                              \
+    static int Static##Proc##Init()                                                     \
+    {                                                                                   \
+        DPL::Test::TestRunnerSingleton::Instance().RegisterTest(                        \
+            new DPL::Test::TestCaseExtended<__VA_ARGS__>(#Proc, &Proc));                \
+        return 0;                                                                       \
+    }                                                                                   \
+    const int DPL_UNUSED Static##Proc##InitVar = Static##Proc##Init();                  \
+    void Proc(std::tuple<__VA_ARGS__> &optionalArgsTuple DPL_UNUSED)
 
 /**
  * ASSERT MACROS
index 8c52600..ea6d8c9 100644 (file)
 /*
  * @file        test_runner_child.h
  * @author      Bartlomiej Grzelewski (b.grzelewski@samsung.com)
+ * @author      Marcin Niesluchowski (m.niesluchow@samsung.com)
  * @version     1.0
  * @brief       This file is the header file of test runner
  */
 #ifndef DPL_TEST_RUNNER_CHILD_H
 #define DPL_TEST_RUNNER_CHILD_H
 
+#include <functional>
+#include <memory>
+#include <tuple>
+
+#include <dpl/availability.h>
+#include <dpl/test/test_case_extended.h>
 #include <dpl/test/test_runner.h>
 
 namespace DPL {
@@ -74,22 +81,23 @@ class PipeWrapper : DPL::Noncopyable
     int m_pipefd[2];
 };
 
-void RunChildProc(TestRunner::TestCase procChild);
+void RunChildProc(const std::function<void(void)> &testFunc);
 } // namespace Test
 } // namespace DPL
 
-#define RUNNER_CHILD_TEST(Proc)                                                      \
-    void Proc();                                                                     \
-    void Proc##Child();                                                              \
-    static int Static##Proc##Init()                                                  \
-    {                                                                                \
-        DPL::Test::TestRunnerSingleton::Instance().RegisterTest(#Proc, &Proc);       \
-        return 0;                                                                    \
-    }                                                                                \
-    const int DPL_UNUSED Static##Proc##InitVar = Static##Proc##Init();               \
-    void Proc(){                                                                     \
-        DPL::Test::RunChildProc(&Proc##Child);                                       \
-    }                                                                                \
-    void Proc##Child()
+#define RUNNER_CHILD_TEST(Proc, ...)                                                    \
+    void Proc(std::tuple<__VA_ARGS__> &optionalArgsTuple);                              \
+    void Proc##Child(std::tuple<__VA_ARGS__> &optionalArgsTuple);                       \
+    static int Static##Proc##Init()                                                     \
+    {                                                                                   \
+        DPL::Test::TestRunnerSingleton::Instance().RegisterTest(                        \
+            new DPL::Test::TestCaseExtended<__VA_ARGS__>(#Proc, &Proc));                \
+        return 0;                                                                       \
+    }                                                                                   \
+    const int DPL_UNUSED Static##Proc##InitVar = Static##Proc##Init();                  \
+    void Proc(std::tuple<__VA_ARGS__> &optionalArgsTuple) {                             \
+        DPL::Test::RunChildProc(std::bind(Proc##Child, optionalArgsTuple));             \
+    }                                                                                   \
+    void Proc##Child(std::tuple<__VA_ARGS__> &optionalArgsTuple DPL_UNUSED)
 
 #endif // DPL_TEST_RUNNER_CHILD_H
index 279b5ef..ac6939e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2014-2015 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.
 #ifndef DPL_TEST_RUNNER_MULTIPROCESS_H
 #define DPL_TEST_RUNNER_MULTIPROCESS_H
 
+#include <ctime>
+#include <functional>
+#include <memory>
+#include <string>
+#include <tuple>
+
+#include <dpl/availability.h>
 #include <dpl/test/test_runner_child.h>
 
 namespace DPL {
@@ -39,22 +46,23 @@ class SimplePipeWrapper :
     Status receive(std::string &data, bool &empty, time_t deadline);
 };
 
-void RunMultiProc(TestRunner::TestCase procMulti);
+void RunMultiProc(const std::function<void(void)>& testFunc);
 } // namespace Test
 } // namespace DPL
 
-#define RUNNER_MULTIPROCESS_TEST(Proc)                                               \
-    void Proc();                                                                     \
-    void Proc##Multi();                                                              \
-    static int Static##Proc##Init()                                                  \
-    {                                                                                \
-        DPL::Test::TestRunnerSingleton::Instance().RegisterTest(#Proc, &Proc);       \
-        return 0;                                                                    \
-    }                                                                                \
-    const int DPL_UNUSED Static##Proc##InitVar = Static##Proc##Init();               \
-    void Proc(){                                                                     \
-        DPL::Test::RunMultiProc(&Proc##Multi);                                       \
-    }                                                                                \
-    void Proc##Multi()
+#define RUNNER_MULTIPROCESS_TEST(Proc, ...)                                             \
+    void Proc(std::tuple<__VA_ARGS__> &optionalArgsTuple);                              \
+    void Proc##Multi(std::tuple<__VA_ARGS__> &optionalArgsTuple);                       \
+    static int Static##Proc##Init()                                                     \
+    {                                                                                   \
+        DPL::Test::TestRunnerSingleton::Instance().RegisterTest(                        \
+            new DPL::Test::TestCaseExtended<__VA_ARGS__>(#Proc, &Proc));                \
+        return 0;                                                                       \
+    }                                                                                   \
+    const int DPL_UNUSED Static##Proc##InitVar = Static##Proc##Init();                  \
+    void Proc(std::tuple<__VA_ARGS__> &optionalArgsTuple) {                             \
+        DPL::Test::RunMultiProc(std::bind(Proc##Multi, optionalArgsTuple));             \
+    }                                                                                   \
+    void Proc##Multi(std::tuple<__VA_ARGS__> &optionalArgsTuple DPL_UNUSED)
 
 #endif // DPL_TEST_RUNNER_MULTIPROCESS_H
index 95e1698..33a4ef7 100644 (file)
 #include <pcrecpp.h>
 #include <algorithm>
 #include <cstdio>
-#include <memory.h>
+#include <exception>
+#include <functional>
+#include <memory>
+#include <string>
 
 #include <libxml/xpath.h>
 #include <libxml/xpathInternals.h>
@@ -55,13 +58,33 @@ std::string getXMLNode(xmlNodePtr node)
 
 }
 
-
 namespace DPL {
 namespace Test {
 
-void TestRunner::RegisterTest(const char *testName, TestCase proc)
+TestResult::FailStatus TryCatch(const std::function<void(void)> &func, std::string &reason) {
+    try {
+        func();
+    } catch (const DPL::Test::TestFailed &e) {
+        reason = e.GetMessage();
+        return TestResult::FailStatus::FAILED;
+    } catch (const DPL::Test::TestIgnored &e) {
+        reason = e.GetMessage();
+        return TestResult::FailStatus::IGNORED;
+    } catch (const std::exception &e) {
+        reason = e.what();
+        return TestResult::FailStatus::FAILED;
+    } catch (...) {
+        reason = "Unknown exception";
+        return TestResult::FailStatus::FAILED;
+    }
+    reason = std::string();
+    return TestResult::FailStatus::NONE;
+}
+
+void TestRunner::RegisterTest(TestCasePtr testCase)
 {
-    m_testGroups[m_currentGroup].push_back(TestCaseStruct(testName, proc));
+    m_testGroups[m_currentGroup].push_back(testCase);
+    m_testCaseSet.insert(testCase);
 }
 
 void TestRunner::InitGroup(const char* name)
@@ -99,9 +122,9 @@ bool TestRunner::filterGroupsByXmls(const std::vector<std::string> & files)
         {
             if(!cit->second.empty())
             {
-                for(TestCaseStructList::const_iterator cj = cit->second.begin(); cj != cit->second.end(); ++cj)
+                for(TestCaseList::const_iterator cj = cit->second.begin(); cj != cit->second.end(); ++cj)
                 {
-                    std::string name = cj->name;
+                    std::string name = (*cj)->GetName();
                     std::string::size_type st = name.find('_');
                     if(st != std::string::npos)
                     {
@@ -185,11 +208,11 @@ bool TestRunner::filterGroupsByXmls(const std::vector<std::string> & files)
 bool TestRunner::filterByXML(std::map<std::string, bool> & casesMap)
 {
     for (auto &group : m_testGroups) {
-        TestCaseStructList newList;
+        TestCaseList newList;
         for (auto &tc : group.second)
         {
-            if (casesMap.find(tc.name) != casesMap.end()) {
-                casesMap[tc.name] = true;
+            if (casesMap.find(tc->GetName()) != casesMap.end()) {
+                casesMap[tc->GetName()] = true;
                 newList.push_back(tc);
             }
         }
@@ -206,49 +229,51 @@ bool TestRunner::filterByXML(std::map<std::string, bool> & casesMap)
     return true;
 }
 
-void TestRunner::RunTestCase(const TestCaseStruct& testCase)
+void TestRunner::RunTestCase(TestCasePtr testCase)
 {
-    setCurrentTestCase(&(const_cast<TestCaseStruct &>(testCase)));
+    setCurrentTestCase(testCase);
     m_deferDeepness = 0U;
-    try {
-        testCase.proc();
-    } catch (const TestFailed &e) {
-        // Simple test failure
-        CollectResult(testCase.name,
-                      TestResult(TestResult::FailStatus::FAILED,
-                                 getConcatedFailReason(e.GetMessage())));
-
-        setCurrentTestCase(nullptr);
-        return;
-    } catch (const TestIgnored &e) {
-        if (m_runIgnored) {
-            // Simple test have to be implemented
-            CollectResult(testCase.name,
-                          TestResult(TestResult::FailStatus::IGNORED, e.GetMessage()));
-        }
 
+    std::string initReason;
+    TestResult::FailStatus initStatus = TryCatch(std::bind(&TestCase::Init, testCase),
+                                                 initReason);
+    if (initStatus != TestResult::FailStatus::NONE) {
+        CollectResult(testCase->GetName(),
+                      TestResult(initStatus, getConcatedFailReason(initReason), testCase->GetPerformance()));
         setCurrentTestCase(nullptr);
         return;
-    } catch (const std::exception &) {
-        // std exception failure
-        CollectResult(testCase.name,
-                      TestResult(TestResult::FailStatus::FAILED, "std exception"));
+    }
 
-        setCurrentTestCase(nullptr);
-        return;
-    } catch (...) {
-        // Unknown exception failure
-        CollectResult(testCase.name,
-                      TestResult(TestResult::FailStatus::FAILED, "unknown exception"));
-        setCurrentTestCase(nullptr);
-        return;
+    std::string testReason;
+    TestResult::FailStatus testStatus = TryCatch(std::bind(&TestCase::Test, testCase),
+                                                 testReason);
+    testReason = getConcatedFailReason(testReason);
+    std::string finishReason;
+    TestResult::FailStatus finishStatus = TryCatch(std::bind(&TestCase::Finish, testCase),
+                                                   finishReason);
+    finishReason = getConcatedFailReason(finishReason);
+
+    switch (finishStatus) {
+        case TestResult::FailStatus::FAILED:
+            testStatus = TestResult::FailStatus::FAILED;
+            if (!testReason.empty())
+                testReason += "\n";
+            testReason += finishReason;
+            break;
+        case TestResult::FailStatus::IGNORED:
+            if (testStatus == TestResult::FailStatus::NONE)
+                testStatus = TestResult::FailStatus::IGNORED;
+            if (!testReason.empty())
+                testReason += "\n";
+            testReason += finishReason;
+        case TestResult::FailStatus::NONE:
+            break;
+        default:
+            Assert(false && "Unhandled fail status");
     }
 
-    // Everything OK
-    CollectResult(testCase.name,
-                  TestResult(TestResult::FailStatus::NONE,
-                             std::string(),
-                             testCase.performance));
+    CollectResult(testCase->GetName(),
+                  TestResult(testStatus, testReason, testCase->GetPerformance()));
     setCurrentTestCase(nullptr);
 }
 
@@ -268,19 +293,19 @@ void TestRunner::RunTests()
     fprintf(stderr, "%sFound %d testcases...%s\n", GREEN_BEGIN, count, GREEN_END);
     fprintf(stderr, "%s%s%s\n", GREEN_BEGIN, "Running tests...", GREEN_END);
     for (auto &group : m_testGroups) {
-        TestCaseStructList list = group.second;
+        TestCaseList list = group.second;
         if (!list.empty()) {
             for (auto &collector : m_collectors) {
                 collector.second->CollectCurrentTestGroupName(group.first);
             }
-            list.sort();
+            list.sort([](const TestCasePtr &a, const TestCasePtr &b) { return (*a < *b); });
 
-            for (TestCaseStructList::const_iterator iterator = list.begin();
+            for (TestCaseList::const_iterator iterator = list.begin();
                  iterator != list.end();
                  ++iterator)
             {
-                TestCaseStruct test = *iterator;
-                if (m_startTestId == test.name) {
+                TestCasePtr test = *iterator;
+                if (m_startTestId == test->GetName()) {
                     m_startTestId = "";
                 }
 
@@ -306,51 +331,53 @@ void TestRunner::RunTests()
     fprintf(stderr, "%s%s%s\n\n", GREEN_BEGIN, "Finished", GREEN_END);
 }
 
-TestRunner::TestCaseStruct *TestRunner::getCurrentTestCase()
+TestCasePtr TestRunner::getCurrentTestCase()
 {
     return m_currentTestCase;
 }
 
-void TestRunner::setCurrentTestCase(TestCaseStruct* testCase)
+void TestRunner::setCurrentTestCase(TestCasePtr testCase)
 {
     m_currentTestCase = testCase;
 }
 
 void TestRunner::beginPerformance(std::chrono::system_clock::duration maxDurationInMicroseconds)
 {
-    TestCaseStruct* testCase = getCurrentTestCase();
+    TestCasePtr testCase = getCurrentTestCase();
     if (!testCase)
         return;
 
-    if (!testCase->performance)
-        testCase->performance.reset(new PerformanceResult(maxDurationInMicroseconds));
+    if (!testCase->GetPerformance())
+        testCase->SetPerformance(
+            std::unique_ptr<PerformanceResult>                  \
+            (new PerformanceResult(maxDurationInMicroseconds)));
 }
 
 void TestRunner::endPerformance()
 {
-    TestCaseStruct* testCase = getCurrentTestCase();
+    TestCasePtr testCase = getCurrentTestCase();
     if (!testCase)
         return;
 
-    testCase->performance->Finish();
+    testCase->GetPerformance()->Finish();
 }
 
 ConstPerformanceResultPtr TestRunner::getCurrentTestCasePerformanceResult()
 {
-    TestCaseStruct* testCase = getCurrentTestCase();
+    TestCasePtr testCase = getCurrentTestCase();
     if (!testCase)
         return nullptr;
 
-    return testCase->performance;
+    return testCase->GetPerformance();
 }
 
 void TestRunner::setCurrentTestCasePerformanceResult(const PerformanceResultPtr &performance)
 {
-    TestCaseStruct* testCase = getCurrentTestCase();
+    TestCasePtr testCase = getCurrentTestCase();
     if (!testCase)
         return;
 
-    testCase->performance = performance;
+    testCase->SetPerformance(performance);
 }
 
 void TestRunner::addFailReason(const std::string &reason)
@@ -369,8 +396,17 @@ std::string TestRunner::getConcatedFailReason(const std::string &reason)
     return reason + ret;
 }
 
+TestRunner::~TestRunner()
+{
+    for(auto &t : m_testCaseSet)
+        delete t;
+}
+
 void TestRunner::CollectResult(const std::string& id, const TestResult& result)
 {
+    if (result.GetFailStatus() == TestResult::FailStatus::IGNORED && m_runIgnored)
+        return;
+
     std::for_each(m_collectors.begin(),
                   m_collectors.end(),
                   [&](const TestResultsCollectors::value_type & collector)
@@ -499,7 +535,7 @@ int TestRunner::ExecTestRunner(ArgsList args)
             arg.erase(0, startCmd.length());
             for (auto &group : m_testGroups) {
                 for (auto &tc : group.second) {
-                    if (tc.name == arg) {
+                    if (tc->GetName() == arg) {
                         m_startTestId = arg;
                         break;
                     }
@@ -520,7 +556,7 @@ int TestRunner::ExecTestRunner(ArgsList args)
             TestCaseGroupMap::iterator found = m_testGroups.find(arg);
             if (found != m_testGroups.end()) {
                 std::string name = found->first;
-                TestCaseStructList newList = found->second;
+                TestCaseList newList = found->second;
                 m_testGroups.clear();
                 m_testGroups[name] = newList;
             } else {
@@ -541,7 +577,7 @@ int TestRunner::ExecTestRunner(ArgsList args)
         } else if (arg.find(listInGroup) == 0) {
             arg.erase(0, listInGroup.length());
             for (auto &test : m_testGroups[arg]) {
-                printf("ID:%s\n", test.name.c_str());
+                printf("ID:%s\n", test->GetName().c_str());
             }
             return 0;
         } else if (arg.find(allowChildLogs) == 0) {
@@ -585,10 +621,10 @@ int TestRunner::ExecTestRunner(ArgsList args)
 
             pcrecpp::RE re(arg.c_str());
             for (auto &group : m_testGroups) {
-                TestCaseStructList newList;
+                TestCaseList newList;
                 for (auto &tc : group.second)
                 {
-                    if (re.PartialMatch(tc.name)) {
+                    if (re.PartialMatch(tc->GetName())) {
                         newList.push_back(tc);
                     }
                 }
@@ -634,7 +670,7 @@ int TestRunner::ExecTestRunner(ArgsList args)
     {
         for (auto &group : m_testGroups) {
             for (auto &tc : group.second) {
-                printf("ID:%s:%s\n", group.first.c_str(), tc.name.c_str());
+                printf("ID:%s:%s\n", group.first.c_str(), tc->GetName().c_str());
             }
         }
         return 0;
index e2efb02..fcb745e 100644 (file)
@@ -20,6 +20,7 @@
  * @brief       This file is the implementation file of test runner
  */
 #include <stddef.h>
+#include <dpl/assert.h>
 #include <dpl/test/test_failed.h>
 #include <dpl/test/test_ignored.h>
 #include <dpl/test/test_runner.h>
@@ -287,7 +288,7 @@ PipeWrapper::Status PipeWrapper::readHelp(void *buf, int size, time_t deadline)
     return SUCCESS;
 }
 
-void RunChildProc(TestRunner::TestCase procChild)
+void RunChildProc(const std::function<void(void)> &testFunc)
 {
     PipeWrapper pipe;
     if (!pipe.isReady()) {
@@ -339,9 +340,6 @@ void RunChildProc(TestRunner::TestCase procChild)
         // End Runner after current test
         TestRunnerSingleton::Instance().Terminate();
 
-        int code = CHILD_TEST_PASS;
-        std::string msg;
-
         bool allowLogs = TestRunnerSingleton::Instance().GetAllowChildLogs();
 
         close(STDIN_FILENO);
@@ -351,17 +349,20 @@ void RunChildProc(TestRunner::TestCase procChild)
 
         pipe.setUsage(PipeWrapper::WRITEONLY);
 
-        try {
-            procChild();
-        } catch (const DPL::Test::TestFailed &e) {
-            msg = e.GetMessage();
-            code = CHILD_TEST_FAIL;
-        } catch (const DPL::Test::TestIgnored &e) {
-            msg = e.GetMessage();
-            code = CHILD_TEST_IGNORED;
-        } catch (...) { // catch all exception generated by "user" code
-            msg = "unhandled exeception";
-            code = CHILD_TEST_FAIL;
+        int code;
+        std::string msg;
+        switch (TryCatch(testFunc, msg)) {
+            case TestResult::FailStatus::FAILED:
+                code = CHILD_TEST_FAIL;
+                break;
+            case TestResult::FailStatus::IGNORED:
+                code = CHILD_TEST_IGNORED;
+                break;
+            case TestResult::FailStatus::NONE:
+                code = CHILD_TEST_PASS;
+                break;
+            default:
+                Assert(false && "Unhandled fail status");
         }
 
         if (allowLogs) {
index 55e889b..81729c5 100644 (file)
@@ -21,6 +21,7 @@
  */
 
 #include <sys/file.h>
+#include <dpl/assert.h>
 #include <dpl/exception.h>
 #include <dpl/test/test_failed.h>
 #include <dpl/test/test_ignored.h>
@@ -131,11 +132,9 @@ PipeWrapper::Status SimplePipeWrapper::receive(std::string &data, bool &empty, t
     return ERROR;
 }
 
-void RunMultiProc(TestRunner::TestCase procMulti)
+void RunMultiProc(const std::function<void(void)> &testFunc)
 {
     SimplePipeWrapper pipe;
-    int code = MULTI_TEST_PASS;
-    std::string msg = "";
     int pipeReturn;
 
     int waitStatus;
@@ -147,21 +146,20 @@ void RunMultiProc(TestRunner::TestCase procMulti)
     }
     // pipe
 
-    try {
-        procMulti();
-    } catch (const TestFailed &e) {
-        code = MULTI_TEST_FAILED;
-        msg = e.GetMessage();
-    } catch (const TestIgnored &e) {
-        code = MULTI_TEST_IGNORED;
-        msg = e.GetMessage();
-    } catch (const std::exception &) {
-        code = MULTI_TEST_FAILED;
-        msg = "std exception";
-    } catch (...) {
-        // Unknown exception failure
-        code = MULTI_TEST_FAILED;
-        msg = "unknown exception";
+    int code;
+    std::string msg;
+    switch (TryCatch(testFunc, msg)) {
+        case TestResult::FailStatus::FAILED:
+            code = MULTI_TEST_FAILED;
+            break;
+        case TestResult::FailStatus::IGNORED:
+            code = MULTI_TEST_IGNORED;
+            break;
+        case TestResult::FailStatus::NONE:
+            code = MULTI_TEST_PASS;
+            break;
+        default:
+            Assert(false && "Unhandled fail status");
     }
 
     while (true) {
index deaab41..96c9c1d 100644 (file)
@@ -50,10 +50,16 @@ INSTALL(FILES ${TEST_APP_EFL}
                 WORLD_READ
                 WORLD_EXECUTE)
 
-execute_process(COMMAND ln -s /usr/bin/wrt-client ${CMAKE_CURRENT_BINARY_DIR}/${TEST_APP_WGT} )
-
-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${TEST_APP_WGT}
-    DESTINATION  /usr/bin)
+INSTALL(FILES ${TEST_APP_EFL}
+    DESTINATION  /usr/bin
+    RENAME ${TEST_APP_WGT}
+    PERMISSIONS OWNER_READ
+                OWNER_WRITE
+                OWNER_EXECUTE
+                GROUP_READ
+                GROUP_EXECUTE
+                WORLD_READ
+                WORLD_EXECUTE)
 
 SET(LPC_TARGET_TEST "libprivilege-control-test")
 
index 3afb04b..031782a 100644 (file)
@@ -32,6 +32,7 @@
 #include <privilege-control.h>
 #include <tests_common.h>
 #include <unistd.h>
+#include <tzplatform_config.h>
 
 // How many open file descriptors should ftw() function use?
 #define FTW_MAX_FDS 16
@@ -45,6 +46,9 @@
 #define APPID_DIR              "test_APP_ID_dir"
 #define GENERATED_APP_ID       "User" // TODO to be replaced in the future
 
+const uid_t TZ_APP_UID = tzplatform_getuid(TZ_USER_NAME);
+const gid_t TZ_APP_GID = tzplatform_getgid(TZ_USER_NAME);
+
 #define PERM_TO_REDEFINE       "Test::RedefinePermission"
 #define PERM_SUB_TO_REDEFINE   "Test::RedefinePermission::Sub"
 
index f3a4a70..5cb0918 100644 (file)
@@ -198,6 +198,13 @@ void test_set_app_privilege(
 
     int result;
 
+    /* Remove the group file to make sure other tests do not affect current one. This is because all
+       apps get the same label "User" */
+    const char* db_file = tzplatform_mkpath(TZ_SYS_DB,".privilege_control_app_gids.db");
+    RUNNER_ASSERT_MSG(db_file, "Failed to get groups db path");
+    result = unlink(db_file);
+    RUNNER_ASSERT_MSG(result == 0, "Removing group db failed " << strerror(errno));
+
     DB_BEGIN
 
     result = perm_app_uninstall(app_id);
@@ -221,7 +228,7 @@ void test_set_app_privilege(
     RUNNER_ASSERT_MSG(result == 1, "Permissions not added.");
 
     std::set<unsigned> groups_before;
-    read_user_gids(groups_before, APP_UID);
+    read_user_gids(groups_before, TZ_APP_UID);
 
     result = perm_app_set_privilege(app_id, type, app_path);
     RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
@@ -247,7 +254,7 @@ void test_set_app_privilege(
  */
 RUNNER_CHILD_TEST_SMACK(privilege_control05_set_app_privilege_wgt)
 {
-    test_set_app_privilege(WGT_APP_ID, APP_TYPE_WGT, PRIVS_WGT, "wgt", WGT_APP_PATH,
+    test_set_app_privilege(GENERATED_APP_ID, APP_TYPE_WGT, PRIVS_WGT, "wgt", WGT_APP_PATH,
             LIBPRIVILEGE_TEST_DAC_FILE_WGT, rules_wgt);
 }
 
@@ -256,13 +263,13 @@ RUNNER_CHILD_TEST_SMACK(privilege_control05_set_app_privilege_wgt)
  */
 RUNNER_CHILD_TEST_SMACK(privilege_control05_set_app_privilege_osp)
 {
-    test_set_app_privilege(OSP_APP_ID, APP_TYPE_OSP, PRIVS_OSP, "tpk", OSP_APP_PATH,
+    test_set_app_privilege(GENERATED_APP_ID, APP_TYPE_OSP, PRIVS_OSP, "tpk", OSP_APP_PATH,
             LIBPRIVILEGE_TEST_DAC_FILE_OSP, rules_osp);
 }
 
 RUNNER_CHILD_TEST_SMACK(privilege_control05_set_app_privilege_efl)
 {
-    test_set_app_privilege(EFL_APP_ID, APP_TYPE_EFL, PRIVS_EFL,
+    test_set_app_privilege(GENERATED_APP_ID, APP_TYPE_EFL, PRIVS_EFL,
             "rpm", EFL_APP_PATH,
             LIBPRIVILEGE_TEST_DAC_FILE_EFL, rules_efl);
 }
index dcef042..03fdf23 100644 (file)
@@ -138,7 +138,7 @@ void test_set_app_privilege_nosmack(
             " Permissions shouldn't be added. Result: " << result);
 
     std::set<unsigned> groups_before;
-    read_user_gids(groups_before, APP_UID);
+    read_user_gids(groups_before, TZ_APP_UID);
 
     result = perm_app_set_privilege(app_id, type, app_path);
     RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
@@ -176,7 +176,7 @@ RUNNER_CHILD_TEST_NOSMACK(privilege_control05_set_app_privilege_nosmack)
     DB_END
 
     std::set<unsigned> groups_before;
-    read_user_gids(groups_before, APP_UID);
+    read_user_gids(groups_before, TZ_APP_UID);
 
     //Set app privileges
     result = perm_app_set_privilege(APP_ID, nullptr, APP_SET_PRIV_PATH);
@@ -191,8 +191,8 @@ RUNNER_CHILD_TEST_NOSMACK(privilege_control05_set_app_privilege_nosmack)
     RUNNER_ASSERT_MSG(label == nullptr, "new_label_from_self shouldn't allocate memory for label.");
 
     //Check if DAC privileges really set
-    RUNNER_ASSERT_MSG(getuid() == APP_UID, "Wrong UID");
-    RUNNER_ASSERT_MSG(getgid() == APP_GID, "Wrong GID");
+    RUNNER_ASSERT_MSG(getuid() == TZ_APP_UID, "Wrong UID");
+    RUNNER_ASSERT_MSG(getgid() == TZ_APP_GID, "Wrong GID");
 
     result = strcmp(getenv("HOME"), APP_HOME_DIR);
     RUNNER_ASSERT_MSG(result == 0, "Wrong HOME DIR. Result: " << result);
index fd4242a..31d9162 100644 (file)
@@ -230,16 +230,18 @@ void privilege_control22_app_installation_1x100(bool smack)
 
             // Verify that all permissions to public dir have been added
             // correctly, also to other app
-            result = smack_have_access(APP_ID, shared_dir_auto_label.c_str(), "rwxatl");
+            result = smack_have_access(GENERATED_APP_ID, shared_dir_auto_label.c_str(), "rwxatl");
 
             RUNNER_ASSERT_MSG(result == expected_smack_result,
                    "Not all accesses to Public RO dir are granted. Loop index: "
                    << i);
 
-            result = smack_have_access(TEST_OSP_FEATURE_APP_ID, shared_dir_auto_label.c_str(), "rx" );
+            /* all apps are getting the label "User" at the moment. Calling smack_have_access with
+               "User" as an argument is no different from previous call */
+            /*result = smack_have_access(TEST_OSP_FEATURE_APP_ID, shared_dir_auto_label.c_str(), "rx" );
             RUNNER_ASSERT_MSG(result == expected_smack_result,
                    "Not all accesses to Public RO dir are granted. Loop index: "
-                   << i);
+                   << i);*/
 
             break;
         }
@@ -275,27 +277,29 @@ void privilege_control22_app_installation_1x100(bool smack)
 
             // Verify that setting app has rwx permission to app dir
             // and rx permissions to app
-            result = smack_have_access(APP_ID, shared_dir_auto_label.c_str(), "rwxatl");
+            result = smack_have_access(GENERATED_APP_ID, shared_dir_auto_label.c_str(), "rwxatl");
             RUNNER_ASSERT_MSG(result == expected_smack_result,
                  "Not all accesses to App-Setting dir are granted. "
                  << APP_ID << " "<< shared_dir_auto_label << " rwxatl "
                  << "Loop index: " << i);
 
-            result = smack_have_access(APP_TEST_SETTINGS_ASP1, shared_dir_auto_label.c_str(), "rwx");
+            /* all apps are getting the label "User" at the moment. Calling smack_have_access with
+               "User" as an argument is no different from previous call */
+            /*result = smack_have_access(APP_TEST_SETTINGS_ASP1, shared_dir_auto_label.c_str(), "rwx");
             RUNNER_ASSERT_MSG(result == expected_smack_result,
                  "Not all accesses to App-Setting dir are granted. "
                  << APP_TEST_SETTINGS_ASP1 << " " << shared_dir_auto_label << " rwx. "
                  << "Loop index: " << i);
 
-            result = smack_have_access(APP_TEST_SETTINGS_ASP1, APP_ID, "rx");
+            result = smack_have_access(APP_TEST_SETTINGS_ASP1, GENERATED_APP_ID, "rx");
             RUNNER_ASSERT_MSG(result == expected_smack_result,
                  "Not all accesses to App-Setting dir are granted. "
-                 << APP_TEST_SETTINGS_ASP1 << " " <<  APP_ID <<  " rx"
-                 << "Loop index: " << i);
+                 << APP_TEST_SETTINGS_ASP1 << " " <<  GENERATED_APP_ID <<  " rx"
+                 << "Loop index: " << i);*/
 
             // Verify that all permissions to public dir have been added
             // correctly, also to other app
-            result = smack_have_access(APP_ID, LABEL_FOR_PUBLIC_SHARED_DIRS, "rwxatl");
+            result = smack_have_access(GENERATED_APP_ID, LABEL_FOR_PUBLIC_SHARED_DIRS, "rwxatl");
             RUNNER_ASSERT_MSG(result == expected_smack_result,
                  "Not all accesses to Group RW dir are granted. Loop index: "
                   << i);
@@ -307,14 +311,14 @@ void privilege_control22_app_installation_1x100(bool smack)
         // check if api-features permissions are added properly
         result = check_all_accesses(smack,
                                     (const rules_t) {
-                                     { APP_ID, TEST_OSP_FEATURE_APP_ID, "rxl" },
-                                     { APP_ID, TEST_WGT_FEATURE_APP_ID, "rwxl" } } );
+                                     { GENERATED_APP_ID, TEST_OSP_FEATURE_APP_ID, "rxl" },
+                                     { GENERATED_APP_ID, TEST_WGT_FEATURE_APP_ID, "rwxl" } } );
         RUNNER_ASSERT_MSG(result == 1,
                       "Not all permisions from api features added. Loop index: "
                       << i);
 
         // revoke permissions
-        result = perm_app_revoke_permissions(APP_ID);
+        result = perm_app_revoke_permissions(GENERATED_APP_ID);
         RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
                      "Error in perm_app_revoke_permissions. Loop index: " << i
                      << ". Result: " << result);
@@ -406,7 +410,9 @@ void privilege_control23_app_installation2_10x10(bool smack)
     // generate app ids: test_APP0, test_APP1, test_APP2 etc.:
     for (int i = 0; i < app_count; ++i)
     {
-        result = sprintf(app_ids[i], APP_ID "%d", i);
+        /* Libprivilege-control assigns "User" label to all apps. Replace it when individual labels
+           are supported. */
+        result = sprintf(app_ids[i], GENERATED_APP_ID);
         RUNNER_ASSERT_MSG(result > 0, "Cannot generate name for app nr: " << i);
     }
 
@@ -571,9 +577,10 @@ void privilege_control23_app_installation2_10x10(bool smack)
 
         DB_END
 
+        // All apps have the same label "User" so this check makes no sense.
         // Verify that some previously installed app does not have
         // any acces to app 0 and app 5 PRIVATE folders
-        for (int j = 0; j < app_count; ++j)
+        /*for (int j = 0; j < app_count; ++j)
         {
             // Apps 1-9 should not have any access to app 0
             if (j != 0)
@@ -598,7 +605,7 @@ void privilege_control23_app_installation2_10x10(bool smack)
                        ") has access to private label of: " << app_ids[5] <<
                        ". It may not be shared. Loop index: " << i << ".");
             }
-        } // End for Verify PRIVATE
+        }*/ // End for Verify PRIVATE
 
         // Verify that apps 1, 2 and 6 have all accesses to GROUP_RW folders
         result = check_all_accesses(smack,
@@ -648,8 +655,9 @@ void privilege_control23_app_installation2_10x10(bool smack)
                 RUNNER_ASSERT_MSG(result == 1,
                  "Not all accesses to owned Public RO dir are granted. App id: "
                  << app_ids[j] << "  Loop index: " << i);
+                // All apps have the same label "User" so this check makes no sense.
                 // Verify that there are no extra permissions to public dirs
-                result = check_no_accesses(smack,
+                /*result = check_no_accesses(smack,
                                (const rules_t) {
                                 { app_ids[j], shared_dir7_auto_label.c_str(), "w" },
                                 { app_ids[j], shared_dir7_auto_label.c_str(), "t" },
@@ -657,7 +665,7 @@ void privilege_control23_app_installation2_10x10(bool smack)
                                 { app_ids[j], shared_dir8_auto_label.c_str(), "t" } } );
                 RUNNER_ASSERT_MSG(result == 1,
                      "Unexpected extra permissions added for app:" << app_ids[j]
-                     << ". Loop index: " << i);
+                     << ". Loop index: " << i);*/
             }
             if (j == 7)
             {
@@ -667,8 +675,9 @@ void privilege_control23_app_installation2_10x10(bool smack)
                 RUNNER_ASSERT_MSG(result == 1,
                  "Not all accesses to owned Public RO dir are granted. App id: "
                  << app_ids[j] << " Loop index: " << i);
+                // All apps have the same label "User" so this check makes no sense.
                 // Verify that there are no extra permissions to public dirs
-                result = check_no_accesses(smack,
+                /*result = check_no_accesses(smack,
                                (const rules_t) {
                                 { app_ids[j], shared_dir3_auto_label.c_str(), "w" },
                                 { app_ids[j], shared_dir3_auto_label.c_str(), "t" },
@@ -676,7 +685,7 @@ void privilege_control23_app_installation2_10x10(bool smack)
                                 { app_ids[j], shared_dir8_auto_label.c_str(), "t" } } );
                 RUNNER_ASSERT_MSG(result == 1,
                      "Unexpected extra permissions added for app:" << app_ids[j]
-                     << ". Loop index: " << i);
+                     << ". Loop index: " << i);*/
             }
             if (j == 8)
             {
@@ -686,8 +695,9 @@ void privilege_control23_app_installation2_10x10(bool smack)
                 RUNNER_ASSERT_MSG(result == 1,
                  "Not all accesses to owned Public RO dir are granted. App id: "
                  << app_ids[j] << "  Loop index: " << i);
+                // All apps have the same label "User" so this check makes no sense.
                 // Verify that there are no extra permissions to other public dirs
-                result = check_no_accesses(smack,
+                /*result = check_no_accesses(smack,
                                (const rules_t) {
                                 { app_ids[j], shared_dir3_auto_label.c_str(), "w" },
                                 { app_ids[j], shared_dir3_auto_label.c_str(), "t" },
@@ -695,7 +705,7 @@ void privilege_control23_app_installation2_10x10(bool smack)
                                 { app_ids[j], shared_dir7_auto_label.c_str(), "t" } } );
                 RUNNER_ASSERT_MSG(result == 1,
                      "Unexpected extra permissions added for app:" << app_ids[j]
-                     << ". Loop index: " << i);
+                     << ". Loop index: " << i);*/
             }
 
             result = check_all_accesses(smack,
@@ -738,7 +748,8 @@ void privilege_control23_app_installation2_10x10(bool smack)
                  "Not all accesses to App-Setting dir are granted."
                  << app_ids[9] << " " << setting_dir9_auto_label
                  << " Loop index: " << i);
-        result = smack_have_access(APP_TEST_SETTINGS_ASP1, app_ids[4], "rx");
+        // All apps have the same label "User" so this check makes no sense.
+        /*result = smack_have_access(APP_TEST_SETTINGS_ASP1, app_ids[4], "rx");
         RUNNER_ASSERT_MSG(result == expected_smack_result,
                  "Not all accesses to App-Setting dir are granted."
                  << APP_TEST_SETTINGS_ASP1 << " " << app_ids[4]
@@ -757,7 +768,7 @@ void privilege_control23_app_installation2_10x10(bool smack)
         RUNNER_ASSERT_MSG(result == expected_smack_result,
                  "Not all accesses to App-Setting dir are granted."
                  << APP_TEST_SETTINGS_ASP1 << " " << setting_dir9_auto_label
-                 << " Loop index: " << i);
+                 << " Loop index: " << i);*/
 
 
 
@@ -802,8 +813,9 @@ void privilege_control23_app_installation2_10x10(bool smack)
 
         DB_END
 
+        // All apps have the same label "User" so this check makes no sense.
         // Check if permissions are removed properly
-        for (int j = 0; j < app_count; ++j)
+        /*for (int j = 0; j < app_count; ++j)
         {
             // To all other apps
             for (int k = 0; k < app_count; ++k)
@@ -816,7 +828,7 @@ void privilege_control23_app_installation2_10x10(bool smack)
                           "Not all permisions revoked. Subject: " << app_ids[j]
                           << " Object: " << app_ids[k] << " Loop index: " << i);
             }
-        }
+        }*/
 
         DB_BEGIN
 
index 27db73d..63a116c 100644 (file)
@@ -2072,6 +2072,7 @@ RUNNER_MULTIPROCESS_TEST(security_manager_17_privacy_manager_fetch_whole_policy_
 
 RUNNER_CHILD_TEST(security_manager_10_user_cynara_policy)
 {
+    RUNNER_IGNORED_MSG("temporarily disabled due to gumd timeouts");
     const char *const MAIN_BUCKET = "MAIN";
     const char *const MANIFESTS_BUCKET = "MANIFESTS";
     const char *const ADMIN_BUCKET = "ADMIN";
@@ -2098,6 +2099,7 @@ RUNNER_CHILD_TEST(security_manager_10_user_cynara_policy)
 
 RUNNER_CHILD_TEST(security_manager_11_security_manager_cmd_install)
 {
+    RUNNER_IGNORED_MSG("temporarily disabled due to gumd timeouts");
     int ret;
     const int SUCCESS = 0;
     const int FAILURE = 256;
@@ -2149,6 +2151,7 @@ RUNNER_CHILD_TEST(security_manager_11_security_manager_cmd_install)
 
 RUNNER_CHILD_TEST(security_manager_12_security_manager_cmd_users)
 {
+    RUNNER_IGNORED_MSG("temporarily disabled due to gumd timeouts");
     int ret;
     const int SUCCESS = 0;
     const int FAILURE = 256;