Address issue while waiting for host to be up and PMTUd first run.
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
/*
* wait for PMTUd to pick up the change
*/
- sleep(1);
+ test_sleep(knet_h, 1);
flush_logs(logfds[0], stdout);
if (knet_h->data_mtu != data_mtu - 64) {
/*
* wait for PMTUd to pick up the change
*/
- sleep(2);
+ test_sleep(knet_h, 1);
flush_logs(logfds[0], stdout);
if (knet_h->data_mtu != data_mtu) {
- printf("knet_handle_pmtud_set failed to redetect MTU\n");
+ printf("knet_handle_pmtud_set failed to redetect MTU: detected mtu: %u data_mtu: %u \n", knet_h->data_mtu, data_mtu);
knet_link_set_enable(knet_h, 1, 0, 0);
knet_link_clear_config(knet_h, 1, 0);
knet_host_remove(knet_h, 1);
}
printf("Wait 2 seconds for sockets to connect\n");
- sleep(2);
+ test_sleep(knet_h, 2);
printf("Test knet_link_set_enable with correct values (0)\n");
return _make_local_sockaddr(lo, offset, AF_INET6);
}
+void test_sleep(knet_handle_t knet_h, int seconds)
+{
+ if (is_memcheck() || is_helgrind()) {
+ printf("Test suite is running under valgrind, adjusting sleep timers\n");
+ seconds = seconds * 16;
+ }
+ sleep(seconds);
+}
+
int wait_for_host(knet_handle_t knet_h, uint16_t host_id, int seconds, int logfd, FILE *std)
{
int i = 0;
while (i < seconds) {
flush_logs(logfd, std);
if (knet_h->host_index[host_id]->status.reachable == 1) {
+ printf("Waiting for host to settle\n");
+ test_sleep(knet_h, 1);
return 0;
}
printf("waiting host %u to be reachable for %d more seconds\n", host_id, seconds - i);
int make_local_sockaddr6(struct sockaddr_storage *lo, uint16_t offset);
int wait_for_host(knet_handle_t knet_h, uint16_t host_id, int seconds, int logfd, FILE *std);
int wait_for_packet(knet_handle_t knet_h, int seconds, int datafd, int logfd, FILE *std);
+void test_sleep(knet_handle_t knet_h, int seconds);
#endif