[libcamera-devel,RFC,4/5] test: ipa_manager: add test for IPAManager

Message ID 20190522210220.1631-5-paul.elder@ideasonboard.com
State Superseded
Headers show
Series
  • Add IPAManager
Related show

Commit Message

Paul Elder May 22, 2019, 9:02 p.m. UTC
Add simple test to test IPA module acquiring through IPAManager.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
---
 test/ipa/ipa_manager_test.cpp | 43 +++++++++++++++++++++++++++++++++++
 test/ipa/meson.build          |  3 ++-
 2 files changed, 45 insertions(+), 1 deletion(-)
 create mode 100644 test/ipa/ipa_manager_test.cpp

Patch

diff --git a/test/ipa/ipa_manager_test.cpp b/test/ipa/ipa_manager_test.cpp
new file mode 100644
index 0000000..13be202
--- /dev/null
+++ b/test/ipa/ipa_manager_test.cpp
@@ -0,0 +1,43 @@ 
+/* 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 = new IPAManager();
+
+		ipam->addDir("test/ipa");
+
+		struct IPAModuleInfo info;
+		info.ipaAPIVersion = 1;
+		info.pipelineVersion = 8999;
+		strcpy(info.pipelineName, "bleep");
+		const IPAModule *ipa = ipam->acquireIPA(info);
+
+		if (!ipa || strcmp(ipa->info().name, "It's under nine thousand!")) {
+			cerr << "failed to acquire IPA" << endl;
+			return TestFail;
+		}
+
+		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