Skip to content

Commit

Permalink
iox-eclipse-iceoryx#381 remove leading slash check from runtime
Browse files Browse the repository at this point in the history
Signed-off-by: Dietrich Krönke <dietrich.kroenke@apex.ai>
  • Loading branch information
dkroenke committed Dec 12, 2020
1 parent 5771c49 commit 283c22b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 20 deletions.
6 changes: 0 additions & 6 deletions iceoryx_posh/source/runtime/posh_runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,6 @@ const ProcessName_t& PoshRuntime::verifyInstanceName(cxx::optional<const Process
LogError() << "Cannot initialize runtime. Application name must not be empty!";
std::terminate();
}
else if (name.value()->c_str()[0] != '/')
{
LogError() << "Cannot initialize runtime. Application name " << *name.value()
<< " does not have the required leading slash '/'";
std::terminate();
}

return *name.value();
}
Expand Down
18 changes: 4 additions & 14 deletions iceoryx_posh/test/moduletests/test_posh_runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class PoshRuntime_test : public Test
std::this_thread::sleep_for(std::chrono::milliseconds(200));
}

const iox::ProcessName_t m_runtimeName{"/publisher"};
const iox::ProcessName_t m_runtimeName{"publisher"};
RouDiEnvironment m_roudiEnv{iox::RouDiConfig_t().setDefaults()};
PoshRuntime* m_runtime{&iox::runtime::PoshRuntime::initRuntime(m_runtimeName)};
MqMessage m_sendBuffer;
Expand All @@ -96,7 +96,7 @@ bool PoshRuntime_test::m_errorHandlerCalled{false};

TEST_F(PoshRuntime_test, ValidAppName)
{
iox::ProcessName_t appName("/valid_name");
iox::ProcessName_t appName("valid_name");

EXPECT_NO_FATAL_FAILURE({ PoshRuntime::initRuntime(appName); });
}
Expand All @@ -121,16 +121,6 @@ TEST_F(PoshRuntime_test, NoAppName)
}


TEST_F(PoshRuntime_test, NoLeadingSlashAppName)
{
const iox::ProcessName_t invalidAppName = "invalidname";

EXPECT_DEATH(
{ PoshRuntime::initRuntime(invalidAppName); },
"Cannot initialize runtime. Application name invalidname does not have the required leading slash '/'");
}


// since getInstance is a singleton and test class creates instance of Poshruntime
// when getInstance() is called without parameter, it returns existing instance
// To be able to test this, we don't use the test fixture
Expand All @@ -143,7 +133,7 @@ TEST(PoshRuntime, AppNameEmpty)

TEST_F(PoshRuntime_test, GetInstanceNameIsSuccessful)
{
const iox::ProcessName_t appname = "/app";
const iox::ProcessName_t appname = "app";

auto& sut = PoshRuntime::initRuntime(appname);

Expand Down Expand Up @@ -526,7 +516,7 @@ TEST_F(PoshRuntime_test, CreateNodeReturnValue)
TEST_F(PoshRuntime_test, SetValidRuntimeFactorySucceeds)
{
PoshRuntimeTestAccess::setRuntimeFactory(testFactory);
PoshRuntimeTestAccess::initRuntime("/instance");
PoshRuntimeTestAccess::initRuntime("instance");

EXPECT_TRUE(callbackWasCalled);
}
Expand Down

0 comments on commit 283c22b

Please sign in to comment.