Skip to content

Commit

Permalink
iox-eclipse-iceoryx#459 try to fix windows build
Browse files Browse the repository at this point in the history
Signed-off-by: Mathias Kraus <[email protected]>
  • Loading branch information
elBoberido committed Jan 7, 2021
1 parent 2adc7d5 commit 2a5208d
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions iceoryx_posh/test/moduletests/test_posh_runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ using iox::roudi::RouDiEnvironment;
class PoshRuntimeTestAccess : public PoshRuntime
{
public:
using PoshRuntime::defaultRuntimeFactory;
using PoshRuntime::factory_t;
/// @attention do not use the setRuntimeFactory in a test with a running RouDiEnvironment
using PoshRuntime::setRuntimeFactory;
Expand All @@ -34,6 +33,16 @@ class PoshRuntimeTestAccess : public PoshRuntime
: PoshRuntime(s)
{
}

static PoshRuntime& getDefaultRuntime(iox::cxx::optional<const iox::ProcessName_t*> name)
{
return PoshRuntime::defaultRuntimeFactory(name);
}

static void resetRuntimeFactory()
{
PoshRuntime::setRuntimeFactory(PoshRuntime::defaultRuntimeFactory);
}
};

namespace
Expand All @@ -42,7 +51,7 @@ bool callbackWasCalled = false;
PoshRuntime& testFactory(iox::cxx::optional<const iox::ProcessName_t*> name)
{
callbackWasCalled = true;
return PoshRuntimeTestAccess::defaultRuntimeFactory(name);
return PoshRuntimeTestAccess::getDefaultRuntime(name);
}
} // namespace

Expand Down Expand Up @@ -465,7 +474,7 @@ TEST(PoshRuntimeFactory_test, DISABLED_SetValidRuntimeFactorySucceeds)
// do not use the setRuntimeFactory in a test with a running RouDiEnvironment
PoshRuntimeTestAccess::setRuntimeFactory(testFactory);
PoshRuntimeTestAccess::initRuntime("instance");
PoshRuntimeTestAccess::setRuntimeFactory(PoshRuntimeTestAccess::defaultRuntimeFactory);
PoshRuntimeTestAccess::resetRuntimeFactory();

EXPECT_TRUE(callbackWasCalled);
}
Expand All @@ -478,5 +487,5 @@ TEST(PoshRuntimeFactory_test, DISABLED_SetEmptyRuntimeFactoryFails)
EXPECT_DEATH({ PoshRuntimeTestAccess::setRuntimeFactory(PoshRuntimeTestAccess::factory_t()); },
"Cannot set runtime factory. Passed factory must not be empty!");
// just in case the previous test doesn't die and breaks the following tests
PoshRuntimeTestAccess::setRuntimeFactory(PoshRuntimeTestAccess::defaultRuntimeFactory);
PoshRuntimeTestAccess::resetRuntimeFactory();
}

0 comments on commit 2a5208d

Please sign in to comment.