+ uint32_t this_wait= 0;
+ bool pinged= false;
+ {
+ uint32_t timeout= 20; // This number should be high enough for valgrind startup (which is slow)
+ uint32_t waited;
+ 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)
+ {
+ // If we happen to have a pid file, lets try to kill it
+ if ((pid_file().empty() == false) and (access(pid_file().c_str(), R_OK) == 0))
+ {
+ _app.slurp();
+ if (kill_file(pid_file()) == false)
+ {
+ throw libtest::fatal(LIBYATL_DEFAULT_PARAM,
+ "Failed to kill off server, waited: %u after startup occurred, when pinging failed: %s stderr:%s",
+ this_wait,
+ pid_file().c_str(),
+ _app.stderr_c_str());
+ }
+
+ throw libtest::fatal(LIBYATL_DEFAULT_PARAM,
+ "Failed native ping(), pid: %d is alive: %s waited: %u server started, having pid_file. exec: %s stderr:%s",
+ int(_app.pid()),
+ _app.check() ? "true" : "false",
+ this_wait, _running.c_str(),
+ _app.stderr_c_str());
+ }
+ else
+ {
+ throw libtest::fatal(LIBYATL_DEFAULT_PARAM,
+ "Failed native ping(), pid: %d is alive: %s waited: %u server started. exec: %s stderr:%s",
+ int(_app.pid()),
+ _app.check() ? "true" : "false",
+ this_wait,
+ _running.c_str(),
+ _app.stderr_c_str());
+ }
+ _running.clear();
+ return false;
+ }