test-bus-address: silence gcc warning about NULL arg to strcmp()
The code was overly complicated… We know what value we expect, we can test it directly.
This commit is contained in:
@@ -15,11 +15,9 @@ static void test_one_address(sd_bus *b,
|
||||
|
||||
r = bus_set_address_system_remote(b, host);
|
||||
log_info("\"%s\" → %d, \"%s\"", host, r, strna(r >= 0 ? b->address : NULL));
|
||||
if (result < 0 || expected) {
|
||||
assert_se(r == result);
|
||||
if (r >= 0)
|
||||
assert_se(streq(b->address, expected));
|
||||
}
|
||||
assert_se(r == result);
|
||||
if (r >= 0)
|
||||
assert_se(streq_ptr(b->address, expected));
|
||||
}
|
||||
|
||||
TEST(bus_set_address_system_remote) {
|
||||
@@ -38,8 +36,8 @@ TEST(bus_set_address_system_remote) {
|
||||
0, "unixexec:path=ssh,argv1=-xT,argv2=-p,argv3=123,argv4=--,argv5=host,argv6=systemd-stdio-bridge");
|
||||
test_one_address(b, "host:123:123",
|
||||
-EINVAL, NULL);
|
||||
test_one_address(b, "host:",
|
||||
-EINVAL, NULL);
|
||||
test_one_address(b, "host:",
|
||||
-EINVAL, NULL);
|
||||
test_one_address(b, "user@host",
|
||||
0, "unixexec:path=ssh,argv1=-xT,argv2=--,argv3=user%40host,argv4=systemd-stdio-bridge");
|
||||
test_one_address(b, "user@host@host",
|
||||
|
||||
Reference in New Issue
Block a user