From 817a4b4472039251944cba131b25f75cc067f9b1 Mon Sep 17 00:00:00 2001 From: Paul Elder Date: Sat, 5 Dec 2020 19:31:06 +0900 Subject: tests: Test IPA serializer generation Add a test to confirm that serializer and header generation works properly for mojom definition files, and that the serializer works properly. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- .../include/libcamera/ipa/meson.build | 40 ++++++++++++++++++++++ .../include/libcamera/ipa/test.mojom | 33 ++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 test/serialization/generated_serializer/include/libcamera/ipa/meson.build create mode 100644 test/serialization/generated_serializer/include/libcamera/ipa/test.mojom (limited to 'test/serialization/generated_serializer/include') diff --git a/test/serialization/generated_serializer/include/libcamera/ipa/meson.build b/test/serialization/generated_serializer/include/libcamera/ipa/meson.build new file mode 100644 index 00000000..ba198f7a --- /dev/null +++ b/test/serialization/generated_serializer/include/libcamera/ipa/meson.build @@ -0,0 +1,40 @@ +# SPDX-License-Identifier: CC0-1.0 + +# test.mojom-module +mojom = custom_target('test_mojom_module', + input : 'test.mojom', + output : 'test.mojom-module', + command : [ + mojom_parser, + '--output-root', meson.build_root(), + '--input-root', meson.source_root(), + '--mojoms', '@INPUT@' + ]) + +# test_ipa_interface.h +generated_test_header = custom_target('test_ipa_interface_h', + input : mojom, + output : 'test_ipa_interface.h', + depends : mojom_templates, + command : [ + mojom_generator, 'generate', + '-g', 'libcamera', + '--bytecode_path', mojom_templates_dir, + '--libcamera_generate_header', + '--libcamera_output_path=@OUTPUT@', + './' +'@INPUT@' + ]) + +# test_ipa_serializer.h +generated_test_serializer = custom_target('test_ipa_serializer_h', + input : mojom, + output : 'test_ipa_serializer.h', + depends : mojom_templates, + command : [ + mojom_generator, 'generate', + '-g', 'libcamera', + '--bytecode_path', mojom_templates_dir, + '--libcamera_generate_serializer', + '--libcamera_output_path=@OUTPUT@', + './' +'@INPUT@' + ]) diff --git a/test/serialization/generated_serializer/include/libcamera/ipa/test.mojom b/test/serialization/generated_serializer/include/libcamera/ipa/test.mojom new file mode 100644 index 00000000..5f200885 --- /dev/null +++ b/test/serialization/generated_serializer/include/libcamera/ipa/test.mojom @@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ + +module ipa.test; + +enum IPAOperationCode { + IPAOperationNone, + IPAOperationInit, + IPAOperationStart, + IPAOperationStop, +}; + +struct IPASettings {}; + +struct TestStruct { + map m; + array a; + string s1; + string s2; + int32 i; + string s3; +}; + +interface IPATestInterface { + init(IPASettings settings) => (int32 ret); + start() => (int32 ret); + stop(); + + test(TestStruct s); +}; + +interface IPATestEventInterface { + dummyEvent(uint32 val); +}; -- cgit v1.2.1