From patchwork Wed May 18 13:13:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 15956 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id A8238C326D for ; Wed, 18 May 2022 13:13:59 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 351EE6566E; Wed, 18 May 2022 15:13:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1652879637; bh=81cfyWdLmXwVC6nVNluygfhKfJMgfSkSf0jP/R91RlA=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=qqd/3E0P7CE61EJQDnKKPC38fYPpFob7ArlOYLqPguFgYfb0maRtM+T0OD7uK8AX3 wV+awMSfcy/2oLU8UWnn0H1AZCDVrw73uASjMJqZrzGLFQTaq67fGBpltks6nqxsZV 4d4HbhjuTG3sKEEOCGraMrp3RzqfvgdMsckMS/MpLR3kM82nl68yYZHvgAbizOeAH+ OCFQrAaVPo1NeWnZYiQbjrL4EhZWIUQqo0/RfB9aQZLQDJGufRSftxu1JwHh308IML Nzk3GNp2oaBFS+iBl26PB7morUB7s8lm8r3PIuzif/E6gzYe2TvAwA99zA8vvJcTa/ bdT3q9cIVcJxw== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 78D6B65656 for ; Wed, 18 May 2022 15:13:49 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="tsTPgqv/"; dkim-atps=neutral Received: from deskari.lan (91-156-85-209.elisa-laajakaista.fi [91.156.85.209]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id DF4111C13; Wed, 18 May 2022 15:13:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1652879629; bh=81cfyWdLmXwVC6nVNluygfhKfJMgfSkSf0jP/R91RlA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tsTPgqv/5P7aN1LYT+zHRZ7NujZluwuKRTVXsgwa7B/SVEOhQiFfeFpFANbF8fEmA vcw8Za5bbnz/WRMLVVkk/gm0hhf1U3MwWQkDvVaUDyC1U7jG6j6WXK2MpMK+pXjPzL l4nhYWoxwsFPqibDQFrwgHos9uxzFtIecNkyjEgg= To: libcamera-devel@lists.libcamera.org, David Plowman , Kieran Bingham , Laurent Pinchart , Jacopo Mondi Date: Wed, 18 May 2022 16:13:17 +0300 Message-Id: <20220518131329.66994-7-tomi.valkeinen@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220518131329.66994-1-tomi.valkeinen@ideasonboard.com> References: <20220518131329.66994-1-tomi.valkeinen@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 06/18] py: unittests: verify that cam and cm are freed X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tomi Valkeinen via libcamera-devel From: Tomi Valkeinen Reply-To: Tomi Valkeinen Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add checks to CameraTesterBase to verify that both the Camera and the CameraManager gets freed. Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- test/py/unittests.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/py/unittests.py b/test/py/unittests.py index 9326358d..4c214f0a 100755 --- a/test/py/unittests.py +++ b/test/py/unittests.py @@ -83,6 +83,9 @@ class CameraTesterBase(BaseTestCase): self.cm = None raise Exception('Failed to acquire camera') + self.wr_cam = weakref.ref(self.cam) + self.wr_cm = weakref.ref(self.cm) + def tearDown(self): # If a test fails, the camera may be in running state. So always stop. self.cam.stop() @@ -94,6 +97,9 @@ class CameraTesterBase(BaseTestCase): self.cam = None self.cm = None + self.assertIsNone(self.wr_cm()) + self.assertIsNone(self.wr_cam()) + class AllocatorTestMethods(CameraTesterBase): def test_allocator(self):