check_PROGRAMS+= libtest/skiptest
noinst_PROGRAMS+= libtest/skiptest
-libtest_wait_SOURCES= libtest/wait.cc
+libtest_wait_SOURCES=
+libtest_wait_SOURCES+= libtest/wait.cc
+libtest_wait_SOURCES+= libtest/dream.cc
noinst_PROGRAMS+= libtest/wait
libtest_abort_SOURCES= libtest/abort.cc
}
}
- int counter= 0;
bool pinged= false;
- while ((pinged= ping()) == false and
- counter < (is_helgrind() or is_valgrind() ? 20 : 5))
{
- dream(counter++, 50000);
+ uint32_t timeout= 20; // This number should be high enough for valgrind startup (which is slow)
+ uint32_t waited;
+ uint32_t this_wait;
+ uint32_t retry;
+
+ for (waited= 0, retry= 1; ; retry++, waited+= this_wait)
+ {
+ if ((pinged= ping()) == true)
+ {
+ break;
+ }
+ else if (waited >= timeout)
+ {
+ break;
+ }
+
+ this_wait= retry * retry / 3 + 1;
+ libtest::dream(this_wait, 0);
+ }
}
if (pinged == false)
test_skip(true, has_gearmand_binary());
- Error << " " << has_gearmand_binary();
-
test_true(server_startup(*servers, "gearmand", get_free_port(), 0, NULL));
return TEST_SUCCESS;
#include <unistd.h>
#include <string>
+#include <libtest/dream.h>
+
namespace libtest {
class Wait
}
this_wait= retry * retry / 3 + 1;
- sleep(this_wait);
-#ifdef WIN32
- sleep(this_wait);
-#else
- struct timespec global_sleep_value= { this_wait, 0 };
- nanosleep(&global_sleep_value, NULL);
-#endif
+ libtest::dream(this_wait, 0);
}
}