From patchwork Tue Jan 14 18:23:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Patchwork-Id: 22576 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 3C609C3304 for ; Tue, 14 Jan 2025 18:23:07 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id EF51468556; Tue, 14 Jan 2025 19:23:06 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=protonmail.com header.i=@protonmail.com header.b="DtnysL+o"; dkim-atps=neutral Received: from mail-4316.protonmail.ch (mail-4316.protonmail.ch [185.70.43.16]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4DB9768556 for ; Tue, 14 Jan 2025 19:23:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1736878984; x=1737138184; bh=nbqBgzGncn5KaKwNqAT9+CCuXrHBvoA3i5chd4mG0iA=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post; b=DtnysL+oNxwE6zVZLeZiaS+V6M12/ttJxB8aYMqbYigLxPhJ3oCMQXqJMjmTqnpmg Fb/8lOghZF1fxwPMToFVQYDjeoacPIrUIRftEmjoLdhoiZ4Et6es8R7L1Ov/GaRTKH n5C9ugwUohWGubBPKBuHym37gREX/LwXVYBWn73MWJ81RGe5m3xBHlo4DMdZNrqemv Lie1SwHHlpD6zGhn9LrrJ7KKyDcoGYBPt1doyx0+Bn1DTpitIM7K88qi8O+6NxtJi5 0alnp8FHgVfFYOTdLQdQAUAO0pAzlhoW8ncJ/QuDHUJq7I465V5IRp/d4Kzz6ZzhmA tvFZZCUa3R4vA== Date: Tue, 14 Jan 2025 18:23:00 +0000 To: libcamera-devel@lists.libcamera.org From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= Cc: Jacopo Mondi Subject: [RFC PATCH v2 15/16] apps: lc-compliance: Add multi-stream tests Message-ID: <20250114182143.1773762-16-pobrn@protonmail.com> In-Reply-To: <20250114182143.1773762-1-pobrn@protonmail.com> References: <20250114182143.1773762-1-pobrn@protonmail.com> Feedback-ID: 20568564:user:proton X-Pm-Message-ID: 79f0e69d04502e961355423dc1d53b4274f5ce8c 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" Rename the `SingleStream` test to `SimpleCapture`, and extend it to support using multiple roles. And instantiate another test suite from the `SimpleCapture` test that tests multiple streams in one capture session. Co-developed-by: Jacopo Mondi Signed-off-by: Jacopo Mondi Signed-off-by: Barnabás Pőcze Reviewed-by: Paul Elder --- src/apps/lc-compliance/tests/capture_test.cpp | 85 +++++++++++-------- 1 file changed, 48 insertions(+), 37 deletions(-) diff --git a/src/apps/lc-compliance/tests/capture_test.cpp b/src/apps/lc-compliance/tests/capture_test.cpp index 147e17019..db1d52fc9 100644 --- a/src/apps/lc-compliance/tests/capture_test.cpp +++ b/src/apps/lc-compliance/tests/capture_test.cpp @@ -8,7 +8,7 @@ #include "capture.h" -#include +#include #include @@ -18,19 +18,10 @@ namespace { using namespace libcamera; -const int NUMREQUESTS[] = { 1, 2, 3, 5, 8, 13, 21, 34, 55, 89 }; - -const StreamRole ROLES[] = { - StreamRole::Raw, - StreamRole::StillCapture, - StreamRole::VideoRecording, - StreamRole::Viewfinder -}; - -class SingleStream : public testing::TestWithParam> +class SimpleCapture : public testing::TestWithParam, int>> { public: - static std::string nameParameters(const testing::TestParamInfo &info); + static std::string nameParameters(const testing::TestParamInfo &info); protected: void SetUp() override; @@ -43,7 +34,7 @@ protected: * We use gtest's SetUp() and TearDown() instead of constructor and destructor * in order to be able to assert on them. */ -void SingleStream::SetUp() +void SimpleCapture::SetUp() { Environment *env = Environment::get(); @@ -52,7 +43,7 @@ void SingleStream::SetUp() ASSERT_EQ(camera_->acquire(), 0); } -void SingleStream::TearDown() +void SimpleCapture::TearDown() { if (!camera_) return; @@ -61,19 +52,17 @@ void SingleStream::TearDown() camera_.reset(); } -std::string SingleStream::nameParameters(const testing::TestParamInfo &info) +std::string SimpleCapture::nameParameters(const testing::TestParamInfo &info) { - std::map rolesMap = { - { StreamRole::Raw, "Raw" }, - { StreamRole::StillCapture, "StillCapture" }, - { StreamRole::VideoRecording, "VideoRecording" }, - { StreamRole::Viewfinder, "Viewfinder" } - }; + const auto &[roles, numRequests] = info.param; + std::ostringstream ss; - std::string roleName = rolesMap[std::get<0>(info.param)]; - std::string numRequestsName = std::to_string(std::get<1>(info.param)); + for (StreamRole r : roles) + ss << r << '_'; - return roleName + "_" + numRequestsName; + ss << '_' << numRequests; + + return std::move(ss).str(); } /* @@ -83,13 +72,13 @@ std::string SingleStream::nameParameters(const testing::TestParamInfo SINGLEROLES[] = { + { StreamRole::Raw, }, + { StreamRole::StillCapture, }, + { StreamRole::VideoRecording, }, + { StreamRole::Viewfinder, }, +}; + +const std::vector MULTIROLES[] = { + { StreamRole::Raw, StreamRole::StillCapture }, + { StreamRole::Raw, StreamRole::VideoRecording }, + { StreamRole::StillCapture, StreamRole::VideoRecording }, + { StreamRole::VideoRecording, StreamRole::VideoRecording }, +}; + +INSTANTIATE_TEST_SUITE_P(SingleStream, + SimpleCapture, + testing::Combine(testing::ValuesIn(SINGLEROLES), + testing::ValuesIn(NUMREQUESTS)), + SimpleCapture::nameParameters); + +INSTANTIATE_TEST_SUITE_P(MultiStream, + SimpleCapture, + testing::Combine(testing::ValuesIn(MULTIROLES), testing::ValuesIn(NUMREQUESTS)), - SingleStream::nameParameters); + SimpleCapture::nameParameters); } /* namespace */