From patchwork Tue Jan 23 01:12:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 19454 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 745A5C32C0 for ; Tue, 23 Jan 2024 01:12:58 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A4E5362957; Tue, 23 Jan 2024 02:12:57 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="JWcqnKJi"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4217A62954 for ; Tue, 23 Jan 2024 02:12:54 +0100 (CET) Received: from pendragon.ideasonboard.com (89-27-53-110.bb.dnainternet.fi [89.27.53.110]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id DACD91B9A; Tue, 23 Jan 2024 02:11:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1705972301; bh=1vKKV4M7kENbh/o8JW9ET2qZ2bxeYrGjnJIthe49NUg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JWcqnKJiaCAn9OV9U0Yc7QBICL5oMu2m5a/W15ni0Rgg+F4iDpVHHfLBcQSuVnKTg lCKbw3vZZ6xT8s2/vWnlSggfJ/lOgSH41zepBFFBmRBrLUdVB4FGNMOivrY/w4VF8U TO9N0sJAt9cJWNLVSuALvnRAfTKAsUsP79JA8Hws= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Subject: [PATCH v2 06/12] test: message: Remove incorrect slow receiver test Date: Tue, 23 Jan 2024 03:12:43 +0200 Message-ID: <20240123011249.22716-7-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240123011249.22716-1-laurent.pinchart@ideasonboard.com> References: <20240123011249.22716-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The slow receiver test verifies there's no race condition between concurrent message delivery and object deletion. This is not a valid use case in the first place, as objects are not allowed to be deleted from a different thread than the one they are bound to. Remove the incorrect test. Signed-off-by: Laurent Pinchart Reviewed-by: Milan Zamazal --- Changes since v1: - Fix typo in commit message --- test/message.cpp | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/test/message.cpp b/test/message.cpp index 0e76f323e3b9..a34e0f0b5e10 100644 --- a/test/message.cpp +++ b/test/message.cpp @@ -93,25 +93,6 @@ private: bool success_; }; -class SlowMessageReceiver : public Object -{ -protected: - void message(Message *msg) - { - if (msg->type() != Message::None) { - Object::message(msg); - return; - } - - /* - * Don't access any member of the object here (including the - * vtable) as the object will be deleted by the main thread - * while we're sleeping. - */ - this_thread::sleep_for(chrono::milliseconds(100)); - } -}; - class MessageTest : public Test { protected: @@ -148,21 +129,6 @@ protected: break; } - /* - * Test for races between message delivery and object deletion. - * Failures result in assertion errors, there is no need for - * explicit checks. - */ - SlowMessageReceiver *slowReceiver = new SlowMessageReceiver(); - slowReceiver->moveToThread(&thread_); - slowReceiver->postMessage(std::make_unique(Message::None)); - - this_thread::sleep_for(chrono::milliseconds(10)); - - delete slowReceiver; - - this_thread::sleep_for(chrono::milliseconds(100)); - /* * Test recursive calls to Thread::dispatchMessages(). Messages * should be delivered correctly, without crashes or memory