From: Lukasz Wojciechowski Date: Mon, 24 Nov 2014 11:37:10 +0000 (+0100) Subject: Check if cynara terminates, when no data are sent X-Git-Tag: security-manager_5.5_testing~164 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d099645d698bb19322cbc99f5e1ac97cac9ee792;p=platform%2Fcore%2Ftest%2Fsecurity-tests.git Check if cynara terminates, when no data are sent Test case tca12 covers bug found in cynara. Cynara terminates, when connection is closed and no data were sent. Change-Id: I0859cc9db1b252cb5d8ea786183d80334de8725a --- diff --git a/tests/cynara-tests/test_cases_async.cpp b/tests/cynara-tests/test_cases_async.cpp index 65cd4e6..fbb6079 100644 --- a/tests/cynara-tests/test_cases_async.cpp +++ b/tests/cynara-tests/test_cases_async.cpp @@ -31,6 +31,7 @@ #include #include +#include using namespace CynaraTestClientAsync; using namespace CynaraTestAdmin; @@ -406,6 +407,43 @@ void tca11_double_request_with_restart_func() client.process(CYNARA_API_SUCCESS, Client::IGNORE_TIMEOUT); } +void tca12_multiple_connections_without_requests_func() +{ + std::string testNo("12"); + + cynara_check_id id; + RequestEntity callbackData = {RequestFunction(), + CYNARA_API_ACCESS_DENIED, + CYNARA_CALL_CAUSE_FINISH}; + + DBusAccess dbusAccess(CynaraTestConsts::SERVICE.c_str()); + pid_t before = dbusAccess.getServicePid(); + timeval beforeTimestamp = dbusAccess.getServiceStartTimestamp(); + + for (int i = 0; i < 10; ++i) + { + Client client; + client.createRequest({testNo}, id, callbackData); + client.assertStatus(READWRITE); + } + +//wait until cynara possibly restarts + sleep(3); + + pid_t after = dbusAccess.getServicePid(); + timeval afterTimestamp = dbusAccess.getServiceStartTimestamp(); + RUNNER_ASSERT_MSG(after != 0, + "cynara service not running. After = " << after << "."); + RUNNER_ASSERT_MSG(before == after + && beforeTimestamp.tv_sec == afterTimestamp.tv_sec + && beforeTimestamp.tv_usec == afterTimestamp.tv_usec, + "cynara service was restarted during the test. Before pid / timestamp = " + << before << " / " << beforeTimestamp.tv_sec << "." + << beforeTimestamp.tv_usec << " and after pid / timestamp = " + << after << " / " << afterTimestamp.tv_sec << "." + << afterTimestamp.tv_usec); +} + RUNNER_TEST_GROUP_INIT(cynara_async_tests) RUN_CYNARA_TEST(tca01_initialize) @@ -424,3 +462,4 @@ 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)