From patchwork Sat Jan 4 05:09:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 2497 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4C3B560466 for ; Sat, 4 Jan 2020 06:10:03 +0100 (CET) Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id E005EA49 for ; Sat, 4 Jan 2020 06:10:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1578114603; bh=XDmoyez+9Q+gmb7aXgFlcw9C5/2YsoVpKGpYI1Y08Y0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=nXXx/sKlVXfWAUYIA7AuCm3JUjGomr8+u8AUVShEYcE+X1wjgTjAa/s6KBk4Hqoti BlTB4jdXI5l2ZZKA+AKFiYS9kCNGl0CmaYOhMbfMuiIdxFqtxJfZlnDQ6Af49VyUqb r/5CCNbuNznlEKzTYLtHxLCihHAOyIRvtmBtSruc= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Sat, 4 Jan 2020 07:09:34 +0200 Message-Id: <20200104050947.7673-2-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200104050947.7673-1-laurent.pinchart@ideasonboard.com> References: <20200104050947.7673-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 01/14] test: object-invoke: Test direct invocation 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-List-Received-Date: Sat, 04 Jan 2020 05:10:03 -0000 Test the ConnectionTypeDirect type when the object lives in a different thread. This test passes but generates a memory leak. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- test/object-invoke.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/object-invoke.cpp b/test/object-invoke.cpp index f9a8bea9dce2..ed16de99ef5e 100644 --- a/test/object-invoke.cpp +++ b/test/object-invoke.cpp @@ -123,6 +123,27 @@ protected: return TestFail; } + /* Test that direct method invocation bypasses threads. */ + object_.reset(); + object_.invokeMethod(&InvokedObject::method, + ConnectionTypeDirect, 42); + + switch (object_.status()) { + case InvokedObject::NoCall: + cout << "Method not invoked for custom thread" << endl; + return TestFail; + case InvokedObject::CallReceived: + cout << "Method invoked in incorrect thread for direct call" << endl; + return TestFail; + default: + break; + } + + if (object_.value() != 42) { + cout << "Method invoked with incorrect value for direct call" << endl; + return TestFail; + } + /* * Test invoking a method that takes reference arguments. This * targets compilation, there's no need to check runtime