1#######################################################
2#
3# Test execresult() captures stdout and stderr
4#
5#######################################################
6
7body common control
8{
9      inputs => { "../../default.cf.sub" };
10      bundlesequence  => { default("$(this.promise_filename)") };
11      version => "1.0";
12}
13
14#######################################################
15
16bundle agent test
17{
18  meta:
19      "description" -> { "CFE-3103" }
20        string => "Test that execresult captures both stdout and stderr";
21
22  vars:
23      "result_with_stdout_stderr"
24        string => execresult("$(G.echo) stdout; $(G.echo) stderr >&2", "useshell");
25
26      "result_with_stdout"
27        string => execresult("$(G.echo) stdout", "useshell");
28
29      "result_with_stderr"
30        string => execresult("$(G.echo) stderr >&2", "useshell");
31
32  classes:
33      "pass_stdout_stderr"
34        scope => "namespace",
35        expression => strcmp( "stdout$(const.n)stderr", $(result_with_stdout_stderr) );
36
37      "pass_stdout"
38        scope => "namespace",
39        expression => strcmp( "stdout", $(result_with_stdout) );
40
41      "pass_stderr"
42        scope => "namespace",
43        expression => strcmp( "stderr", $(result_with_stderr) );
44
45  methods:
46      "Pass/Fail"
47        usebundle => dcs_passif("pass_stdout_stderr.pass_stdout.pass_stderr", $(this.promise_filename));
48
49}
50
51bundle agent __main__
52{
53  methods: "test";
54}
55