From 88c5c13b458ab69ec696be6f8f4cb57077104406 Mon Sep 17 00:00:00 2001 From: "Artiom N." Date: Thu, 14 Nov 2024 16:47:35 +0300 Subject: [PATCH 1/2] MT backend loading test add: #2 --- .gitlint | 2 +- knp/core-library/include/knp/core/backend.h | 24 ++++++++++----------- knp/tests/framework/backend_loader_test.cpp | 11 +++++++++- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/.gitlint b/.gitlint index b2ba201d..07899cb7 100644 --- a/.gitlint +++ b/.gitlint @@ -71,7 +71,7 @@ min-length=10 # python-style regex that the commit-msg title must match # Note that the regex can contradict with other rules if not used correctly # (e.g. title-must-not-contain-word). -regex=^[A-Za-z0-9 "'.,-_]+: #[0-9]{7}$ +regex=^[A-Za-z0-9 "'.,-_]+: #[0-9]+$ [body-max-line-length] diff --git a/knp/core-library/include/knp/core/backend.h b/knp/core-library/include/knp/core/backend.h index fc350403..9c5f6f3c 100644 --- a/knp/core-library/include/knp/core/backend.h +++ b/knp/core-library/include/knp/core/backend.h @@ -4,18 +4,18 @@ * @kaspersky_support Artiom N. * @date 11.01.2023 * @license Apache 2.0 - * @copyright © 2024 AO Kaspersky Lab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and + * @copyright © 2024 AO Kaspersky Lab + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/knp/tests/framework/backend_loader_test.cpp b/knp/tests/framework/backend_loader_test.cpp index b8262a5b..869976cb 100644 --- a/knp/tests/framework/backend_loader_test.cpp +++ b/knp/tests/framework/backend_loader_test.cpp @@ -26,7 +26,7 @@ #include -TEST(FrameworkSuite, BackendLoaderLoad) +TEST(FrameworkSuite, StBackendLoaderLoad) { knp::framework::BackendLoader backend_loader; auto cpu_st_backend{backend_loader.load(knp::testing::get_backend_path())}; @@ -35,6 +35,15 @@ TEST(FrameworkSuite, BackendLoaderLoad) } +TEST(FrameworkSuite, MtBackendLoaderLoad) +{ + knp::framework::BackendLoader backend_loader; + auto cpu_st_backend{backend_loader.load(knp::testing::get_backend_path("knp-cpu-multi-threaded-backend"))}; + + EXPECT_NO_THROW((void)cpu_st_backend->get_uid()); //!OCLINT(False positive) +} + + TEST(FrameworkSuite, BackendLoaderCheck) { const knp::framework::BackendLoader backend_loader; From dce7a2c5a758e04c5f88dd97dfc017afefe1cc22 Mon Sep 17 00:00:00 2001 From: "Artiom N." Date: Thu, 14 Nov 2024 16:48:09 +0300 Subject: [PATCH 2/2] Exports visibility changed: #2 --- .../impl/backend.cpp | 3 +++ .../knp/backends/cpu-multi-threaded/backend.h | 27 +++++++++---------- .../impl/backend.cpp | 3 +++ .../backends/cpu-single-threaded/backend.h | 26 +++++++++--------- 4 files changed, 30 insertions(+), 29 deletions(-) diff --git a/knp/backends/cpu/cpu-multi-threaded-backend/impl/backend.cpp b/knp/backends/cpu/cpu-multi-threaded-backend/impl/backend.cpp index 02dd857b..042d019d 100644 --- a/knp/backends/cpu/cpu-multi-threaded-backend/impl/backend.cpp +++ b/knp/backends/cpu/cpu-multi-threaded-backend/impl/backend.cpp @@ -392,4 +392,7 @@ MultiThreadedCPUBackend::ProjectionConstIterator MultiThreadedCPUBackend::end_pr return projections_.cend(); } + +BOOST_DLL_ALIAS(knp::backends::multi_threaded_cpu::MultiThreadedCPUBackend::create, create_knp_backend) + } // namespace knp::backends::multi_threaded_cpu diff --git a/knp/backends/cpu/cpu-multi-threaded-backend/include/knp/backends/cpu-multi-threaded/backend.h b/knp/backends/cpu/cpu-multi-threaded-backend/include/knp/backends/cpu-multi-threaded/backend.h index 0c6cb9ca..9fd026d4 100644 --- a/knp/backends/cpu/cpu-multi-threaded-backend/include/knp/backends/cpu-multi-threaded/backend.h +++ b/knp/backends/cpu/cpu-multi-threaded-backend/include/knp/backends/cpu-multi-threaded/backend.h @@ -4,18 +4,18 @@ * @kaspersky_support Artiom N. * @date 21.06.2023 * @license Apache 2.0 - * @copyright © 2024 AO Kaspersky Lab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and + * @copyright © 2024 AO Kaspersky Lab + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and * limitations under the License. */ @@ -363,7 +363,4 @@ class KNP_DECLSPEC MultiThreadedCPUBackend : public knp::core::Backend std::mutex ep_mutex_; }; - -BOOST_DLL_ALIAS(knp::backends::multi_threaded_cpu::MultiThreadedCPUBackend::create, create_knp_mcpu_backend) - } // namespace knp::backends::multi_threaded_cpu diff --git a/knp/backends/cpu/cpu-single-threaded-backend/impl/backend.cpp b/knp/backends/cpu/cpu-single-threaded-backend/impl/backend.cpp index c3cb19d3..1d7827a3 100644 --- a/knp/backends/cpu/cpu-single-threaded-backend/impl/backend.cpp +++ b/knp/backends/cpu/cpu-single-threaded-backend/impl/backend.cpp @@ -310,4 +310,7 @@ SingleThreadedCPUBackend::ProjectionConstIterator SingleThreadedCPUBackend::end_ return projections_.cend(); } + +BOOST_DLL_ALIAS(knp::backends::single_threaded_cpu::SingleThreadedCPUBackend::create, create_knp_backend) + } // namespace knp::backends::single_threaded_cpu diff --git a/knp/backends/cpu/cpu-single-threaded-backend/include/knp/backends/cpu-single-threaded/backend.h b/knp/backends/cpu/cpu-single-threaded-backend/include/knp/backends/cpu-single-threaded/backend.h index d2c62328..4984d999 100644 --- a/knp/backends/cpu/cpu-single-threaded-backend/include/knp/backends/cpu-single-threaded/backend.h +++ b/knp/backends/cpu/cpu-single-threaded-backend/include/knp/backends/cpu-single-threaded/backend.h @@ -4,18 +4,18 @@ * @kaspersky_support Artiom N. * @date 30.01.2023 * @license Apache 2.0 - * @copyright © 2024 AO Kaspersky Lab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and + * @copyright © 2024 AO Kaspersky Lab + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and * limitations under the License. */ @@ -368,6 +368,4 @@ class KNP_DECLSPEC SingleThreadedCPUBackend : public knp::core::Backend ProjectionContainer projections_; }; -BOOST_DLL_ALIAS(knp::backends::single_threaded_cpu::SingleThreadedCPUBackend::create, create_knp_backend) - } // namespace knp::backends::single_threaded_cpu