The dbus test is dependent on the org.freedesktop.hostname1 service
being present. If that isn't there, we really can't determine whether or
not the PlatformInfo code does what it's supposed to do.
So try to determine whether or not it makes sense to execute this test
in the first place.
Signed-off-by: Frans Klaver
---
src/tests/unit/platforminfo.cpp | 14 ++
1 file changed, 14 insertions(+)
diff --git a/src/tests/unit/platforminfo.cpp b/src/tests/unit/platforminfo.cpp
index 453de63..1460367 100644
--- a/src/tests/unit/platforminfo.cpp
+++ b/src/tests/unit/platforminfo.cpp
@@ -45,6 +45,20 @@ TEST(PlatformInfo, DBus)
}
PlatformInfo plinfo(dbc.GetConnection());
+
+try
+{
+plinfo.GetStringProperty("OperatingSystemCPEName");
+}
+catch (const DBusException& e)
+{
+const std::string what{e.what()};
+if (what.find("was not provided by any") != std::string::npos)
+{
+GTEST_SKIP() << "A required service isn't available ## " + what;
+}
+}
+
std::string s{plinfo.str()};
ASSERT_TRUE(s.find("generic:") == std::string::npos)
<< "PlatformInfo D-Bus call failed";
--
2.38.1
___
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel