From patchwork Thu May 23 16:42:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 1280 Return-Path: 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 5602F6187B for ; Thu, 23 May 2019 18:42:27 +0200 (CEST) Received: from localhost.localdomain (unknown [96.44.9.117]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 7F6A95A9; Thu, 23 May 2019 18:42:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1558629746; bh=ZA39u2vMJRmJyNJ/+WvXrdvTuH98X/EM9slz4nuJxAk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=no9M43pkpLFb9fOxaG/4aXxL+75nNKFX/vE9TzYCL40mNZClgIZnzRMw1tSNLoTGR GKaVJutQK1/EMq4XdDPxEnWd7WiYvVu7GR2F4S4uvkmkvJ7vXvXEREh8GU4HzYW4p/ o0ppkMWPnON2bvlZRyCQnTLNHNbrx25l5U9tKVZ8= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Thu, 23 May 2019 12:42:09 -0400 Message-Id: <20190523164210.2105-5-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190523164210.2105-1-paul.elder@ideasonboard.com> References: <20190523164210.2105-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [RFC PATCH v2 4/5] test: ipa_manager: add test for IPAManager 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: Thu, 23 May 2019 16:42:27 -0000 Add simple test to test IPA module acquiring through IPAManager. Signed-off-by: Paul Elder --- Changes in v2: - release the IPA module after the test - also use the new IPAManager singleton instead of instantiation test/ipa/ipa_manager_test.cpp | 45 +++++++++++++++++++++++++++++++++++ test/ipa/meson.build | 3 ++- 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 test/ipa/ipa_manager_test.cpp diff --git a/test/ipa/ipa_manager_test.cpp b/test/ipa/ipa_manager_test.cpp new file mode 100644 index 0000000..af2e87f --- /dev/null +++ b/test/ipa/ipa_manager_test.cpp @@ -0,0 +1,45 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (C) 2019, Google Inc. + * + * load-so.cpp - loading .so tests + */ + +#include +#include + +#include "ipa_module.h" +#include "ipa_manager.h" + +#include "test.h" + +using namespace std; +using namespace libcamera; + +class IPAManagerTest : public Test +{ +protected: + int run() override + { + IPAManager *ipam = IPAManager::instance(); + + ipam->addDir("test/ipa"); + + struct IPAModuleInfo info; + info.ipaAPIVersion = 1; + info.pipelineVersion = 8999; + strcpy(info.pipelineName, "bleep"); + IPAModule *ipa = ipam->acquireIPA(info); + + if (!ipa || strcmp(ipa->info().name, "It's under nine thousand!")) { + cerr << "failed to acquire IPA" << endl; + return TestFail; + } + + ipa->release(); + + return TestPass; + } +}; + +TEST_REGISTER(IPAManagerTest) diff --git a/test/ipa/meson.build b/test/ipa/meson.build index 6df0671..a489ed4 100644 --- a/test/ipa/meson.build +++ b/test/ipa/meson.build @@ -9,7 +9,8 @@ foreach m : ipa_modules_sources endforeach ipa_test = [ - ['ipa_test', 'ipa_test.cpp'], + ['ipa_test', 'ipa_test.cpp'], + ['ipa_manager_test', 'ipa_manager_test.cpp'], ] foreach t : ipa_test