X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=README;h=c94a7390175e76ff9023776aaff5b4b146d7c786;hb=refs%2Fchanges%2F02%2F84602%2F1;hp=9caea4781eb2601cd2676f4a30fc8e7a1717138e;hpb=dd67f52075a7f6e999f879706ed1a7b83bf5d600;p=platform%2Fcore%2Ftest%2Fsecurity-tests.git diff --git a/README b/README index 9caea47..c94a739 100644 --- a/README +++ b/README @@ -11,21 +11,15 @@ with binaries provided for testing them: libsmack libsmack-test -libprivilege-control - libprivilege-control-test -security-server - security-server-tests-client-smack - security-server-tests-stress - security-server-tests-server - security-server-tests-api-speed - security-server-tests-password - security-server-tests-privilege - security-server-tests-dbus security-manager security-manager-tests cynara cynara-test +There are also inner-tests for testing complex security-tests framework +mechanisms with binary: + security-tests-inner-test + ==HOW TO RUN=================================================================== Each test suite may be run with options: @@ -80,6 +74,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 &optionalArgsTuple dpl-test-framework test_runner.h @@ -114,6 +124,10 @@ tests-common --Assert macros---------------------------------------------------------------- Used within test registering macros. +First failed assertion throws test failed exception. If another assertions +fail, information about fail conditions and backtrace is cumulated and +presented together with already thrown exception message. + dpl-test-framework test_runner.h RUNNER_ASSERT_MSG @@ -148,13 +162,32 @@ dpl-test-framework RUNNER_ERROR_MSG Print error message using red color. +--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 + +dpl-test-framework + test_runner.h + RUNNER_DEFER_TRYCATCH + Catches thrown TestException exceptions and stores them in TestRunner + structures for later use. This macro works only inside deffered scope + defined by RUNNER_DEFER_SCOPE, otherwise it won't catch exceptions + RUNNER_DEFER_SCOPE + Defines deferred scope. All RUNNER_DEFER_TRYCATCH macros used inside + the scope catch and save TestException exceptions. After scope is left + all saved exceptions take part in setting result of test. If there + is no any uncaught exception then additionally first of saved + exceptions is thrown. + --Collectors------------------------------------------------------------------- Collectors are classes which collect test results. Each class does it differently. Collectors can be registered by --output parameter (see HOW TO RUN section) but there is also another collector created to write summary. -tests-common - summary_collector.h +dpl-test-framework + test_results_collector_summary.h SummaryCollector Collector writing tests summary. Call SummaryCollector::Register() to register it @@ -204,6 +237,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();