anchor.diff:  -define(DAEMON_CAN_REBOOT, "os_daemon_can_reboot.sh").
   -define(DAEMON_DIE_ON_BOOT, "os_daemon_die_on_boot.sh").
   -define(DAEMON_DIE_QUICKLY, "os_daemon_die_quickly.sh").
  --define(DELAY, 100).
  +-define(TRIES, 20).
  +-define(TRY_DELAY_MS, 100).
   -define(TIMEOUT, 1000).
   
   
  
positive.code:     % Set configuration option to be used by configuration_reader_test_
      % This will be used in os_daemon_configer.escript:test_get_cfg2
      config:set("uuids", "algorithm","sequential", false),
      timer:sleep(?DELAY),  % sleep a bit to let daemon set kill flag
      {Ctx, OsDPid}.
  
  teardown(_, {Ctx, OsDPid}) ->
  
negative.code:     ?assertEqual(halted, D#daemon.status),
      ?assertEqual(nil, D#daemon.errors),
      ?assertEqual(nil, D#daemon.buf).
  
  daemons() ->
      {ok, Daemons} = couch_os_daemons:info([table]),
      Daemons.
  
  ensure_n_daemons_are_alive(NumDaemons) ->
      retry(fun() -> length(daemons()) == NumDaemons end, "spawning"),
      retry(fun() ->
                    lists:all(fun(D) -> D#daemon.kill =/= undefined end, daemons())
            end, "waiting for kill flag").
  
  retry(Pred, FailReason) ->
      retry(Pred, ?TRIES, FailReason).
  
  retry(_Pred, 0, FailReason) ->
      erlang:error({assertion_failed,[{module, ?MODULE}, {line, ?LINE},
                                      {reason, "Timed out: " ++ FailReason}]});
  retry(Pred, N, FailReason) ->
      case Pred() of
          true ->
              ok;
          false ->
              timer:sleep(?TRY_DELAY_MS),
              retry(Pred, N - 1, FailReason)
      end.
  