[libcamera-devel] [RFC PATCH v2 4/5] test: ipa_manager: add test for IPAManager
Paul Elder
paul.elder at ideasonboard.com
Thu May 23 18:42:09 CEST 2019
Add simple test to test IPA module acquiring through IPAManager.
Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>
---
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 <iostream>
+#include <string.h>
+
+#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
--
2.20.1
More information about the libcamera-devel
mailing list