Skip to content

Commit e155e86

Browse files
committed
Add fallback to load test modules from Release subdir
If loading a module for testing fails, attempt to load it from a "Release" subdirectory as a temporary workaround. Logs warnings on failure and notes that a better solution is needed. This improves robustness of module loading in tests.
1 parent a202d01 commit e155e86

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

‎tests/commands/CommandModulesTest.cpp‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,21 @@ CommandModule::Ptr CommandModulesTest::loadModule(
5555
auto module = std::make_unique<DynCommandModule>(moduleFilePath);
5656

5757
auto ret = module->load();
58+
if (!ret) {
59+
LOG(WARNING) << "Failed to load module " << name
60+
<< " from path: " << moduleFilePath;
61+
// Try to make ModulePath under Release
62+
// TODO: This is a temporary workaround, we should find a better
63+
// solution for this
64+
auto releaseModuleFilePath = modulePath / "Release" /
65+
moduleFileName / FS::SharedLib;
66+
module = std::make_unique<DynCommandModule>(releaseModuleFilePath);
67+
ret = module->load();
68+
if (!ret) {
69+
LOG(WARNING) << "Failed to load module " << name
70+
<< " from path: " << releaseModuleFilePath;
71+
}
72+
}
5873
EXPECT_TRUE(ret);
5974

6075
if (ret) {

0 commit comments

Comments
 (0)