From patchwork Fri Jan 11 11:09:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 201 Return-Path: Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CF98F60B32 for ; Fri, 11 Jan 2019 12:09:54 +0100 (CET) X-Originating-IP: 2.224.242.101 Received: from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 6B4CF1C0002; Fri, 11 Jan 2019 11:09:54 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Fri, 11 Jan 2019 12:09:54 +0100 Message-Id: <20190111110956.14812-2-jacopo@jmondi.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190111110956.14812-1-jacopo@jmondi.org> References: <20190111110956.14812-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/3] test: media_device: Make MediaDeviceTest a MediaDevicePrintTest X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Jan 2019 11:09:55 -0000 As a new class for test link handling will be added as a separate test, it makes no sense to have a generic "MediaDeviceTest" class. Rename it in "MediaDevicePrintTest", and make it run only printing test. Signed-off-by: Jacopo Mondi --- ...e_test.cpp => media_device_print_test.cpp} | 31 +++++++++---------- test/media_device/meson.build | 9 +++--- 2 files changed, 19 insertions(+), 21 deletions(-) rename test/media_device/{media_device_test.cpp => media_device_print_test.cpp} (79%) diff --git a/test/media_device/media_device_test.cpp b/test/media_device/media_device_print_test.cpp similarity index 79% rename from test/media_device/media_device_test.cpp rename to test/media_device/media_device_print_test.cpp index c482b2e..9746afa 100644 --- a/test/media_device/media_device_test.cpp +++ b/test/media_device/media_device_print_test.cpp @@ -1,10 +1,8 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ /* - * Copyright (C) 2018, Google Inc. + * Copyright (C) 2019, Google Inc. * - * media_device_test.cpp - Tests for the media device class. - * - * Test library for the media device class. + * media_device_print_test.cpp - Print out media devices */ #include @@ -20,16 +18,16 @@ using namespace libcamera; using namespace std; /* - * MediaDeviceTest object: runs a sequence of tests on all media - * devices found in the system. + * MediaDevicePrintTest takes all media devices found in the system and print + * them out to verify correctness. * * If no accessible media device is found, the test is skipped. */ -class MediaDeviceTest : public Test +class MediaDevicePrintTest : public Test { public: - MediaDeviceTest() { } - ~MediaDeviceTest() { } + MediaDevicePrintTest() { } + ~MediaDevicePrintTest() { } protected: int init() { return 0; } @@ -44,7 +42,7 @@ private: void printNode(const MediaPad *pad, ostream &os); }; -void MediaDeviceTest::printNode(const MediaPad *pad, ostream &os) +void MediaDevicePrintTest::printNode(const MediaPad *pad, ostream &os) { const MediaEntity *entity = pad->entity(); @@ -52,7 +50,7 @@ void MediaDeviceTest::printNode(const MediaPad *pad, ostream &os) << pad->index() << "]"; } -void MediaDeviceTest::printLinkFlags(const MediaLink *link, ostream &os) +void MediaDevicePrintTest::printLinkFlags(const MediaLink *link, ostream &os) { unsigned int flags = link->flags(); @@ -68,7 +66,7 @@ void MediaDeviceTest::printLinkFlags(const MediaLink *link, ostream &os) * For each entity in the media graph, printout links directed to its sinks * and source pads. */ -void MediaDeviceTest::printMediaGraph(const MediaDevice &media, ostream &os) +void MediaDevicePrintTest::printMediaGraph(const MediaDevice &media, ostream &os) { os << "\n" << media.driver() << " - " << media.devnode() << "\n\n"; @@ -110,7 +108,7 @@ void MediaDeviceTest::printMediaGraph(const MediaDevice &media, ostream &os) } /* Test a single media device. */ -int MediaDeviceTest::testMediaDevice(const string devnode) +int MediaDevicePrintTest::testMediaDevice(const string devnode) { MediaDevice dev(devnode); int ret; @@ -134,9 +132,8 @@ int MediaDeviceTest::testMediaDevice(const string devnode) if (ret) return ret; - /* Run tests in sequence. */ + /* Print out the media graph. */ printMediaGraph(dev, cerr); - /* TODO: add more tests here. */ dev.close(); @@ -145,7 +142,7 @@ int MediaDeviceTest::testMediaDevice(const string devnode) /* Run tests on all media devices. */ #define MAX_MEDIA_DEV 256 -int MediaDeviceTest::run() +int MediaDevicePrintTest::run() { const string devnode("/dev/media"); unsigned int i; @@ -171,4 +168,4 @@ int MediaDeviceTest::run() return ret; } -TEST_REGISTER(MediaDeviceTest); +TEST_REGISTER(MediaDevicePrintTest); diff --git a/test/media_device/meson.build b/test/media_device/meson.build index a7ebed1..e279470 100644 --- a/test/media_device/meson.build +++ b/test/media_device/meson.build @@ -1,5 +1,6 @@ -media_device_test = executable('media_device_test', 'media_device_test.cpp', - link_with : test_libraries, - include_directories : test_includes_internal) +media_device_print_test = executable('media_device_print_test', + 'media_device_print_test.cpp', + link_with : test_libraries, + include_directories : test_includes_internal) -test('Media Device Test', media_device_test) +test('Media Device Print Test', media_device_print_test)