diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-02-14 07:08:20 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-02-14 07:09:37 +0100 |
commit | 119c00c1fa8abaa532c055b67493b6d8d7cefcde (patch) | |
tree | a3a72145096f45e1e488b5aacdbfbfac2ae6fb35 /src/libsystemd-network | |
parent | test-dhcp6-client: cleanups (diff) | |
download | systemd-119c00c1fa8abaa532c055b67493b6d8d7cefcde.tar.xz systemd-119c00c1fa8abaa532c055b67493b6d8d7cefcde.zip |
test-dhcp6-client: add test for rapid commit
Diffstat (limited to 'src/libsystemd-network')
-rw-r--r-- | src/libsystemd-network/test-dhcp6-client.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/libsystemd-network/test-dhcp6-client.c b/src/libsystemd-network/test-dhcp6-client.c index 5aa7ebb977..3b25df7625 100644 --- a/src/libsystemd-network/test-dhcp6-client.c +++ b/src/libsystemd-network/test-dhcp6-client.c @@ -886,7 +886,21 @@ static void test_client_callback(sd_dhcp6_client *client, int event, void *userd test_lease_managed(client); - assert_se(sd_event_exit(sd_dhcp6_client_get_event(client), 0) >= 0); + switch (test_client_sent_message_count) { + case 3: + assert_se(sd_dhcp6_client_stop(client) >= 0); + assert_se(sd_dhcp6_client_start(client) >= 0); + assert_se(dhcp6_client_set_transaction_id(client, ((const DHCP6Message*) msg_reply)->transaction_id) >= 0); + break; + + case 4: + assert_se(sd_event_exit(sd_dhcp6_client_get_event(client), 0) >= 0); + break; + + default: + assert_not_reached(); + } + break; case DHCP6_CLIENT_EVENT_TEST_ADVERTISED: { @@ -936,6 +950,11 @@ int dhcp6_network_send_udp_socket(int s, struct in6_addr *a, const void *packet, assert_se(write(test_fd[1], msg_reply, sizeof(msg_reply)) == sizeof(msg_reply)); break; + case 3: + test_client_verify_solicit(packet, len); + assert_se(write(test_fd[1], msg_reply, sizeof(msg_reply)) == sizeof(msg_reply)); + break; + default: assert_not_reached(); } @@ -983,7 +1002,7 @@ static void test_dhcp6_client(void) { assert_se(sd_event_loop(e) >= 0); - assert_se(test_client_sent_message_count == 3); + assert_se(test_client_sent_message_count == 4); test_fd[1] = safe_close(test_fd[1]); } |