From c6d4d2710f64793daa8ebb83f77e34d068e9cdbf Mon Sep 17 00:00:00 2001 From: sangelovic Date: Fri, 11 Oct 2019 15:56:00 +0200 Subject: [PATCH] Skip GetMachineId test when /etc/machine-id is not available --- tests/integrationtests/AdaptorAndProxy_test.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/integrationtests/AdaptorAndProxy_test.cpp b/tests/integrationtests/AdaptorAndProxy_test.cpp index 1220b47..96b6020 100644 --- a/tests/integrationtests/AdaptorAndProxy_test.cpp +++ b/tests/integrationtests/AdaptorAndProxy_test.cpp @@ -43,6 +43,8 @@ #include #include +#include + using ::testing::Eq; using ::testing::DoubleEq; using ::testing::Gt; @@ -431,6 +433,13 @@ TEST_F(SdbusTestObject, PingsViaPeerInterface) TEST_F(SdbusTestObject, AnswersMachineUuidViaPeerInterface) { + // If /etc/machine-id does not exist in your system (which is very likely because you have + // a non-systemd Linux), org.freedesktop.DBus.Peer.GetMachineId() will not work. To solve + // this, you can create /etc/machine-id yourself as symlink to /var/lib/dbus/machine-id, + // and then org.freedesktop.DBus.Peer.GetMachineId() will start to work. + if (::access("/etc/machine-id", F_OK) == -1) + GTEST_SKIP() << "/etc/machine-id file does not exist, GetMachineId() will not work"; + ASSERT_NO_THROW(m_proxy->GetMachineId()); }