| 1 |
/* SPDX-License-Identifier: LGPL-2.1-or-later */ |
| 2 |
|
| 3 |
#include "alloc-util.h" |
| 4 |
#include "busctl-introspect.h" |
| 5 |
#include "set.h" |
| 6 |
#include "strv.h" |
| 7 |
#include "tests.h" |
| 8 |
|
| 9 |
static const char *xml_root = |
| 10 |
"<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN\"\n\"https://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\">\n" |
| 11 |
"<node>\n" |
| 12 |
" <interface name=\"org.freedesktop.DBus.Peer\">\n" |
| 13 |
" <method name=\"Ping\"/>\n" |
| 14 |
" <method name=\"GetMachineId\">\n" |
| 15 |
" <arg type=\"s\" name=\"machine_uuid\" direction=\"out\"/>\n" |
| 16 |
" </method>\n" |
| 17 |
" </interface>\n" |
| 18 |
" <interface name=\"org.freedesktop.DBus.Introspectable\">\n" |
| 19 |
" <method name=\"Introspect\">\n" |
| 20 |
" <arg name=\"data\" type=\"s\" direction=\"out\"/>\n" |
| 21 |
" </method>\n" |
| 22 |
" </interface>\n" |
| 23 |
" <interface name=\"org.freedesktop.DBus.Properties\">\n" |
| 24 |
" <method name=\"Get\">\n" |
| 25 |
" <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n" |
| 26 |
" <arg name=\"property\" direction=\"in\" type=\"s\"/>\n" |
| 27 |
" <arg name=\"value\" direction=\"out\" type=\"v\"/>\n" |
| 28 |
" </method>\n" |
| 29 |
" <method name=\"GetAll\">\n" |
| 30 |
" <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n" |
| 31 |
" <arg name=\"properties\" direction=\"out\" type=\"a{sv}\"/>\n" |
| 32 |
" </method>\n" |
| 33 |
" <method name=\"Set\">\n" |
| 34 |
" <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n" |
| 35 |
" <arg name=\"property\" direction=\"in\" type=\"s\"/>\n" |
| 36 |
" <arg name=\"value\" direction=\"in\" type=\"v\"/>\n" |
| 37 |
" </method>\n" |
| 38 |
" <signal name=\"PropertiesChanged\">\n" |
| 39 |
" <arg type=\"s\" name=\"interface\"/>\n" |
| 40 |
" <arg type=\"a{sv}\" name=\"changed_properties\"/>\n" |
| 41 |
" <arg type=\"as\" name=\"invalidated_properties\"/>\n" |
| 42 |
" </signal>\n" |
| 43 |
" </interface>\n" |
| 44 |
" <node name=\"org\"/>\n" |
| 45 |
"</node>\n"; |
| 46 |
|
| 47 |
static const char *xml_org = |
| 48 |
"<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN\"\n\"https://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\">\n" |
| 49 |
"<node>\n" |
| 50 |
" <interface name=\"org.freedesktop.DBus.Peer\">\n" |
| 51 |
" <method name=\"Ping\"/>\n" |
| 52 |
" <method name=\"GetMachineId\">\n" |
| 53 |
" <arg type=\"s\" name=\"machine_uuid\" direction=\"out\"/>\n" |
| 54 |
" </method>\n" |
| 55 |
" </interface>\n" |
| 56 |
" <interface name=\"org.freedesktop.DBus.Introspectable\">\n" |
| 57 |
" <method name=\"Introspect\">\n" |
| 58 |
" <arg name=\"data\" type=\"s\" direction=\"out\"/>\n" |
| 59 |
" </method>\n" |
| 60 |
" </interface>\n" |
| 61 |
" <interface name=\"org.freedesktop.DBus.Properties\">\n" |
| 62 |
" <method name=\"Get\">\n" |
| 63 |
" <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n" |
| 64 |
" <arg name=\"property\" direction=\"in\" type=\"s\"/>\n" |
| 65 |
" <arg name=\"value\" direction=\"out\" type=\"v\"/>\n" |
| 66 |
" </method>\n" |
| 67 |
" <method name=\"GetAll\">\n" |
| 68 |
" <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n" |
| 69 |
" <arg name=\"properties\" direction=\"out\" type=\"a{sv}\"/>\n" |
| 70 |
" </method>\n" |
| 71 |
" <method name=\"Set\">\n" |
| 72 |
" <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n" |
| 73 |
" <arg name=\"property\" direction=\"in\" type=\"s\"/>\n" |
| 74 |
" <arg name=\"value\" direction=\"in\" type=\"v\"/>\n" |
| 75 |
" </method>\n" |
| 76 |
" <signal name=\"PropertiesChanged\">\n" |
| 77 |
" <arg type=\"s\" name=\"interface\"/>\n" |
| 78 |
" <arg type=\"a{sv}\" name=\"changed_properties\"/>\n" |
| 79 |
" <arg type=\"as\" name=\"invalidated_properties\"/>\n" |
| 80 |
" </signal>\n" |
| 81 |
" </interface>\n" |
| 82 |
" <node name=\"freedesktop\"/>\n" |
| 83 |
"</node>\n"; |
| 84 |
|
| 85 |
static const char *xml_org_freedesktop = |
| 86 |
"<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN\"\n\"https://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\">\n" |
| 87 |
"<node>\n" |
| 88 |
" <interface name=\"org.freedesktop.DBus.Peer\">\n" |
| 89 |
" <method name=\"Ping\"/>\n" |
| 90 |
" <method name=\"GetMachineId\">\n" |
| 91 |
" <arg type=\"s\" name=\"machine_uuid\" direction=\"out\"/>\n" |
| 92 |
" </method>\n" |
| 93 |
" </interface>\n" |
| 94 |
" <interface name=\"org.freedesktop.DBus.Introspectable\">\n" |
| 95 |
" <method name=\"Introspect\">\n" |
| 96 |
" <arg name=\"data\" type=\"s\" direction=\"out\"/>\n" |
| 97 |
" </method>\n" |
| 98 |
" </interface>\n" |
| 99 |
" <interface name=\"org.freedesktop.DBus.Properties\">\n" |
| 100 |
" <method name=\"Get\">\n" |
| 101 |
" <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n" |
| 102 |
" <arg name=\"property\" direction=\"in\" type=\"s\"/>\n" |
| 103 |
" <arg name=\"value\" direction=\"out\" type=\"v\"/>\n" |
| 104 |
" </method>\n" |
| 105 |
" <method name=\"GetAll\">\n" |
| 106 |
" <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n" |
| 107 |
" <arg name=\"properties\" direction=\"out\" type=\"a{sv}\"/>\n" |
| 108 |
" </method>\n" |
| 109 |
" <method name=\"Set\">\n" |
| 110 |
" <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n" |
| 111 |
" <arg name=\"property\" direction=\"in\" type=\"s\"/>\n" |
| 112 |
" <arg name=\"value\" direction=\"in\" type=\"v\"/>\n" |
| 113 |
" </method>\n" |
| 114 |
" <signal name=\"PropertiesChanged\">\n" |
| 115 |
" <arg type=\"s\" name=\"interface\"/>\n" |
| 116 |
" <arg type=\"a{sv}\" name=\"changed_properties\"/>\n" |
| 117 |
" <arg type=\"as\" name=\"invalidated_properties\"/>\n" |
| 118 |
" </signal>\n" |
| 119 |
" </interface>\n" |
| 120 |
" <node name=\"LogControl1\"/>\n" |
| 121 |
" <node name=\"network1\"/>\n" |
| 122 |
"</node>\n"; |
| 123 |
|
| 124 |
static const char *xml_org_freedesktop_LogControl1 = |
| 125 |
"<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN\"\n\"https://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\">\n" |
| 126 |
"<node>\n" |
| 127 |
" <interface name=\"org.freedesktop.DBus.Peer\">\n" |
| 128 |
" <method name=\"Ping\"/>\n" |
| 129 |
" <method name=\"GetMachineId\">\n" |
| 130 |
" <arg type=\"s\" name=\"machine_uuid\" direction=\"out\"/>\n" |
| 131 |
" </method>\n" |
| 132 |
" </interface>\n" |
| 133 |
" <interface name=\"org.freedesktop.DBus.Introspectable\">\n" |
| 134 |
" <method name=\"Introspect\">\n" |
| 135 |
" <arg name=\"data\" type=\"s\" direction=\"out\"/>\n" |
| 136 |
" </method>\n" |
| 137 |
" </interface>\n" |
| 138 |
" <interface name=\"org.freedesktop.DBus.Properties\">\n" |
| 139 |
" <method name=\"Get\">\n" |
| 140 |
" <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n" |
| 141 |
" <arg name=\"property\" direction=\"in\" type=\"s\"/>\n" |
| 142 |
" <arg name=\"value\" direction=\"out\" type=\"v\"/>\n" |
| 143 |
" </method>\n" |
| 144 |
" <method name=\"GetAll\">\n" |
| 145 |
" <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n" |
| 146 |
" <arg name=\"properties\" direction=\"out\" type=\"a{sv}\"/>\n" |
| 147 |
" </method>\n" |
| 148 |
" <method name=\"Set\">\n" |
| 149 |
" <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n" |
| 150 |
" <arg name=\"property\" direction=\"in\" type=\"s\"/>\n" |
| 151 |
" <arg name=\"value\" direction=\"in\" type=\"v\"/>\n" |
| 152 |
" </method>\n" |
| 153 |
" <signal name=\"PropertiesChanged\">\n" |
| 154 |
" <arg type=\"s\" name=\"interface\"/>\n" |
| 155 |
" <arg type=\"a{sv}\" name=\"changed_properties\"/>\n" |
| 156 |
" <arg type=\"as\" name=\"invalidated_properties\"/>\n" |
| 157 |
" </signal>\n" |
| 158 |
" </interface>\n" |
| 159 |
"<interface name=\"org.freedesktop.LogControl1\">\n" |
| 160 |
" <property name=\"LogLevel\" type=\"s\" access=\"readwrite\">\n" |
| 161 |
" <annotation name=\"org.freedesktop.DBus.Property.EmitsChangedSignal\" value=\"false\"/>\n" |
| 162 |
" <annotation name=\"org.freedesktop.systemd1.Privileged\" value=\"true\"/>\n" |
| 163 |
" </property>\n" |
| 164 |
" <property name=\"LogTarget\" type=\"s\" access=\"readwrite\">\n" |
| 165 |
" <annotation name=\"org.freedesktop.DBus.Property.EmitsChangedSignal\" value=\"false\"/>\n" |
| 166 |
" <annotation name=\"org.freedesktop.systemd1.Privileged\" value=\"true\"/>\n" |
| 167 |
" </property>\n" |
| 168 |
" <property name=\"SyslogIdentifier\" type=\"s\" access=\"read\">\n" |
| 169 |
" <annotation name=\"org.freedesktop.DBus.Property.EmitsChangedSignal\" value=\"false\"/>\n" |
| 170 |
" </property>\n" |
| 171 |
" </interface>\n" |
| 172 |
"</node>\n"; |
| 173 |
|
| 174 |
static const char *xml_org_freedesktop_network1 = |
| 175 |
"<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN\"\n\"https://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\">\n" |
| 176 |
"<node>\n" |
| 177 |
" <interface name=\"org.freedesktop.DBus.Peer\">\n" |
| 178 |
" <method name=\"Ping\"/>\n" |
| 179 |
" <method name=\"GetMachineId\">\n" |
| 180 |
" <arg type=\"s\" name=\"machine_uuid\" direction=\"out\"/>\n" |
| 181 |
" </method>\n" |
| 182 |
" </interface>\n" |
| 183 |
" <interface name=\"org.freedesktop.DBus.Introspectable\">\n" |
| 184 |
" <method name=\"Introspect\">\n" |
| 185 |
" <arg name=\"data\" type=\"s\" direction=\"out\"/>\n" |
| 186 |
" </method>\n" |
| 187 |
" </interface>\n" |
| 188 |
" <interface name=\"org.freedesktop.DBus.Properties\">\n" |
| 189 |
" <method name=\"Get\">\n" |
| 190 |
" <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n" |
| 191 |
" <arg name=\"property\" direction=\"in\" type=\"s\"/>\n" |
| 192 |
" <arg name=\"value\" direction=\"out\" type=\"v\"/>\n" |
| 193 |
" </method>\n" |
| 194 |
" <method name=\"GetAll\">\n" |
| 195 |
" <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n" |
| 196 |
" <arg name=\"properties\" direction=\"out\" type=\"a{sv}\"/>\n" |
| 197 |
" </method>\n" |
| 198 |
" <method name=\"Set\">\n" |
| 199 |
" <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n" |
| 200 |
" <arg name=\"property\" direction=\"in\" type=\"s\"/>\n" |
| 201 |
" <arg name=\"value\" direction=\"in\" type=\"v\"/>\n" |
| 202 |
" </method>\n" |
| 203 |
" <signal name=\"PropertiesChanged\">\n" |
| 204 |
" <arg type=\"s\" name=\"interface\"/>\n" |
| 205 |
" <arg type=\"a{sv}\" name=\"changed_properties\"/>\n" |
| 206 |
" <arg type=\"as\" name=\"invalidated_properties\"/>\n" |
| 207 |
" </signal>\n" |
| 208 |
" </interface>\n" |
| 209 |
" <node name=\"network\"/>\n" |
| 210 |
"</node>\n"; |
| 211 |
|
| 212 |
static const char *xml_org_freedesktop_network1_network = |
| 213 |
"<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN\"\n\"https://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\">\n" |
| 214 |
"<node>\n" |
| 215 |
" <interface name=\"org.freedesktop.DBus.Peer\">\n" |
| 216 |
" <method name=\"Ping\"/>\n" |
| 217 |
" <method name=\"GetMachineId\">\n" |
| 218 |
" <arg type=\"s\" name=\"machine_uuid\" direction=\"out\"/>\n" |
| 219 |
" </method>\n" |
| 220 |
" </interface>\n" |
| 221 |
" <interface name=\"org.freedesktop.DBus.Introspectable\">\n" |
| 222 |
" <method name=\"Introspect\">\n" |
| 223 |
" <arg name=\"data\" type=\"s\" direction=\"out\"/>\n" |
| 224 |
" </method>\n" |
| 225 |
" </interface>\n" |
| 226 |
" <interface name=\"org.freedesktop.DBus.Properties\">\n" |
| 227 |
" <method name=\"Get\">\n" |
| 228 |
" <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n" |
| 229 |
" <arg name=\"property\" direction=\"in\" type=\"s\"/>\n" |
| 230 |
" <arg name=\"value\" direction=\"out\" type=\"v\"/>\n" |
| 231 |
" </method>\n" |
| 232 |
" <method name=\"GetAll\">\n" |
| 233 |
" <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n" |
| 234 |
" <arg name=\"properties\" direction=\"out\" type=\"a{sv}\"/>\n" |
| 235 |
" </method>\n" |
| 236 |
" <method name=\"Set\">\n" |
| 237 |
" <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n" |
| 238 |
" <arg name=\"property\" direction=\"in\" type=\"s\"/>\n" |
| 239 |
" <arg name=\"value\" direction=\"in\" type=\"v\"/>\n" |
| 240 |
" </method>\n" |
| 241 |
" <signal name=\"PropertiesChanged\">\n" |
| 242 |
" <arg type=\"s\" name=\"interface\"/>\n" |
| 243 |
" <arg type=\"a{sv}\" name=\"changed_properties\"/>\n" |
| 244 |
" <arg type=\"as\" name=\"invalidated_properties\"/>\n" |
| 245 |
" </signal>\n" |
| 246 |
" </interface>\n" |
| 247 |
" <node name=\"0\"/>\n" |
| 248 |
" <node name=\"1\"/>\n" |
| 249 |
" <node name=\"2\"/>\n" |
| 250 |
" <node name=\"3\"/>\n" |
| 251 |
" <node name=\"4\"/>\n" |
| 252 |
" <node name=\"5\"/>\n" |
| 253 |
" <node name=\"6\"/>\n" |
| 254 |
" <node name=\"7\"/>\n" |
| 255 |
" <node name=\"8\"/>\n" |
| 256 |
" <node name=\"9\"/>\n" |
| 257 |
" <node name=\"10\"/>\n" |
| 258 |
" <node name=\"11\"/>\n" |
| 259 |
" <node name=\"12\"/>\n" |
| 260 |
" <node name=\"13\"/>\n" |
| 261 |
" <node name=\"14\"/>\n" |
| 262 |
" <node name=\"15\"/>\n" |
| 263 |
" <node name=\"16\"/>\n" |
| 264 |
" <node name=\"17\"/>\n" |
| 265 |
" <node name=\"18\"/>\n" |
| 266 |
" <node name=\"19\"/>\n" |
| 267 |
" <node name=\"20\"/>\n" |
| 268 |
"</node>\n"; |
| 269 |
|
| 270 |
static const char *xml_org_freedesktop_network1_network_unsigned = |
| 271 |
"<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN\"\n\"https://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\">\n" |
| 272 |
"<node>\n" |
| 273 |
" <interface name=\"org.freedesktop.DBus.Peer\">\n" |
| 274 |
" <method name=\"Ping\"/>\n" |
| 275 |
" <method name=\"GetMachineId\">\n" |
| 276 |
" <arg type=\"s\" name=\"machine_uuid\" direction=\"out\"/>\n" |
| 277 |
" </method>\n" |
| 278 |
" </interface>\n" |
| 279 |
" <interface name=\"org.freedesktop.DBus.Introspectable\">\n" |
| 280 |
" <method name=\"Introspect\">\n" |
| 281 |
" <arg name=\"data\" type=\"s\" direction=\"out\"/>\n" |
| 282 |
" </method>\n" |
| 283 |
" </interface>\n" |
| 284 |
" <interface name=\"org.freedesktop.DBus.Properties\">\n" |
| 285 |
" <method name=\"Get\">\n" |
| 286 |
" <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n" |
| 287 |
" <arg name=\"property\" direction=\"in\" type=\"s\"/>\n" |
| 288 |
" <arg name=\"value\" direction=\"out\" type=\"v\"/>\n" |
| 289 |
" </method>\n" |
| 290 |
" <method name=\"GetAll\">\n" |
| 291 |
" <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n" |
| 292 |
" <arg name=\"properties\" direction=\"out\" type=\"a{sv}\"/>\n" |
| 293 |
" </method>\n" |
| 294 |
" <method name=\"Set\">\n" |
| 295 |
" <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n" |
| 296 |
" <arg name=\"property\" direction=\"in\" type=\"s\"/>\n" |
| 297 |
" <arg name=\"value\" direction=\"in\" type=\"v\"/>\n" |
| 298 |
" </method>\n" |
| 299 |
" <signal name=\"PropertiesChanged\">\n" |
| 300 |
" <arg type=\"s\" name=\"interface\"/>\n" |
| 301 |
" <arg type=\"a{sv}\" name=\"changed_properties\"/>\n" |
| 302 |
" <arg type=\"as\" name=\"invalidated_properties\"/>\n" |
| 303 |
" </signal>\n" |
| 304 |
" </interface>\n" |
| 305 |
" <node name=\"hoge\"/>\n" |
| 306 |
"</node>\n"; |
| 307 |
|
| 308 |
static int on_path(const char *path, void *userdata) { |
| 309 |
Set *paths = userdata; |
| 310 |
|
| 311 |
assert_se(paths); |
| 312 |
assert_se(set_put_strdup(&paths, path) >= 0); |
| 313 |
|
| 314 |
return 0; |
| 315 |
} |
| 316 |
|
| 317 |
TEST(introspect_on_path) { |
| 318 |
static const XMLIntrospectOps ops = { |
| 319 |
.on_path = on_path, |
| 320 |
}; |
| 321 |
_cleanup_strv_free_ char **expected = NULL; |
| 322 |
_cleanup_set_free_ Set *paths = NULL; |
| 323 |
_cleanup_free_ char **l = NULL; |
| 324 |
|
| 325 |
assert_se(set_put_strdup(&paths, "/") > 0); |
| 326 |
|
| 327 |
log_debug("/* parse_xml_introspect(\"/\") */"); |
| 328 |
assert_se(parse_xml_introspect("/", xml_root, &ops, paths) >= 0); |
| 329 |
log_debug("/* parse_xml_introspect(\"/org\") */"); |
| 330 |
assert_se(parse_xml_introspect("/org", xml_org, &ops, paths) >= 0); |
| 331 |
log_debug("/* parse_xml_introspect(\"/org/freedesktop\") */"); |
| 332 |
assert_se(parse_xml_introspect("/org/freedesktop", xml_org_freedesktop, &ops, paths) >= 0); |
| 333 |
log_debug("/* parse_xml_introspect(\"/org/freedesktop/LogControl1\") */"); |
| 334 |
assert_se(parse_xml_introspect("/org/freedesktop/LogControl1", xml_org_freedesktop_LogControl1, &ops, paths) >= 0); |
| 335 |
log_debug("/* parse_xml_introspect(\"/org/freedesktop/network1\") */"); |
| 336 |
assert_se(parse_xml_introspect("/org/freedesktop/network1", xml_org_freedesktop_network1, &ops, paths) >= 0); |
| 337 |
log_debug("/* parse_xml_introspect(\"/org/freedesktop/network1/network\") */"); |
| 338 |
assert_se(parse_xml_introspect("/org/freedesktop/network1/network", xml_org_freedesktop_network1_network, &ops, paths) >= 0); |
| 339 |
for (unsigned i = 0; i <= 20; i++) { |
| 340 |
_cleanup_free_ char *path = NULL; |
| 341 |
|
| 342 |
assert_se(asprintf(&path, "/org/freedesktop/network1/network/%u", i) >= 0); |
| 343 |
log_debug("/* parse_xml_introspect(\"%s\") */", path); |
| 344 |
assert_se(parse_xml_introspect(path, xml_org_freedesktop_network1_network_unsigned, &ops, paths) >= 0); |
| 345 |
} |
| 346 |
|
| 347 |
assert_se(l = set_get_strv(paths)); |
| 348 |
strv_sort(l); |
| 349 |
|
| 350 |
assert_se(strv_extend(&expected, "/") >= 0); |
| 351 |
assert_se(strv_extend(&expected, "/org") >= 0); |
| 352 |
assert_se(strv_extend(&expected, "/org/freedesktop") >= 0); |
| 353 |
assert_se(strv_extend(&expected, "/org/freedesktop/LogControl1") >= 0); |
| 354 |
assert_se(strv_extend(&expected, "/org/freedesktop/network1") >= 0); |
| 355 |
assert_se(strv_extend(&expected, "/org/freedesktop/network1/network") >= 0); |
| 356 |
for (unsigned i = 0; i <= 20; i++) { |
| 357 |
assert_se(strv_extendf(&expected, "/org/freedesktop/network1/network/%u", i) >= 0); |
| 358 |
assert_se(strv_extendf(&expected, "/org/freedesktop/network1/network/%u/hoge", i) >= 0); |
| 359 |
} |
| 360 |
|
| 361 |
strv_sort(expected); |
| 362 |
assert_se(strv_equal(l, expected)); |
| 363 |
} |
| 364 |
|
| 365 |
DEFINE_TEST_MAIN(LOG_DEBUG); |