#######################################################
#
# Test autorun
#
#######################################################
body common control
{
  inputs => { '../default.sub.cf' };
  bundlesequence => { default("$(this.promise_filename)") };
  version => "1.0";
}

bundle agent init
{
  commands:
    "$(G.make) install DESTDIR=$(G.testdir)"
      contain => in_dir_shell("$(this.promise_dirname)/../../..");

  vars:
    # If masterfiles are installed with --prefix=/other/prefix then we
    # need to figure out where did "make install DESTDIR=..." has put
    # the files.
    "promises_cf_slist" slist => findfiles("$(G.testdir)/**/promises.cf");
    "promises_cf_path" string => nth(promises_cf_slist, 0);
}

#######################################################
bundle agent check
{
  methods:
    ""
      usebundle => dcs_passif_output(
        ".*R: hello_world_autorun: Hello, this is an automatically loaded bundle.*",
        "",
        "$(sys.cf_agent) -Dservices_autorun -v -f $(init.promises_cf_path) | $(G.grep) Hello",
        $(this.promise_filename)
      );
}
