1############################################################################## 2# 3# Redmine #3573: establish message for missing target file with a template 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 init 17{ 18 19} 20 21####################################################### 22 23bundle agent test 24{ 25 vars: 26 any:: 27 # Run subtests. Need to be in verbose mode to see the output. 28 # The full verbose output is too big for variable assignment here. 29 # So extract (grep) only potentially interesting lines. 30 "subout" string => execresult("$(sys.cf_agent) -KI -b run -f $(this.promise_filename).sub 2>&1 | $(G.grep) '/no/such/file'", "useshell"); 31} 32 33 34####################################################### 35 36bundle agent check 37{ 38 vars: 39 "must_have" string => ".*Promised to edit.*but file does not exist.*"; 40 "cant_have" string => ".*no longer access file.*"; 41 42 classes: 43 "ok_1" not => regcmp($(cant_have), "$(test.subout)"); 44 "ok_2" expression => regcmp($(must_have), "$(test.subout)"); 45 46 reports: 47 DEBUG:: 48 "Attempted subtest '$(this.promise_filename).sub'"; 49 "Significant output was '$(test.subout)'."; 50 51 DEBUG.!ok_1:: 52 "failing: can't have pattern '$(cant_have)' in subtest"; 53 54 DEBUG.!ok_2:: 55 "failing: must have pattern '$(must_have)' in subtest"; 56 57 ok_1.ok_2:: 58 "$(this.promise_filename) Pass"; 59 !(ok_1.ok_2):: 60 "$(this.promise_filename) FAIL"; 61} 62