forked from Kistler-Group/sdbus-cpp
Skip GetMachineId test when /etc/machine-id is not available
This commit is contained in:
@ -43,6 +43,8 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <future>
|
#include <future>
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
using ::testing::Eq;
|
using ::testing::Eq;
|
||||||
using ::testing::DoubleEq;
|
using ::testing::DoubleEq;
|
||||||
using ::testing::Gt;
|
using ::testing::Gt;
|
||||||
@ -431,6 +433,13 @@ TEST_F(SdbusTestObject, PingsViaPeerInterface)
|
|||||||
|
|
||||||
TEST_F(SdbusTestObject, AnswersMachineUuidViaPeerInterface)
|
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());
|
ASSERT_NO_THROW(m_proxy->GetMachineId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user