# # # patch "tests/automate_cert/__driver__.lua" # from [a7f8e71581aa02eb61dcde8d6030eaa2a91aca8f] # to [b9ef3b6aafc09dfb5e296e77d5ca328af543e23c] # # patch "tests/automate_get_options/__driver__.lua" # from [441807940397c9106b117ba8ce6caf273e0b7f1c] # to [247e680108f7d2599fbf0e42367f4cc917e73088] # # patch "tests/automate_heads/__driver__.lua" # from [3e517ef05655a049ac5c0c121942e1e66cc1e209] # to [44b8a91cf2958045046831ee4ff88ba7244ea946] # # patch "tests/automate_identify/__driver__.lua" # from [88f42966d628b429faff486d1001cb517476ebef] # to [8ba0b019d5546dd59e200c9e12746c2ad7ad7265] # # patch "tests/automate_inventory_options/__driver__.lua" # from [a5b9f432caf66ce4e5de60641dc8c018b54bf0c1] # to [f2bbe3b9ec462bc791f29419b1f88052bf6199d6] # # patch "tests/automate_keys/__driver__.lua" # from [3d44236eaf86f1f3b036724389defcca1d6a3d71] # to [a8231081a0e1f0ba0ca2aac057786917c99e6293] # # patch "tests/automate_show_conflicts_defaults/__driver__.lua" # from [e89d6a7bdb7752205b89c8ac32d112030b254e48] # to [69dc55a68ddeced4a661699654e15b257679e619] # # patch "tests/common/automate_stdio.lua" # from [c8d9c642ad1dc0ad3e96672003a76ef7e9534162] # to [93137f013518e42b6f856a103aee16241ac4f4d4] # ============================================================ --- tests/automate_cert/__driver__.lua a7f8e71581aa02eb61dcde8d6030eaa2a91aca8f +++ tests/automate_cert/__driver__.lua b9ef3b6aafc09dfb5e296e77d5ca328af543e23c @@ -1,3 +1,5 @@ +include("common/automate_stdio.lua") + mtn_setup() revs = {} @@ -20,8 +22,7 @@ check(mtn_ws_opts("automate", "stdio"), -- check that 'cert' gets keydir from workspace options when run via stdio check(mtn_ws_opts("automate", "stdio"), 0, true, true, "l4:cert40:" .. base .. "9:testcert23:fooe") -check("0:0:l:0:" == readfile("stdout")) -check(samefile("empty", "stderr")) +check(parse_stdio(readfile("stdout"), 0) == "") -- check edge cases: -- wrong number of arguments: ============================================================ --- tests/automate_get_options/__driver__.lua 441807940397c9106b117ba8ce6caf273e0b7f1c +++ tests/automate_get_options/__driver__.lua 247e680108f7d2599fbf0e42367f4cc917e73088 @@ -1,4 +1,6 @@ +include("common/automate_stdio.lua") + mtn_setup() -- We don't check options with paths in them; on Windows, sometimes @@ -14,7 +16,6 @@ check(mtn_ws_opts("automate", "stdio"), -- Ensure that 'get_options' gets the workspace options even when run via stdio check(mtn_ws_opts("automate", "stdio"), 0, true, false, "l10:get_option6:branche") -canonicalize("stdout") -check("0:0:l:11:testbranch\n" == readfile("stdout")) +check("testbranch\n" == parse_stdio(readfile("stdout"), 0)) -- end of file ============================================================ --- tests/automate_heads/__driver__.lua 3e517ef05655a049ac5c0c121942e1e66cc1e209 +++ tests/automate_heads/__driver__.lua 44b8a91cf2958045046831ee4ff88ba7244ea946 @@ -1,4 +1,6 @@ +include("common/automate_stdio.lua") + mtn_setup() revs = {} @@ -28,8 +30,6 @@ check(samefile("empty", "stdout")) -- In mtn 0.40 and earlier, this was broken, because automate stdio -- did not re-read the workspace options for each command, so the -- branch was null. -check(mtn("automate", "stdio"), 0, true, false, "l5:headse") -canonicalize("stdout") -check(("0:0:l:164:" .. readfile("wanted_heads")) == readfile("stdout")) +check(run_stdio("l5:headse", 0) == readfile("wanted_heads")) -- end of file ============================================================ --- tests/automate_identify/__driver__.lua 88f42966d628b429faff486d1001cb517476ebef +++ tests/automate_identify/__driver__.lua 8ba0b019d5546dd59e200c9e12746c2ad7ad7265 @@ -1,3 +1,4 @@ +include("common/automate_stdio.lua") mtn_setup() @@ -19,7 +20,5 @@ check(samelines("stdout", { testfile_id check(samelines("stdout", { testfile_id })); -- ensure that it also gets properly encoded via stdio -check(mtn("automate", "stdio"), 0, true, false, "l8:identify8:testfilee") -canonicalize("stdout") -check(samelines("stdout", { "0:0:l:41:" .. testfile_id })) +check(run_stdio("l8:identify8:testfilee", 0) == testfile_id .. "\n") ============================================================ --- tests/automate_inventory_options/__driver__.lua a5b9f432caf66ce4e5de60641dc8c018b54bf0c1 +++ tests/automate_inventory_options/__driver__.lua f2bbe3b9ec462bc791f29419b1f88052bf6199d6 @@ -3,6 +3,8 @@ -- -- We don't test with --bookkeep-only, because we haven't gotten to it yet. +include("common/automate_stdio.lua") + mtn_setup() -- override standard test_hooks.lua, because 'automate stdio' uses it. @@ -60,9 +62,8 @@ check(readfile("expected-no-ignored.stdo check(readfile("expected-no-ignored.stdout") == readfile("stdout")) -- make sure 'automate stdio' handles at least one of the inventory options as well -check(mtn("automate", "stdio"), 0, true, false, "o10:no-ignored0:e l9:inventory6:sourcee") -canonicalize("stdout") -check(("0:0:l:1149:" .. readfile("expected-no-ignored.stdout")) == readfile("stdout")) +local invout = run_stdio("o10:no-ignored0:e l9:inventory6:sourcee", 0) +check(readfile("expected-no-ignored.stdout") == invout) -- -- now check --no-corresponding-renames ============================================================ --- tests/automate_keys/__driver__.lua 3d44236eaf86f1f3b036724389defcca1d6a3d71 +++ tests/automate_keys/__driver__.lua a8231081a0e1f0ba0ca2aac057786917c99e6293 @@ -1,3 +1,4 @@ +include("common/automate_stdio.lua") mtn_setup() @@ -51,6 +52,7 @@ check(mtn_ws_opts("automate", "stdio"), -- Ensure that 'keys' gets the keydir from workspace options even when -- run via stdio check(mtn_ws_opts("automate", "stdio"), 0, true, false, "l4:keyse") -check_keys(string.sub (readfile("stdout"), 12)) +local keys = parse_stdio(readfile("stdout"), 0) +check_keys(keys) -- end of file ============================================================ --- tests/automate_show_conflicts_defaults/__driver__.lua e89d6a7bdb7752205b89c8ac32d112030b254e48 +++ tests/automate_show_conflicts_defaults/__driver__.lua 69dc55a68ddeced4a661699654e15b257679e619 @@ -2,8 +2,10 @@ -- -- See automate_show_conflicts for all conflict cases +include("common/test_utils_inventory.lua") +include("common/automate_stdio.lua") + mtn_setup() -include ("common/test_utils_inventory.lua") -- Get a non-empty base revision, then create three heads addfile("randomfile", "blah blah blah") @@ -53,8 +55,8 @@ check_basic_io_line (3, parsed[3], "ance -- In mtn 0.40 and earlier, this was broken, because automate stdio -- did not re-read the workspace options for each command, so the -- branch was null. -check(mtn("automate", "stdio"), 0, true, false, "l14:show_conflictse") -parsed = parse_basic_io(string.sub (readfile("stdout"), 11)) +local showconfout = run_stdio("l14:show_conflictse", 0) +parsed = parse_basic_io(showconfout) check_basic_io_line (1, parsed[1], "left", beth_1) check_basic_io_line (2, parsed[2], "right", chuck_1) check_basic_io_line (3, parsed[3], "ancestor", base_2) ============================================================ --- tests/common/automate_stdio.lua c8d9c642ad1dc0ad3e96672003a76ef7e9534162 +++ tests/common/automate_stdio.lua 93137f013518e42b6f856a103aee16241ac4f4d4 @@ -9,6 +9,13 @@ function parse_stdio(data, err, which, b function parse_stdio(data, err, which, band) local bands = {} local errcodes = {} + + local begin,End,headers = string.find(data, "(.-)\n\n"); + -- FIXME: expand this to a proper header parser if + -- more headers are added in the future + check(string.find(headers, "^interface%-version: %d-%.%d$") ~= nil) + data = string.sub(data, End + 1) + while true do local begin,End,cmdnum,bnd,size = string.find(data, "(%d+):(%l):(%d+):") if begin == nil then break end