From patchwork Thu Apr 15 21:48:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= X-Patchwork-Id: 11954 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 7162DBD233 for ; Thu, 15 Apr 2021 21:48:53 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id ADAA36880C; Thu, 15 Apr 2021 23:48:52 +0200 (CEST) Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 85799605AE for ; Thu, 15 Apr 2021 23:48:51 +0200 (CEST) Received: from localhost.localdomain (unknown [IPv6:2804:14c:1a9:2978:77f9:56be:21f2:e14e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: nfraprado) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 62FC61F432E0; Thu, 15 Apr 2021 22:48:49 +0100 (BST) From: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= To: libcamera-devel@lists.libcamera.org Date: Thu, 15 Apr 2021 18:48:10 -0300 Message-Id: <20210415214812.234656-1-nfraprado@collabora.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Subject: [libcamera-devel] [RFC PATCH 0/2] Refactor lc-compliance using Catch2 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" This is just a prototype, not ready for merge, to refactor lc-compliance and better structure the test cases. It uses Catch2 [1], as a single header file, for the test framework. Important limitations: - Catch2 doesn't support skipping tests [2], so for this prototype I just put a warning and succeeded the test. - Catch2 doesn't offer a TestSuite concept per se to group tests, instead tags may be added to test cases and a grouping can be achieved that way. Catch2 offers its own command line parsing (which hasn't yet been wired up for this patch), which can be used to select which test cases are run, either by their names or tags. One really interesting feature of Catch2 is that it uses a single assert macro, and C++ operators can be used for comparison. This is what a failure would look like: ../src/lc-compliance/simple_capture.cpp:111: FAILED: REQUIRE( captureCount_ == captureLimit_ ) with expansion: 3 == 2 with message: Using 0 role, 3 requests, and 1 start cycles [1] https://github.com/catchorg/Catch2 [2] https://github.com/catchorg/Catch2/issues/395 NĂ­colas F. R. A. Prado (2): lc-compliance: Make SimpleCapture::stop() idempotent lc-compliance: Refactor lc-compliance using Catch2 src/lc-compliance/catch.hpp | 17937 +++++++++++++++++++++++++ src/lc-compliance/main.cpp | 48 +- src/lc-compliance/simple_capture.cpp | 94 +- src/lc-compliance/simple_capture.h | 10 +- src/lc-compliance/single_stream.cpp | 92 +- 5 files changed, 18017 insertions(+), 164 deletions(-) create mode 100644 src/lc-compliance/catch.hpp