From patchwork Mon May 16 14:10:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 15911 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 18A82C3256 for ; Mon, 16 May 2022 14:10:57 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 246D965674; Mon, 16 May 2022 16:10:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1652710256; bh=/DzF7lrgxQNz4Pc5b7ZShv+ZljvReYGaRty30lW76/I=; 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=DSTYWiNU+znSmeyS6YNlPy8lEbHOYYZL8V61cPC1XE351HW+yCzUtJIaVmUjsKktP 2Zebi8AcWSlaQvW2COhmsFa5lOdf49izTFueOHqjj66QK5kOWVrKjogcOimk6CrQ38 /zrGzHU2sQTLdqD5TVme8LxH7ic8MRHTVNja9KZtjY9B9H99adwFCxD3EcklZY4XQu XFc71jElwoqR/cprY2zPbiOtSlwvCiln6AYnh/obTv2+wdRE9v41UXizkIlAyPUAdM +RF8TRBJqXHIfIe9/wdG3X8X7CETPJGJxm/Ue+Z3zF9IVyrWgpTRnK7uOZssB0hU9X RwRQAt7W9d9jQ== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5292565653 for ; Mon, 16 May 2022 16:10:50 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Q7dpeuo/"; 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 BB4AB898; Mon, 16 May 2022 16:10:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1652710250; bh=/DzF7lrgxQNz4Pc5b7ZShv+ZljvReYGaRty30lW76/I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q7dpeuo/VYMgIDylc7Ail91h0J3v2Ime0luPv/FOFENKIVAAYcdpCf9AptFclnLam shzmBP11yUIMceQtgLq6NfBKDbnpNjQwogYmowh6UKjOYrLSo5+29mfx6kdv23WFcv 5tp5aguNd/dhNmsTNS1qkRwygMT1tiQhW69Cd45I= To: libcamera-devel@lists.libcamera.org, David Plowman , Kieran Bingham , Laurent Pinchart , Jacopo Mondi Date: Mon, 16 May 2022 17:10:13 +0300 Message-Id: <20220516141022.96327-6-tomi.valkeinen@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220516141022.96327-1-tomi.valkeinen@ideasonboard.com> References: <20220516141022.96327-1-tomi.valkeinen@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 05/14] 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 --- test/py/unittests.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/py/unittests.py b/test/py/unittests.py index 9326358d..288dcd48 100755 --- a/test/py/unittests.py +++ b/test/py/unittests.py @@ -83,6 +83,10 @@ 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 +98,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):