summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund@ragnatech.se>2018-12-21 01:45:47 +0100
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2018-12-21 06:47:27 +0200
commit53b549b63158c64a2f8764fcba8bf049fb1cb397 (patch)
treeacff1a81a02631599b28eb0dd3172d78bf05880e /test
parent4114a93dff6f497e8c5fc4c2328fc2a774d9ef15 (diff)
tests: call the derived Test class cleanup() function
Calling the cleanup() function in the base class Test destructor only calls the base class empty cleanup() function, not the overloaded one. This results in tests not cleaning up after themself. Solve this by explicitly calling the cleanup() function from execute(). This was discovered while running valgrind on tests where objects where allocated in init() and freed in cleanup(). Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'test')
-rw-r--r--test/test.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/test/test.cpp b/test/test.cpp
index 4e7779e7..1bb6ebcb 100644
--- a/test/test.cpp
+++ b/test/test.cpp
@@ -13,7 +13,6 @@ Test::Test()
Test::~Test()
{
- cleanup();
}
int Test::execute()
@@ -24,5 +23,9 @@ int Test::execute()
if (ret < 0)
return ret;
- return run();
+ ret = run();
+
+ cleanup();
+
+ return ret;
}