From patchwork Tue May 17 14:33: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: 15929 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 A394EC326D for ; Tue, 17 May 2022 14:33:58 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3D18C6041D; Tue, 17 May 2022 16:33:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1652798038; bh=uUO9E4zBomuA+wF8p3Q+nMamxEdaL4uqXD+Aia+1+Mw=; 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=Zz3mvGIxFPrzT0mQwAJEe9Ar9Aer3WEKITWVci4uBdK7rJjB53DnQpt46y7YPsBpQ /lG08itAnkHLFPHExkEjaUCe6P7ARmHyb2QI2jmDe7+5+nh7xqSWG7r3cCQL9kCbDM 4dqCVq58J5pTABiAcC43obKx3cDSImDqDN1X68m9JIL6MX8Sva0m9vIqQuVNOQ8dwy BLvBzNULY1Gq+YhT3EJPL4aErOc+SsYeN+Y0/lOfD+eBzezZT6QqziuoViOgVwVg9z MJG6jHO/oELh3xIo5si/xSAzzJal2npCwzwosYS90GuHegvI3mHIM32GUu4KH+jChN IPey+qWMmYTUQ== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2C4F465661 for ; Tue, 17 May 2022 16:33:54 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ooco2jjY"; 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 91917D59; Tue, 17 May 2022 16:33:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1652798033; bh=uUO9E4zBomuA+wF8p3Q+nMamxEdaL4uqXD+Aia+1+Mw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ooco2jjY/glQ/MAESRrSirbOKHWXjS5m0lypxVcKC7sA7wF4ir8V7pL2skPYM7dL1 XzUBmVviSgURXHwNt8uIeNaASkHIdyoLwNRa08ae9r4A6z16qIw8QjdLJuWxB6asXJ HZlNpqSdgWjbWygjCSj2yIp1YOFdGx0V8YyHh32A= To: libcamera-devel@lists.libcamera.org, David Plowman , Kieran Bingham , Laurent Pinchart , Jacopo Mondi Date: Tue, 17 May 2022 17:33:17 +0300 Message-Id: <20220517143325.71784-6-tomi.valkeinen@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220517143325.71784-1-tomi.valkeinen@ideasonboard.com> References: <20220517143325.71784-1-tomi.valkeinen@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 05/13] 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):