# # # add_dir "tests/automate_stdio_options" # # add_file "tests/automate_stdio_options/__driver__.lua" # content [9f9b0600a85959c0eb66344ace1d2ce3c5f5f3be] # # patch "cmd_automate.cc" # from [eaa1ad0948253c507dfafc1521b8885260ba2db6] # to [0b63953c09694c3609c5ebe1b4ff93d6ef3d2df4] # # patch "option.hh" # from [ca74ed997995c5adee202ccf474d9ef487dfefea] # to [5c956e9f2279ea87311cece08f00c568da8b6be9] # # patch "tests/automate_stdio/__driver__.lua" # from [940095b06b3f41a3aa9afca31c9e81c1d42740cc] # to [9c50b741496b9bcb989ffb813eec19ef5827dcd6] # # patch "testsuite.lua" # from [5713f9212291993481ce79023388ae64adf5988a] # to [d101fb0922ad9a24877a4bf3636466738bf782e9] # ============================================================ --- tests/automate_stdio_options/__driver__.lua 9f9b0600a85959c0eb66344ace1d2ce3c5f5f3be +++ tests/automate_stdio_options/__driver__.lua 9f9b0600a85959c0eb66344ace1d2ce3c5f5f3be @@ -0,0 +1,26 @@ +mtn_setup() + +function parse_stdio(dat, which) + local got = {} + while true do + local b,e,n,s = string.find(dat, "(%d+):%d+:[lm]:(%d+):") + if b == nil then break end + n = n + 0 + if got[n] == nil then got[n] = "" end + got[n] = got[n] .. string.sub(dat, e+1, e+s) + dat = string.sub(dat, e+1+s) + end + if got[which] == nil then got[which] = "" end + L("output of command ", which, ":\n") + L(got[which]) + return got[which] +end + +addfile("file", "contents") +commit("testbranch") +writefile("file", "modified") + +diffcmd = "o1:r12:h:testbranche l12:content_diffe" +check(mtn("automate", "stdio"), 0, true, false, string.rep(diffcmd, 2)) +dat = readfile("stdout") +check(parse_stdio(dat, 0) == parse_stdio(dat, 1)) ============================================================ --- cmd_automate.cc eaa1ad0948253c507dfafc1521b8885260ba2db6 +++ cmd_automate.cc 0b63953c09694c3609c5ebe1b4ff93d6ef3d2df4 @@ -349,7 +349,11 @@ AUTOMATE(stdio, "", options::opts::autom } try { - options::options_type opts = options::opts::globals(); + options::options_type opts; + opts = options::opts::all_options() - options::opts::globals(); + opts.instantiate(&app.opts).reset(); + + opts = options::opts::globals(); opts = opts | find_automation(cmd, help_name).options; opts.instantiate(&app.opts).from_key_value_pairs(params); automate_command(cmd, args, help_name, app, os); ============================================================ --- option.hh ca74ed997995c5adee202ccf474d9ef487dfefea +++ option.hh 5c956e9f2279ea87311cece08f00c568da8b6be9 @@ -272,6 +272,15 @@ namespace option { std::inserter(combined.options, combined.options.begin())); return combined; } + option_set operator - (option_set const & other) const + { + option_set combined; + std::set_difference(options.begin(), options.end(), + other.options.begin(), other.options.end(), + std::inserter(combined.options, + combined.options.begin())); + return combined; + } bool empty() const {return options.empty();} }; template ============================================================ --- tests/automate_stdio/__driver__.lua 940095b06b3f41a3aa9afca31c9e81c1d42740cc +++ tests/automate_stdio/__driver__.lua 9c50b741496b9bcb989ffb813eec19ef5827dcd6 @@ -8,6 +8,8 @@ check(mtn("automate", "stdio"), 1, false check(mtn("automate", "stdio"), 1, false, false, "xl6:leavese") check(mtn("automate", "stdio"), 1, false, false, "o3:key0:exl6:leavese") check(mtn("automate", "stdio"), 1, false, false, "o3:ke0:el6:leavese") + +-- invalid ('leaves' doesn't take --author) check(mtn("automate", "stdio"), 1, false, false, "o6:author3:fooe l6:leavese") -- not broken ============================================================ --- testsuite.lua 5713f9212291993481ce79023388ae64adf5988a +++ testsuite.lua d101fb0922ad9a24877a4bf3636466738bf782e9 @@ -689,3 +689,4 @@ table.insert(tests, "netsync_hook_errcod table.insert(tests, "add_ignored") table.insert(tests, "automate_content_diff") table.insert(tests, "netsync_hook_errcodes") +table.insert(tests, "automate_stdio_options")