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 EchoionUrlShortenerInternalPlugin AND
|
||||
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)
|
||||
target_compile_features(EchoionModuleTests PRIVATE cxx_std_26)
|
||||
target_link_libraries(EchoionModuleTests PRIVATE
|
||||
@@ -549,7 +559,12 @@ if(BUILD_TESTS AND UNIX)
|
||||
"ECHOION_TEST_CORE=\"$<TARGET_FILE:EchoionCore>\""
|
||||
"ECHOION_TEST_WEB=\"$<TARGET_FILE:EchoionWeb>\""
|
||||
"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)
|
||||
add_test(NAME echoion_module_descriptor_tests
|
||||
COMMAND EchoionModuleTests)
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include <array>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
namespace
|
||||
@@ -25,31 +26,31 @@ Void::Testing::Test component_module_descriptors_are_loadable()
|
||||
.path = ECHOION_TEST_HOST,
|
||||
.moduleId = "EchoionHost",
|
||||
.stableComponentId = "EchoionHost",
|
||||
.version = "2.0.0",
|
||||
.version = ECHOION_TEST_HOST_VERSION,
|
||||
},
|
||||
ModuleExpectation{
|
||||
.path = ECHOION_TEST_CORE,
|
||||
.moduleId = "EchoionCore",
|
||||
.stableComponentId = "EchoionCore",
|
||||
.version = "2.0.0",
|
||||
.version = ECHOION_TEST_CORE_VERSION,
|
||||
},
|
||||
ModuleExpectation{
|
||||
.path = ECHOION_TEST_WEB,
|
||||
.moduleId = "EchoionWeb",
|
||||
.stableComponentId = "EchoionWeb",
|
||||
.version = "2.0.0",
|
||||
.version = ECHOION_TEST_WEB_VERSION,
|
||||
},
|
||||
ModuleExpectation{
|
||||
.path = ECHOION_TEST_PLUGIN_INTERNAL,
|
||||
.moduleId = "url-shortener-internal",
|
||||
.stableComponentId = "EchoionPluginUrlShortenerInternal",
|
||||
.version = "2.0.0",
|
||||
.version = ECHOION_TEST_PLUGIN_INTERNAL_VERSION,
|
||||
},
|
||||
ModuleExpectation{
|
||||
.path = ECHOION_TEST_PLUGIN_EXTERNAL,
|
||||
.moduleId = "url-shortener-external",
|
||||
.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,
|
||||
stable->component_id.size},
|
||||
expected.stableComponentId);
|
||||
Void::Testing::expect_eq(stable->version_major, 2U);
|
||||
Void::Testing::expect_eq(stable->version_minor, 0U);
|
||||
Void::Testing::expect_eq(stable->version_patch, 0U);
|
||||
const auto stableVersion =
|
||||
std::to_string(stable->version_major) + "." +
|
||||
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);
|
||||
if (stable->api != nullptr) {
|
||||
Void::Testing::expect_eq(stable->api->struct_size,
|
||||
|
||||
Reference in new issue
Block a user