diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-05-12 13:58:06 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-05-14 02:18:29 +0200 |
commit | 170e88c8e3f321590688e4cd68e829ef6abe7101 (patch) | |
tree | 1afa65bbb7cefa398a532820f0e6ae6cb1c1613a /src/network/test-network.c | |
parent | run: update checks to allow running with a user's bus (diff) | |
download | systemd-170e88c8e3f321590688e4cd68e829ef6abe7101.tar.xz systemd-170e88c8e3f321590688e4cd68e829ef6abe7101.zip |
network: move and rename network_get() -> link_get_network()
This also drops test_network_get(). But it tests almost nothing. So, it
should be ok to not re-implement something like test_link_get_network().
Diffstat (limited to 'src/network/test-network.c')
-rw-r--r-- | src/network/test-network.c | 32 |
1 files changed, 4 insertions, 28 deletions
diff --git a/src/network/test-network.c b/src/network/test-network.c index 25ff3a33a8..09e7b99d23 100644 --- a/src/network/test-network.c +++ b/src/network/test-network.c @@ -168,23 +168,6 @@ static int test_load_config(Manager *manager) { return 0; } -static void test_network_get(Manager *manager, sd_device *loopback) { - Network *network; - const struct ether_addr mac = ETHER_ADDR_NULL; - int r; - - /* Let's hope that the test machine does not have a .network file that applies to loopback deviceā¦ - * But it is still possible, so let's allow that case too. */ - r = network_get(manager, 0, loopback, "lo", NULL, NULL, &mac, &mac, 0, NULL, NULL, &network); - if (r == -ENOENT) - /* The expected case */ - assert_se(!network); - else if (r >= 0) - assert_se(network); - else - assert_not_reached("bad error!"); -} - static void test_address_equality(void) { _cleanup_(address_freep) Address *a1 = NULL, *a2 = NULL; @@ -277,8 +260,7 @@ static void test_dhcp_hostname_shorten_overlong(void) { int main(void) { _cleanup_(manager_freep) Manager *manager = NULL; - _cleanup_(sd_device_unrefp) sd_device *loopback = NULL; - int ifindex, r; + int r; test_setup_logging(LOG_INFO); @@ -293,15 +275,9 @@ int main(void) { r = test_load_config(manager); if (r == -EPERM) - return log_tests_skipped("Cannot load configuration"); - assert_se(r == 0); - - assert_se(sd_device_new_from_syspath(&loopback, "/sys/class/net/lo") >= 0); - assert_se(loopback); - assert_se(sd_device_get_ifindex(loopback, &ifindex) >= 0); - assert_se(ifindex == 1); - - test_network_get(manager, loopback); + log_debug("Cannot load configuration, ignoring."); + else + assert_se(r == 0); assert_se(manager_enumerate(manager) >= 0); return 0; |