Add support for throwing RAII destructors 56/110056/7
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Thu, 12 Jan 2017 11:16:26 +0000 (12:16 +0100)
committerKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Fri, 17 Mar 2017 17:01:45 +0000 (18:01 +0100)
commitbd7c4954c7134b32df83569b2fd26959af313091
tree2fd7c2d439760f160753ae7ef70efe2e40ec9f31
parent8f861bdcaf91702b5b1428ea515338e70295908b
Add support for throwing RAII destructors

When a test finishes or fails the stack is unwinded some of such objects'
destructors still perform actions that may report an error/throw an exception.
If we just surround these actions with try/catch block we'll lose information
about errors in these destructors. If we let destructors throw it may lead to
program termination (unhandled exception during stack unwind caused by another
exception).

To prevent program termination and still get the information about errors in
destructors surround the throwing code in your RAII object destructor with
SafeCleanup::run.

Tests for cleanup exception handling are added and can be executed with:
cleanup_test.sh

Change-Id: Id4e257aadea9b18fe890c89d8f182082a7f191a3
packaging/security-tests.spec
src/framework/config.cmake
src/framework/include/dpl/test/safe_cleanup.h [new file with mode: 0644]
src/framework/src/safe_cleanup.cpp [new file with mode: 0644]
src/framework/src/test_runner.cpp
src/framework/src/test_runner_child.cpp
tests/CMakeLists.txt
tests/cleanup/CMakeLists.txt [new file with mode: 0644]
tests/cleanup/cleanup_test.sh [new file with mode: 0755]
tests/cleanup/expected_results.txt [new file with mode: 0644]
tests/cleanup/test_cases_cleanup.cpp [new file with mode: 0644]