From patchwork Fri Dec 21 00:53:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 65 Return-Path: Received: from bin-mail-out-06.binero.net (bin-mail-out-06.binero.net [195.74.38.229]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8F4F3600CC for ; Fri, 21 Dec 2018 01:54:15 +0100 (CET) X-Halon-ID: cb71866f-04ba-11e9-9adf-005056917a89 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (unknown [89.233.230.99]) by bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA id cb71866f-04ba-11e9-9adf-005056917a89; Fri, 21 Dec 2018 01:53:48 +0100 (CET) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Fri, 21 Dec 2018 01:53:29 +0100 Message-Id: <20181221005329.13597-1-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] tests: call the derived Test class cleanup() function X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2018 00:54:15 -0000 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 Reviewed-by: Laurent Pinchart --- test/test.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/test.cpp b/test/test.cpp index 4e7779e750d56687..1bb6ebcb9e8acf18 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; }