Read module test versions from component lock
This commit is contained in:
2 files changed
+27
-9
No files matched your search
+16
-1
@@ -538,6 +538,16 @@ if(BUILD_TESTS AND UNIX)
|
|||||||
TARGET EchoionHost AND TARGET EchoionCore AND TARGET EchoionWeb AND
|
TARGET EchoionHost AND TARGET EchoionCore AND TARGET EchoionWeb AND
|
||||||
TARGET EchoionUrlShortenerInternalPlugin AND
|
TARGET EchoionUrlShortenerInternalPlugin AND
|
||||||
TARGET EchoionUrlShortenerExternalPlugin)
|
TARGET EchoionUrlShortenerExternalPlugin)
|
||||||
|
foreach(_echoionTestComponent IN ITEMS
|
||||||
|
EchoionHost EchoionCore EchoionWeb
|
||||||
|
EchoionPluginUrlShortenerInternal
|
||||||
|
EchoionPluginUrlShortenerExternal)
|
||||||
|
string(JSON _echoionTestComponentVersion GET
|
||||||
|
"${_echoionComponentLockJson}"
|
||||||
|
components "${_echoionTestComponent}" componentVersion)
|
||||||
|
set("_echoionTestVersion${_echoionTestComponent}"
|
||||||
|
"${_echoionTestComponentVersion}")
|
||||||
|
endforeach()
|
||||||
add_executable(EchoionModuleTests tests/ModuleDescriptors.cpp)
|
add_executable(EchoionModuleTests tests/ModuleDescriptors.cpp)
|
||||||
target_compile_features(EchoionModuleTests PRIVATE cxx_std_26)
|
target_compile_features(EchoionModuleTests PRIVATE cxx_std_26)
|
||||||
target_link_libraries(EchoionModuleTests PRIVATE
|
target_link_libraries(EchoionModuleTests PRIVATE
|
||||||
@@ -549,7 +559,12 @@ if(BUILD_TESTS AND UNIX)
|
|||||||
"ECHOION_TEST_CORE=\"$<TARGET_FILE:EchoionCore>\""
|
"ECHOION_TEST_CORE=\"$<TARGET_FILE:EchoionCore>\""
|
||||||
"ECHOION_TEST_WEB=\"$<TARGET_FILE:EchoionWeb>\""
|
"ECHOION_TEST_WEB=\"$<TARGET_FILE:EchoionWeb>\""
|
||||||
"ECHOION_TEST_PLUGIN_INTERNAL=\"$<TARGET_FILE:EchoionUrlShortenerInternalPlugin>\""
|
"ECHOION_TEST_PLUGIN_INTERNAL=\"$<TARGET_FILE:EchoionUrlShortenerInternalPlugin>\""
|
||||||
"ECHOION_TEST_PLUGIN_EXTERNAL=\"$<TARGET_FILE:EchoionUrlShortenerExternalPlugin>\"")
|
"ECHOION_TEST_PLUGIN_EXTERNAL=\"$<TARGET_FILE:EchoionUrlShortenerExternalPlugin>\""
|
||||||
|
"ECHOION_TEST_HOST_VERSION=\"${_echoionTestVersionEchoionHost}\""
|
||||||
|
"ECHOION_TEST_CORE_VERSION=\"${_echoionTestVersionEchoionCore}\""
|
||||||
|
"ECHOION_TEST_WEB_VERSION=\"${_echoionTestVersionEchoionWeb}\""
|
||||||
|
"ECHOION_TEST_PLUGIN_INTERNAL_VERSION=\"${_echoionTestVersionEchoionPluginUrlShortenerInternal}\""
|
||||||
|
"ECHOION_TEST_PLUGIN_EXTERNAL_VERSION=\"${_echoionTestVersionEchoionPluginUrlShortenerExternal}\"")
|
||||||
void_add_tests(EchoionModuleTests)
|
void_add_tests(EchoionModuleTests)
|
||||||
add_test(NAME echoion_module_descriptor_tests
|
add_test(NAME echoion_module_descriptor_tests
|
||||||
COMMAND EchoionModuleTests)
|
COMMAND EchoionModuleTests)
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
#include <string>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
@@ -25,31 +26,31 @@ Void::Testing::Test component_module_descriptors_are_loadable()
|
|||||||
.path = ECHOION_TEST_HOST,
|
.path = ECHOION_TEST_HOST,
|
||||||
.moduleId = "EchoionHost",
|
.moduleId = "EchoionHost",
|
||||||
.stableComponentId = "EchoionHost",
|
.stableComponentId = "EchoionHost",
|
||||||
.version = "2.0.0",
|
.version = ECHOION_TEST_HOST_VERSION,
|
||||||
},
|
},
|
||||||
ModuleExpectation{
|
ModuleExpectation{
|
||||||
.path = ECHOION_TEST_CORE,
|
.path = ECHOION_TEST_CORE,
|
||||||
.moduleId = "EchoionCore",
|
.moduleId = "EchoionCore",
|
||||||
.stableComponentId = "EchoionCore",
|
.stableComponentId = "EchoionCore",
|
||||||
.version = "2.0.0",
|
.version = ECHOION_TEST_CORE_VERSION,
|
||||||
},
|
},
|
||||||
ModuleExpectation{
|
ModuleExpectation{
|
||||||
.path = ECHOION_TEST_WEB,
|
.path = ECHOION_TEST_WEB,
|
||||||
.moduleId = "EchoionWeb",
|
.moduleId = "EchoionWeb",
|
||||||
.stableComponentId = "EchoionWeb",
|
.stableComponentId = "EchoionWeb",
|
||||||
.version = "2.0.0",
|
.version = ECHOION_TEST_WEB_VERSION,
|
||||||
},
|
},
|
||||||
ModuleExpectation{
|
ModuleExpectation{
|
||||||
.path = ECHOION_TEST_PLUGIN_INTERNAL,
|
.path = ECHOION_TEST_PLUGIN_INTERNAL,
|
||||||
.moduleId = "url-shortener-internal",
|
.moduleId = "url-shortener-internal",
|
||||||
.stableComponentId = "EchoionPluginUrlShortenerInternal",
|
.stableComponentId = "EchoionPluginUrlShortenerInternal",
|
||||||
.version = "2.0.0",
|
.version = ECHOION_TEST_PLUGIN_INTERNAL_VERSION,
|
||||||
},
|
},
|
||||||
ModuleExpectation{
|
ModuleExpectation{
|
||||||
.path = ECHOION_TEST_PLUGIN_EXTERNAL,
|
.path = ECHOION_TEST_PLUGIN_EXTERNAL,
|
||||||
.moduleId = "url-shortener-external",
|
.moduleId = "url-shortener-external",
|
||||||
.stableComponentId = "EchoionPluginUrlShortenerExternal",
|
.stableComponentId = "EchoionPluginUrlShortenerExternal",
|
||||||
.version = "2.0.0",
|
.version = ECHOION_TEST_PLUGIN_EXTERNAL_VERSION,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -103,9 +104,11 @@ Void::Testing::Test component_module_descriptors_are_loadable()
|
|||||||
std::string_view{stable->component_id.data,
|
std::string_view{stable->component_id.data,
|
||||||
stable->component_id.size},
|
stable->component_id.size},
|
||||||
expected.stableComponentId);
|
expected.stableComponentId);
|
||||||
Void::Testing::expect_eq(stable->version_major, 2U);
|
const auto stableVersion =
|
||||||
Void::Testing::expect_eq(stable->version_minor, 0U);
|
std::to_string(stable->version_major) + "." +
|
||||||
Void::Testing::expect_eq(stable->version_patch, 0U);
|
std::to_string(stable->version_minor) + "." +
|
||||||
|
std::to_string(stable->version_patch);
|
||||||
|
Void::Testing::expect_eq(stableVersion, expected.version);
|
||||||
Void::Testing::expect(stable->api != nullptr);
|
Void::Testing::expect(stable->api != nullptr);
|
||||||
if (stable->api != nullptr) {
|
if (stable->api != nullptr) {
|
||||||
Void::Testing::expect_eq(stable->api->struct_size,
|
Void::Testing::expect_eq(stable->api->struct_size,
|
||||||
|
|||||||
Reference in new issue
Block a user