Lukasz Wojciechowski [Fri, 20 Mar 2015 18:27:07 +0000 (19:27 +0100)]
Adjust restart of cynara in cynara-tests
Use new enhanced mechanism, that restarts also socket units
in cynara-tests.
Change-Id: I2eba2709e86b27a1a693dcf9774e88b6abb6c69b
Lukasz Wojciechowski [Fri, 20 Mar 2015 17:44:40 +0000 (18:44 +0100)]
Enhance ServiceManager with socket unit names
In case of socket activated services additional units responsible
for listening on sockets can be passed to ServiceManager constructor.
Starting, stopping and restarting a service can affect now not only
service unit but also socket units.
This enhancement is used for implementation of cynara restart methods
with and without restarting socket units.
Change-Id: I619c94d3fc75b398240e85cd39ae78e757e03f1a
Zbigniew Jasinski [Fri, 27 Mar 2015 09:56:31 +0000 (10:56 +0100)]
Merge branch 'tizen' into cynara
Change-Id: I200042de1bf9aa54ba974d64fc6eea40c29cd4e7
Lukasz Wojciechowski [Tue, 24 Mar 2015 19:32:02 +0000 (20:32 +0100)]
Merge branch 'cynara' into tizen
Conflicts:
src/framework/include/dpl/test/test_runner.h
src/framework/src/test_runner.cpp
Change-Id: I7186c1d1e8f60e453ea5ffe4f7cfd1e1eca3a3bb
Marcin Niesluchowski [Thu, 16 Oct 2014 14:17:18 +0000 (16:17 +0200)]
Remove unused CollectTestsCasesList function
Change-Id: Ic846bfbf38e74850be7cdfee6ca5ccc88b9ccfb5
Marcin Niesluchowski [Thu, 16 Oct 2014 08:54:15 +0000 (10:54 +0200)]
Remove unnecessary test result from test runner
Change-Id: I6a5257e0f4325f76219f798bc7e352fbef81376b
Marcin Niesluchowski [Wed, 15 Oct 2014 17:26:08 +0000 (19:26 +0200)]
Create class for test result
Change-Id: I5da9105e4577805230929ca7c0057f456ef76090
Marcin Niesluchowski [Mon, 20 Oct 2014 12:49:13 +0000 (14:49 +0200)]
Add PerformanceResult class
Test time measurement framework mechanism refactoring
for performance tests.
Change-Id: I08f3206f0dcd0504cb5bae6fa22f7480d5533a36
Pawel Wieczorek [Mon, 23 Mar 2015 16:24:58 +0000 (17:24 +0100)]
Extend list of tests done by security-tests-all.sh
Two more packages will be tested by executing security-tests-all.sh:
* libprivilege-control
* key-manager
Change-Id: I8fdefb6ff2c4a51060f2ac09179289b563596961
Pawel Wieczorek [Mon, 23 Mar 2015 16:18:48 +0000 (17:18 +0100)]
Add key-manager tests to test runner
Passing "ckm" argument to security-tests.sh script will result in
execution of "ckm-tests" binary. Previously it had to be called
explicitly.
Change-Id: Icacefde32d99832295ddaad045ae31be3d085ca8
Lukasz Wojciechowski [Fri, 20 Mar 2015 14:09:25 +0000 (15:09 +0100)]
Fix casting from and to void*
There were some places, where reinterpret_cast was used to cast
from or to void* type. This breaks C++ standard.
Fix replaces reinterpret_cast with static_cast.
Change-Id: I9bc5aa3307ce0b0fef4a988d14d06b01f290b853
Radoslaw Bartosiak [Fri, 30 Jan 2015 16:42:31 +0000 (17:42 +0100)]
Add additional libcynara-agent tests
Add test cases for: cynara_agent_initialize(), cynara_agent_finish(),
cynara_agent_get_request(), cynara_agent_put_response()
*) tcag08_get_request_and_respond_with_wrong_id - client shall not
receive a response.
*) tcag09_get_request_and_correct_responded_id - client shall
receive the response with correct id.
*) tcag10_cancel_request - client shall receive the confirmation of
its cancel action.
*) tcag11_cancel_processed_request - the cancelation of the request
processed by the agent is possible but void.
*) tcag12_create_two_requests - processing of two requests.
*) tcag13_create_many_requests - processing of many requests and
sending the responses by the agent in LIFO order.
*) tcag14_client_disconnects - the cancel request shall be sent by
Cynara when client disconnects.
*) tcag15_agent_disconnects - the access denied answer shall be
sent by Cynara when agent disconnects.
Change-Id: I45c11e79c4977bed6892166a51c336e0414fc02e
Signed-off-by: Radoslaw Bartosiak <r.bartosiak@samsung.com>
Lukasz Wojciechowski [Tue, 17 Mar 2015 15:10:06 +0000 (16:10 +0100)]
Use proper RUNNER_ASSERT macros
Don't print errno message, when it's not valid
or related to assert condition.
Change-Id: I7012d5c97c1504df3d78fec0eac997d99560e374
Lukasz Wojciechowski [Tue, 3 Feb 2015 18:21:11 +0000 (19:21 +0100)]
Add inner tests for deferred macros
Added 11 test cases cover all possible nestings
of deferred macros.
Change-Id: I35898876f7b2dca740836463a5744fe96972f609
Lukasz Wojciechowski [Mon, 12 Jan 2015 10:26:10 +0000 (11:26 +0100)]
Add inner tests for timeout mechanism
Inner tests are needed to check if timeout mechanism works correctly
on platform that tests are runned.
Risk of not working is elevated because it uses std::future::wait_for()
method, which implementation had bugs in older compilers.
Change-Id: I3eae4dcab59b1fcec0c46f870653d0ae18c4a85f
Lukasz Wojciechowski [Tue, 20 Jan 2015 14:18:37 +0000 (15:18 +0100)]
Apply defer macros to callbacks in cynara async client
After all cynara library functions were sorrounded with try catch
macros causing all exceptions to be caught, there is no way of
throwning an exception from inside of callback function.
This is where defer macros mechanism can be applied.
Now all exceptions will be rethrown after comming back from
libcynara-client-async API functions.
Change-Id: I9743557631f2b13cecddf33cb072f280ae689d0a
Lukasz Wojciechowski [Tue, 20 Jan 2015 14:17:12 +0000 (15:17 +0100)]
Add defer macros
Used to defer throwing TestException exceptions (TestFailed,
TestIgnored) by catching them and rethrowing later.
This mechanism can help in breaking test and passing test result
from places where throwing exceptions is not allowed
Change-Id: Ic9baa96596d15fccbbff4ac81b18f91b2eb89c8e
Lukasz Wojciechowski [Tue, 20 Jan 2015 14:15:36 +0000 (15:15 +0100)]
Move non-template functions to timeout.cpp file
Leaving them in timeout.h causes double definition of functions.
Change-Id: Ic425855ffd958b2adbb16672d486fcdcedaa8897
Lukasz Wojciechowski [Thu, 19 Feb 2015 14:27:36 +0000 (15:27 +0100)]
Define a base TestException class
A new base class DPL::Test::TestException is defined as base for
* DPL::Test::TestFailed (prev. DPL::Test::TestRunner::TestFailed),
* DPL::Test::TestIgnored (prev. DPL::Test::TestRunner::Ignored).
All three classes were moved into separate files.
Common base class simplifies handling of exceptions that can be
thrown during tests.
Change-Id: I1fadb09b7781bf22a0090043a46ca48c55c9962b
Lukasz Wojciechowski [Tue, 13 Jan 2015 13:53:47 +0000 (14:53 +0100)]
Add basic libcynara-agent tests
Add basic tests for libcynara-admin library:
* tcag01_set_agent_type_policy_without_plugin - check if setting
a policy with policy type provided by not loaded plugin fails;
* tcag02_set_agent_type_policy_with_plugin_loaded - checks if
setting policy with policy type provided by loaded plugin succeeds;
* tcag03_check_with_no_agent - run cynara check that causes usage
of plugin needing agent (but agent is not running) and verify
that check returns DENY;
* tcag04_agent_initialize - check initialization and deinitialization
og agent;
* tcag05_agent_request_timeout - run agent and register it in cynara
service, break connection by resetting cynara after timeout;
* tcag06_check_with_unregistered_agent - run cynara check that causes
usage of plugin needing agent (agent is running but not registered)
and verify that chack returns DENY;
* tcag07_get_request - run simplest complete agent usage scenario:
> agent registers in cynara,
> a check using plugin and agent is done,
> test acts as agent receiving and verifying request,
> an ALLOW response is sent to cynara,
> client receives proper ALLOW answer.
Change-Id: I781e9bb88b8686334acca4f9cf2c13a13bd643d5
Lukasz Wojciechowski [Wed, 11 Mar 2015 09:44:44 +0000 (10:44 +0100)]
Use functor object as main argument of callAndWait
Previous solution was based on std::function, that causes problems
because std::function template arguments needed to be explicitely
defined.
Functor simplifies usage of callAndWait.
Change-Id: If4f8a640848e41042e6841e49354510c08db5357
Lukasz Wojciechowski [Tue, 17 Mar 2015 14:27:16 +0000 (15:27 +0100)]
Add synchronization after file operations
After creating, copying and removing files program should
wait on disc synchronization, otherwise test can fail, e.g.
when we swap database files and start cynara, which loads
old not-yet-synchronized version of db.
Change-Id: Ie5c26da859e4e2a88311bb68ed7a0138b98e87d7
Lukasz Wojciechowski [Tue, 17 Mar 2015 12:31:40 +0000 (13:31 +0100)]
Load default database at every cynara-test startup
All tests assume that their are run on clear cynara database.
On real image database can contain some data. To save those data
save/restore mechanism existed. It was expanded with 3rd function
loading default database after original image database was saved.
Change-Id: If580a11b6558b8084c959366dcfa50a1ef92782c
Pawel Wieczorek [Mon, 12 Jan 2015 10:05:35 +0000 (11:05 +0100)]
Enhance compareDbs() with additional information
This patch adds printing more debugging information if an error occurs.
In case of database contents mismatch all the files in pattern and
result database are listed. In case of file contents mismatch filename
of corrupted file is printed.
Change-Id: I8e2bc2a6fdc976fac65e521accd6140ddfebef7e
Pawel Wieczorek [Mon, 15 Dec 2014 14:18:56 +0000 (15:18 +0100)]
Add checksum files for tests
Cynara will support database contents checksum validation shortly. This
patch adds proper checksum files to database patterns.
Change-Id: Ie1a61689765fe3f3e9fe010e7ba333ccbdae265f
Marcin Niesluchowski [Thu, 16 Oct 2014 12:24:55 +0000 (14:24 +0200)]
Add --no-verbose option to XML collector
With --no-verbose param fail/ignore reason is not displayed
Change-Id: I62c78186c4b560f409f66ad74be3a3f4005fda42
Marcin Niesluchowski [Thu, 16 Oct 2014 12:17:36 +0000 (14:17 +0200)]
Add --no-verbose option to HTML collector
With --no-verbose param fail/ignore reason is not displayed
Change-Id: I790d24f2db8b707df20f88e0df08ec20cf5eab03
Aleksander Zdyb [Thu, 18 Dec 2014 10:31:02 +0000 (11:31 +0100)]
Add SynchronizationPipe
A crippled abstraction of widely praised, but often
misused communication mechanism.
Change-Id: I2bd4b63dac76711ce22331c0bc666d4cd6021240
Aleksander Zdyb [Wed, 3 Sep 2014 06:26:39 +0000 (08:26 +0200)]
Add UDSHelpers (Helpers for Unix Domain Sockets)
Change-Id: Id4c0429c325bc828d7c928e1c12d2ba9ec2b6a9f
Aleksander Zdyb [Tue, 18 Nov 2014 10:07:05 +0000 (11:07 +0100)]
Add PasswdAccess
A wrapper on getpwnam() and getgrnam().
Change-Id: Ib833b6c1922ad45de3f713f29a904283d094600f
Marcin Niesluchowski [Thu, 16 Oct 2014 12:21:58 +0000 (14:21 +0200)]
Add --no-verbose option to Console collector
With --no-verbose param fail/ignore reason is not displayed
Change-Id: Id2d0b93424f0ece32cad90d23b815146f4c6d111
Aleksander Zdyb [Fri, 6 Mar 2015 12:16:55 +0000 (13:16 +0100)]
Fix usertype in gum-utils invocation
Change-Id: I501a30549b0d7c5b94653250109db4aae9c1b5c7
Marcin Niesluchowski [Mon, 17 Nov 2014 15:45:12 +0000 (16:45 +0100)]
Move collectors' file help to collectors' commons
Change-Id: I89d03b06c97de61f06bad3c483c9cf7d4442c3dd
Marcin Niesluchowski [Mon, 16 Feb 2015 13:24:04 +0000 (14:24 +0100)]
Merge branch 'tizen' into cynara
Change-Id: I52bb94b85304e141e2462067d8c8dae80fe53081
Lukasz Wojciechowski [Mon, 9 Feb 2015 13:26:04 +0000 (14:26 +0100)]
Add inner security-tests tests
Inner tests might be useful in case of:
* verification of advanced security-tests mechanisms;
* testing if platform/image support features used in tests.
Change-Id: Ibd9b5d97af33742434d00fd3d682456c1a8d51ff
Lukasz Wojciechowski [Mon, 9 Feb 2015 10:16:23 +0000 (11:16 +0100)]
Move tests source code from "tests" to "src" directory
Change-Id: Icb325be4a37b9937290d7f3a4d35a1b3625b223a
Marcin Niesluchowski [Thu, 22 Jan 2015 14:31:17 +0000 (15:31 +0100)]
Merge branch 'cynara' into tizen
Conflicts:
tests/common/dbus_access.cpp
tests/common/dbus_access.h
tests/cynara-tests/common/cynara_test_env.cpp
tests/framework/include/dpl/test/test_runner.h
Change-Id: I91f595f8a92ceafd071c4db0d70f7431447bab48
Adam Malinowski [Thu, 22 Jan 2015 12:43:07 +0000 (13:43 +0100)]
Rename file operation functions of cynara-tests
Change-Id: Ie24d7360dacf9f236ed36eaaaafbba1913d6e8dd
Marcin Niesluchowski [Thu, 15 Jan 2015 12:48:09 +0000 (13:48 +0100)]
Refactor gdbbacktrace() function
Add safer, less redundant code and make it part of DPL namespace
Change-Id: I19e4704f4600d9720e939b0d76aa143c5d82ec2f
Lukasz Wojciechowski [Mon, 12 Jan 2015 10:16:34 +0000 (11:16 +0100)]
Add timeout mechanism for time-limited function calls
Timeout mechanism:
1) launches given function in new thread;
2) waits given time period;
3) cancels called function using custom user CancelFunction;
4) checks if function has finished in expected way;
5) returns function answer (value or exception).
Change-Id: Ia65d271095712e6afaaac96932f8d14d61b1702a
Lukasz Wojciechowski [Thu, 8 Jan 2015 10:24:27 +0000 (11:24 +0100)]
Add Agent class wrapping usage of libcynara-agent
With Agent object tests can play role of cynara agent and
communicate with cynara service. That can be useful for:
* testing libcynara-agent library;
* using agent in plugins testing;
* using agent in asynchronous client testing.
Change-Id: Idc783fa963074d5ff6f1dedb6a89b6aae6f65dbe
Lukasz Wojciechowski [Fri, 9 Jan 2015 01:44:45 +0000 (02:44 +0100)]
Add test-agent plugin
This is a test plugin, that sends all requests to agent.
Security tests can play role of this agent, so they can decide
about time and value of a response.
Change-Id: I278229810a84cdb4a3ff01ad8ef714019507f0c1
Lukasz Wojciechowski [Fri, 9 Jan 2015 01:41:17 +0000 (02:41 +0100)]
Add agent data wrapping functions
Add functions for easy joining and spliting data strings
used in communication between agent and plugins:
* wrapAgentData;
* unwrapAgentData.
This functions are defined in new file plugins.cpp - a common file
for both agent and plugins.
Change-Id: I29494928d752832aef7c8e14204a7e4ce63a911e
Lukasz Wojciechowski [Mon, 5 Jan 2015 10:26:21 +0000 (11:26 +0100)]
Add tests for cynara_admin_list_policies_descriptions
Each of added tests uses the fact that every cynara test is wrapped in
CynaraTestEnv that saves cynara service plugins.
Every test clears cynara service plugins folder and restarts cynara.
Then proper combination of plugins (sometimes none) are loaded.
There are 4 tests added:
* tc30_admin_list_descriptions_no_plugins - no plugins are loaded,
there are only default cynara policies;
* tc31_admin_list_descriptions_1_plugin_single_policy;
* tc32_admin_list_descriptions_1_plugin_multiple_policy;
* tc33_admin_list_descriptions_multiple_plugins.
Change-Id: Id778477c35a6d65a7d4f71df03dcccefcbb6e756
Lukasz Wojciechowski [Mon, 5 Jan 2015 10:23:32 +0000 (11:23 +0100)]
Add wrap for cynara_admin_list_policies_description
Add method Admin::listDescriptions executing
cynara_admin_list_policies_description and checking if received result
match expected.
Change-Id: I1d729f83e2719360be5e4cdf405409561377c410
Lukasz Wojciechowski [Mon, 12 Jan 2015 16:55:23 +0000 (17:55 +0100)]
Add loadServicePlugins() for setting plugins env
Added function removes all cynara service plugins
and then import and load plugins from given directory.
Change-Id: I1fa559111c70c04e7522089a2bfed4ec9837f590
Lukasz Wojciechowski [Fri, 2 Jan 2015 19:18:13 +0000 (20:18 +0100)]
Enhance CynaraTestEnv with operations on service plugins
save() and restore() methods were enhanced with saving and restoring
cynara service plugins libraries.
Change-Id: If21707314d4a628db7c9d4034f1d4d7a9e82c55b
Lukasz Wojciechowski [Mon, 12 Jan 2015 16:13:17 +0000 (17:13 +0100)]
Introduce CynaraMask - a scoped cynara.service masker
Creation of CynaraMask object causes cynara.service to be masked and stopped.
Its removal causes cynara to be unmasked and run again.
Change-Id: Id7c20093fbd4ec19cdba783b20225ece04be5dfb
Lukasz Wojciechowski [Mon, 12 Jan 2015 15:34:56 +0000 (16:34 +0100)]
Separate file operations into separate file
All files operations done in cynara_test_env are moved to new namespace FileOperations
and implemented in cynara_test_file_operations.cpp file.
cynaraDbExists() function was generalized to dirExists(string) function.
Change-Id: Ic610078330074a648dbb24ddec7297a337a41de0
Lukasz Wojciechowski [Fri, 2 Jan 2015 17:09:17 +0000 (18:09 +0100)]
Add test cynara service plugins
There are two added plugins:
* single-policy plugin - declaring single policy type handling
* multiple-policy plugin - declaring multiple policy types handling
Plugins always return DENY policy type as result of check or update.
They are just test stubs for testing cynara_admin_list_policies_description.
Implementation of both plugins is embedded in BaseCynaraTestPlugin class.
Supported policies descriptions are put into plugins.h for later use in tests.
Change-Id: I38f4bcfe9624992eea3ef5a015885a397f5a0380
Marcin Niesluchowski [Wed, 15 Oct 2014 15:44:38 +0000 (17:44 +0200)]
Remove description param from test result collecting function
Change-Id: I75f757abd6350456cbf572833b68a7a4aa8647e5
Lukasz Wojciechowski [Fri, 2 Jan 2015 19:32:12 +0000 (20:32 +0100)]
Fix uninitialized variable in Admin::listPolicies()
struct cynara_admin_policy **policies was uninitialized.
Normally it should be filled with cynara_admin_list_policies() call.
However, when that function failes, it leaves policies unaffected.
If this pointer is not NULL then it is being freed after it is used
to construct vector of policies.
Change-Id: Iff469205035a5240eee64ec87ea724b83577d105
Lukasz Wojciechowski [Fri, 2 Jan 2015 14:28:42 +0000 (15:28 +0100)]
Add tests for cynara_admin_erase
All tests try erasing policies in different scenarios and then verify
if proper policies were removed from proper buckets, but listing what
is left and comparing to expected result.
There are 7 tests added:
* tc23_admin_erase_empty_bucket - erase policies from empty bucket;
* tc24_admin_erase_no_bucket - try to erase from not existing bucket;
* tc25_admin_erase_single_bucket - check all posibilities of matching
policies during erase;
* tc26_admin_erase_recursive_not_linked_buckets - erase with recursive
flag set to TRUE, but in case where no policy lead to subbucket;
* tc27_admin_erase_recursive_linked_buckets - erase with recursive flag
set to TRUE with existance of policy leading to subbucket;
* tc28_admin_erase_non_recursive_linked_buckets - erase with recursive
flag set to FALSE with existance of policy leading to subbucket;
* tc29_admin_erase_recursive_from_sub_bucket - start erase test in
subbucket and check if parent bucket stays unaffected by erase.
Change-Id: Ib712a028d97773e70b98de85c51aff0238bb8586
Lukasz Wojciechowski [Fri, 2 Jan 2015 13:02:16 +0000 (14:02 +0100)]
Add wrap for cynara_admin_list_erase in Admin class
Add method erasePolicies executing cynara_admin_erase
and checking if received result match expected.
Change-Id: I21f9dfa542fe931e56b4e09ec00712ab539d48ef
Lukasz Wojciechowski [Wed, 31 Dec 2014 15:03:57 +0000 (16:03 +0100)]
Add tests for cynara_admin_list_policies
There are 3 tests:
* tc20_admin_list_empty_bucket - test listing policies from empty bucket
* tc21_admin_list_no_bucket - test listing policies from non-existing bucket
* tc22_admin_list_bucket - test listing policies from fully filled bucket
Change-Id: I814ceacf367d63b73b746689ab28e115bf38adfa
Lukasz Wojciechowski [Wed, 31 Dec 2014 13:54:55 +0000 (14:54 +0100)]
Add wrap for cynara_admin_list_policies in Admin class
Add method listPolicies executing cynara_admin_list_policies
and checking if received result match expected.
Enhance CynaraPoliciesContainer class by:
* removing copy and move constructors;
* adding sort method;
* adding operator<<.
Change-Id: Icff4a6aa0e27efa191b7eb9e9c2be79c21066cbf
Marcin Niesluchowski [Thu, 18 Dec 2014 12:35:17 +0000 (13:35 +0100)]
Use connection and message classes in service manager
Change-Id: I4aef532bd3c447af8cd3164be2e77b08be71b01f
Marcin Niesluchowski [Thu, 18 Dec 2014 12:07:15 +0000 (13:07 +0100)]
Change DBusAccess class name to ServiceManager
Change-Id: I38483087929620e12bcd2b68146b36de7a266d9c
Marcin Niesluchowski [Wed, 17 Dec 2014 17:33:35 +0000 (18:33 +0100)]
Remove Bumjin Im as contact of dbus access class
Change-Id: Id894dce5e48b50114bd118d5b21b6099093fc590
Marcin Niesluchowski [Tue, 16 Dec 2014 15:40:06 +0000 (16:40 +0100)]
Add dbus connection wrapper class
Change-Id: I494354b5d0c262abd90b3c20d36b3db5f1efef93
Marcin Niesluchowski [Wed, 17 Dec 2014 10:42:55 +0000 (11:42 +0100)]
Add dbus incoming message wrapper class
Change-Id: I1f476b1c44605458e1168c60bf3c4e6b04462be5
Marcin Niesluchowski [Wed, 17 Dec 2014 16:31:47 +0000 (17:31 +0100)]
Add dbus outgoing message wrapper class
Change-Id: I44199708452dd5c95b4e777f51890066199b7b1c
Marcin Niesluchowski [Wed, 15 Oct 2014 11:14:45 +0000 (13:14 +0200)]
Adjust Summary collector to test framework logic
Change-Id: Ia48421e8036bafe56cc8f2bffad7c7d70f4a3efe
Marcin Niesluchowski [Mon, 15 Dec 2014 15:46:43 +0000 (16:46 +0100)]
Merge branch 'tizen' into cynara
Change-Id: I7823ffc2dbd0955045402a32827db459c3083c97
Pawel Wieczorek [Mon, 24 Nov 2014 11:50:49 +0000 (12:50 +0100)]
Add tests for database cleanup mechanism
This patch adds remaining tests for database integrity mechanism, e.g.
removal of non-indexed files, removal of invalid backup files.
Change-Id: Ib6e373dba3ef24c5e69b058df2b8dd9403616eec
Pawel Wieczorek [Mon, 17 Nov 2014 13:45:30 +0000 (14:45 +0100)]
Add tests for database integrity mechanism
Change-Id: I36771d8ef627b121e27df68bd7dbc7f56aa6fd10
Pawel Wieczorek [Mon, 1 Dec 2014 13:14:41 +0000 (14:14 +0100)]
Add compareDbs() function with database patterns
Added function can be used to compare expected with actual contents of
Cynara's database. Patterns are taken from test patterns directory.
Available patterns:
* minimal contents with default DENY policy
* minimal contents with default ALLOW policy
* database with sample DENY policy
Change-Id: I510ba58e1ce12ecc388fd560e71a0f67929db757
Rafal Krypa [Mon, 8 Dec 2014 12:00:11 +0000 (13:00 +0100)]
Drop unneeded dependency against dbus-glib-1
Change-Id: Id27aa959d0456c873ad3b5178b0f8b77a6d22a47
Lukasz Wojciechowski [Mon, 24 Nov 2014 11:37:10 +0000 (12:37 +0100)]
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
Lukasz Wojciechowski [Sat, 6 Dec 2014 03:55:51 +0000 (04:55 +0100)]
Enhance DBusAccess with getServiceStartTimestamp()
Newly added method returns timestamp of the last service start
measured as number of seconds and microseconds since epoch
and returned in struct timeval.
Change-Id: I4215cc8b727cb78bd03462d25b419a1589b6db0f
Lukasz Wojciechowski [Mon, 3 Nov 2014 11:33:06 +0000 (12:33 +0100)]
Add double request tests
These tests send sequentially two requests.
In second test connection with service is broken after
response to first request is received.
Change-Id: Idc319ad58d5755ec8833f899723f1de3800cbfea
Lukasz Wojciechowski [Tue, 28 Oct 2014 09:47:56 +0000 (10:47 +0100)]
Provide CynaraTestClient namespace for sync client
CynaraTestClient is dedicated to contain all classes related
to synchronous client cynara interface wrap in cynara-tests.
CynaraTestClient class was renamed to simpler name Client.
Change-Id: I99808b0f3c17f9272deb6dfee1ed4ab6449abbb3
Lukasz Wojciechowski [Tue, 28 Oct 2014 08:05:31 +0000 (09:05 +0100)]
Provide CynaraTestAdmin namespace for admin classes
CynaraTestAdmin contains all classes related to administrative
cynara interface wrap in cynara-tests.
CynaraTestAdmin class was renamed to simpler name Admin.
Change-Id: Ic48a432346deaee5d55ff87640d9fb85a18457d2
Lukasz Wojciechowski [Mon, 27 Oct 2014 08:11:45 +0000 (09:11 +0100)]
Add tests forcing disconnection by reseting cynara
Test 08 disconnects cynara during normal request-response scenario.
Three subtestcases of 08 test differ only by resetting cynara
daemon in different moments of sending request scenario.
Test 09 disconnects cynara during request-cancel scenario
Subtestcases differ by different moments of cynara reset.
Change-Id: Ia3e9db87b7e3534c2e4b7e770b4d9a5739553ef4
Lukasz Wojciechowski [Fri, 24 Oct 2014 17:24:34 +0000 (19:24 +0200)]
Test async check before and after data insertion
This test:
* checks access in cynara with empty database;
* verifies that after response is received cache holds result;
* sets new policy (that should cause client disconnection);
* verifies that cache was cleared after disconnection;
* runs async checks on filled database.
Change-Id: If5ab19d51f83faaa802e02dae1e7526e6a9d5c61
Lukasz Wojciechowski [Fri, 24 Oct 2014 17:17:24 +0000 (19:17 +0200)]
Expand CheckData and PoliciesContainer for easier use
New CynaraPoliciesContainer::add allows adding policies with {client,
user, privilege} tripple passed as single vector parameter.
CheckData class is expanded with toAdminPolicy() method for converting
ChackData object into such vector.
Change-Id: I3cc34fc7801a81e6a9f4a456013653b1ef0d3323
Lukasz Wojciechowski [Fri, 24 Oct 2014 16:08:42 +0000 (18:08 +0200)]
Add simple request cancellation tests
tca05_request_and_cancel* - check cancellation of sent requests
tca06_cancel_fail - checks cancellation of not existing request
Change-Id: I495846f8494dc4ef6e329774039869e10b1b9731
Lukasz Wojciechowski [Mon, 24 Nov 2014 16:58:29 +0000 (17:58 +0100)]
Add user defined callback to StatusMonitor
User can pass now own function, that will be executed when status changes.
Change-Id: Ic3f514f18c780aff51cf62114fc3cf98dac70067
Lukasz Wojciechowski [Fri, 24 Oct 2014 16:07:08 +0000 (18:07 +0200)]
Wrap cynara_async_cancel_request() for test purposes
Change-Id: Iaf049aa35dac3bb7acd2874d675b49ad6676f5ea
Lukasz Wojciechowski [Mon, 20 Oct 2014 09:19:45 +0000 (11:19 +0200)]
Add test for sending and processing single request
Change-Id: I90140763f8a18a03faa1fb4d5661a369f3cc15d4
Lukasz Wojciechowski [Mon, 20 Oct 2014 09:14:18 +0000 (11:14 +0200)]
Wrap cynara_async_process() for test purposes
Wrap checks connections status, then waits on proper select statement.
After select returns, cynara_async_process() is called and expected
result is checked.
Change-Id: Icc286662b5ba7e0f4f9b51d0dd58e7ab1d17336a
Lukasz Wojciechowski [Tue, 4 Nov 2014 10:36:07 +0000 (11:36 +0100)]
Collect test fail reasons in case of nested assertions
RUNNER_ASSERT_MSG macro (and related) throw DPL::Test::TestRunner::TestFailed
exception. If such an exception is thrown during clean-up caused by another
exception and test interruption, termination of tests program happen leaving
no clues about termination cause.
This patch checks if an exception has been thrown earlier and if so,
it doesn't throw next exception but passes exception message to TestRunner.
All such messages passed with addFailReason() method are gathered inside
TestRunner and used during ResultCollection after finishing test and passing
results to collectors.
This patch introduces simple concatrenation method of joining all fail
reasons into single string, that is passed to Collectors.
When collectors API will be ready to receive multiple reasons of single test
failure, another patch can simply pass whole fail results queue.
Change-Id: I1bf582da6526a4187e7c4a53afaeea976cf4bda1
Lukasz Wojciechowski [Thu, 13 Nov 2014 14:02:23 +0000 (15:02 +0100)]
Fix potential segfaults if assert won't throw
Prepare code for assertions that won't throw an exception even if
condition check fails. Such situation can happen, when when exception
would have been thrown during stack unwinding after another exception.
Change-Id: Icb44b0e5e51bcb9b7f23fcc270d2e60eab4ecc1e
Lukasz Wojciechowski [Tue, 4 Nov 2014 10:31:33 +0000 (11:31 +0100)]
Make StatusMonitor::getStatus() always return value
Bug fix. Not all paths returned a value. RUNNER_FAIL_MSG may avoid
throwing e.g. when not in test.
Change-Id: Ief39fcc83ab3828f2e7d71682927e30140c1e191
Pawel Wieczorek [Mon, 17 Nov 2014 13:07:20 +0000 (14:07 +0100)]
Move string consts to corresponding test commons
New member has been added:
* SERVICE (in CynaraTestConsts, for D-Bus)
Change-Id: I6963cbbf9b57380447b764ae0f3b09ec2795ff9f
Marcin Niesluchowski [Mon, 13 Oct 2014 16:39:53 +0000 (18:39 +0200)]
Move Summary collector to test framework
Change-Id: Ief5a3b837382651bd030642c262d3c69c408a4bb
Marcin Niesluchowski [Mon, 13 Oct 2014 15:02:17 +0000 (17:02 +0200)]
Change FailStatus from struct to enum class
Change-Id: I9df26486b0b009e5f97b99358d0112556d87a700
Marcin Niesluchowski [Mon, 13 Oct 2014 14:21:47 +0000 (16:21 +0200)]
Remove INTERNAL type from FailStatus enum
INTERNAL fail status is treated as FAILED fail status. It is collected
in case of:
* DPL::Exception - should not be thrown by test cased body, as it is used
in test framework only
* std::exception - which implies that test case is not constructed well
or there is not enough resources, which may be also passed as Failed
state in RUNNER_* macros.
* other exceptions - same as std::exception
Change-Id: I8776622afcb9d01739f8780183ad4c5f364deb25
Pawel Wieczorek [Mon, 1 Dec 2014 12:19:55 +0000 (13:19 +0100)]
Create cynara_db_tests group
Create an empty test group for database integrity tests.
Change-Id: I065ea1c0d6ee7318f8e3a2be878867695a5ebfc7
Pawel Wieczorek [Mon, 8 Sep 2014 14:23:58 +0000 (16:23 +0200)]
Move files_compare() function to test commons
Function files_compare() from tests for libsmack can be used in other
tests as well. It is now accessible outside libsmack tests.
Change-Id: Ic56b4aff4c4170e24b5cfb2754e2ef4aed4cf541
Pawel Wieczorek [Mon, 1 Dec 2014 11:02:13 +0000 (12:02 +0100)]
Add support for empty files to files_compare()
This patch modifies approach to return values. It returns an integer
less than, equal to, or greater than zero if fd1 is found, respectively,
to be less than, to match, or be greater than fd2.
Change-Id: I9402a19a3280023ee87524cccdec36fafe52b75b
Rafal Krypa [Tue, 18 Nov 2014 10:37:34 +0000 (11:37 +0100)]
Don't provide perf binary, depend on it
Perf binary was provided in SLP as a work around for not having it
on the platform. This is no longer needed and harmful, because we
provided only the ARM binary, even for i686 and x86_64 builds.
Change-Id: I2157b7fd75a6ff3f713bf199d996c831a2f20673
Rafal Krypa [Tue, 18 Nov 2014 10:35:34 +0000 (11:35 +0100)]
Remove unneeded manual dependencies
Dependencies against shared libraries should be auto-generated.
Change-Id: I24c422b4f3488c0dacc63dbe2ac11d9ae026dfa4
Marcin Niesluchowski [Mon, 24 Nov 2014 17:44:39 +0000 (18:44 +0100)]
Merge branch 'tizen' into cynara
Change-Id: I4914064a6a5e309decea74043195e91424cb9141
Lukasz Wojciechowski [Mon, 24 Nov 2014 11:33:25 +0000 (12:33 +0100)]
Prevent running cynara service by masking
Before and after each testcase CynaraTestEnv runs code, that
saves and restores cynara's database. Cynara service is stopped
for that time, however it can be socket-activated and start during
critical moment of database modification.
To prevent such situation cynara is masked for critical sections.
Change-Id: I2dba7f9985121d92a2bb2ffd6318ec922022979c
Lukasz Wojciechowski [Mon, 24 Nov 2014 05:30:20 +0000 (06:30 +0100)]
Add methods for masking and unmasking service
Masking a service prevents the service from being started.
Unmasking allows to start service again. Both of these operations
are implemented to affect service only till device reboot.
Masking and unmasking service needs reloading configuration
of dbus manager. That is also done in implementation.
Change-Id: Ibbb64dbae6ed6aaa68b085f8a66d4810cecd22c1
Lukasz Wojciechowski [Mon, 24 Nov 2014 05:18:35 +0000 (06:18 +0100)]
Add method for getting service's pid
Systemd that is responsible for launching service provide information
about it's pid with dbus properties mechanism.
Change-Id: Ia56094ad776a758596b4344172a6109b3648365e
Lukasz Wojciechowski [Mon, 24 Nov 2014 04:31:40 +0000 (05:31 +0100)]
Handle job signals from systemd
A set of currently running jobs was added. Jobs are identified
with unique job path created by systemd.
Every time a start/stop/restart command is sent to systemd,
related job is added to set.
When JobNew signal is received its handler puts it also in the set.
Job is removed from the set, when JobRemoved signal is delivered from
systemd.
After each action generating a job in systemd unit (start/stop/restart)
program waits until all jobs from the set are removed.
Timeouts used earlier to "synchronize" action calls are removed.
Change-Id: Id944c9f52ecfeb06efabdb9424c835d09af7bb4f
Lukasz Wojciechowski [Mon, 24 Nov 2014 03:08:32 +0000 (04:08 +0100)]
Subscribe to dbus signals from systemd
Set bus matching filters for JobNew and JobRemove signals from systemd.
Subscribe to signals from systemd over dbus
Add dbus filter for all incoming messages (stub - empty body).
Change-Id: I516bf562d50a4e7a3933e0a1d5905bffb73dbc68
Lukasz Wojciechowski [Mon, 24 Nov 2014 02:42:53 +0000 (03:42 +0100)]
Cleanup DBusAccess
Remove not used variables and function.
Fix memory leak of not released objects in sendResetFailedToService().
Read object path data from dbus response.
Change-Id: I94e531fe6aef64de9eb8a1fc3e7fc8623727e697