# # # patch "lua-testsuite.lua" # from [f023bf17b18eda1376750b8d1f3a40811f2fe0c8] # to [c98d0f88f3df3e7d57fba9d425d9b2d93b1ebb11] # # patch "tests/(minor)_add_own_db/__driver__.lua" # from [2efcf1ebd1c8317d96e361364438a3d8ad9953c2] # to [f782c45b6b924b7128004c984b6a657c1bb1993c] # # patch "tests/(normal)_netsync_on_partially_unrelated_revisions/__driver__.lua" # from [79d37ed87fa40ba7e6e4a00fd5662b45dbaf3531] # to [47e8f2683970556e169fc5f3fb80a37b145f3aaa] # # patch "tests/_--rcfile=directory/__driver__.lua" # from [cbe466d9d4fc5a49f409a31be656870605971507] # to [8911fae1f683a5b436670bdbf63b062f103a9ff9] # # patch "tests/_MTN_case-folding_security_patch/__driver__.lua" # from [2ed48a126f4f597050edc0ae0d3dea6ab264327b] # to [c35abefdaa940ef01e5e509c3bf521f7571ea018] # # patch "tests/add_workspace_commit_in_another/__driver__.lua" # from [ebfd8941dd988f6cb963cfbdb9a75ad53da55eb4] # to [99b4728d41d30abf0864899da0c418cb11308129] # # patch "tests/annotate_file_on_multirooted_branch/__driver__.lua" # from [90cd04a3e4a132b410a7d52915963376c5636f16] # to [f74b459e361bd32496cae9d030fd35939a4e9f14] # # patch "tests/automate_keys/__driver__.lua" # from [42ad71325d1df9437aa6623996367bbeaa28fe93] # to [bc91d33865b7f41e38bf754201aa0ff32ffe0261] # ============================================================ --- lua-testsuite.lua f023bf17b18eda1376750b8d1f3a40811f2fe0c8 +++ lua-testsuite.lua c98d0f88f3df3e7d57fba9d425d9b2d93b1ebb11 @@ -1,10 +1,12 @@ monotone_path = nil #!./tester monotone_path = nil -testsuite_use_ws = false --- If true, get as many options as possible from the workspace --- _MTN/options; don't specify on command line +-- The following set of functions return command lines for running +-- monotone. The "_no_ws" variants are for use when no workspace is +-- setup; they specify all options on the command line. The other +-- variants get as many options as possible from the workspace +-- _MTN/options function safe_mtn(...) if monotone_path == nil then @@ -14,13 +16,20 @@ function safe_mtn(...) end end - if testsuite_use_ws then - -- FIXME: need to store confdir in _MTN/options - return {monotone_path, "--ssh-sign=no", "--norc", unpack(arg)} - else - return {monotone_path, "--ssh-sign=no", "--norc", "--root=" .. test.root, + -- FIXME: need to store confdir in _MTN/options + return {monotone_path, "--ssh-sign=no", "--norc", unpack(arg)} +end + +function safe_mtn_no_ws(...) + if monotone_path == nil then + monotone_path = os.getenv("mtn") + if monotone_path == nil then + err("'mtn' environment variable not set") + end + end + + return {monotone_path, "--ssh-sign=no", "--norc", "--root=" .. test.root, "--confdir="..test.root, unpack(arg)} - end end -- function preexecute(x) @@ -35,18 +44,26 @@ end end end -function mtn(...) - if testsuite_use_ws then - return raw_mtn ("--rcfile", test.root .. "/test_hooks.lua", unpack(arg)) +function raw_mtn_no_ws(...) + if preexecute ~= nil then + return preexecute(safe_mtn_no_ws(unpack(arg))) else - return raw_mtn("--rcfile", - test.root .. "/test_hooks.lua", - "--db=" .. test.root .. "/test.db", - "--keydir", test.root .. "/keys", - "address@hidden", unpack(arg)) + return safe_mtn_no_ws(unpack(arg)) end end +function mtn(...) + return raw_mtn ("--rcfile", test.root .. "/test_hooks.lua", unpack(arg)) +end + +function mtn_no_ws(...) + return raw_mtn_no_ws("--rcfile", + test.root .. "/test_hooks.lua", + "--db=" .. test.root .. "/test.db", + "--keydir", test.root .. "/keys", + "address@hidden", unpack(arg)) +end + function nodb_mtn(...) return raw_mtn("--rcfile", test.root .. "/test_hooks.lua", -- "--nostd", "--keydir", test.root .. "/keys", @@ -93,11 +110,9 @@ function mtn_setup() check(getstd("test_hooks.lua")) check(getstd("min_hooks.lua")) - testsuite_use_ws = false - check(mtn("db", "init"), 0, false, false) - check(mtn("read", "test_keys"), 0, false, false) - check(mtn("setup", "--branch=testbranch", "."), 0, false, false) - testsuite_use_ws = true + check(mtn_no_ws("db", "init"), 0, false, false) + check(mtn_no_ws("read", "test_keys"), 0, false, false) + check(mtn_no_ws("setup", "--branch=testbranch", "."), 0, false, false) remove("test_keys") end ============================================================ --- tests/(minor)_add_own_db/__driver__.lua 2efcf1ebd1c8317d96e361364438a3d8ad9953c2 +++ tests/(minor)_add_own_db/__driver__.lua f782c45b6b924b7128004c984b6a657c1bb1993c @@ -5,7 +5,7 @@ mtn_setup() -- ...It *really* seems like adding the db to the db is something that should be caught and an error message thrown... -- (What's revert supposed to do when you revert the db? :-) -- ... --- and add a note in a comment that "revert" is the case that really moves this +-- and add a note in a comment that "revert" is the case that really moves this -- from being "stupid user tricks" to "something we should protect users from" :-) check(mtn("add", "test.db"), 0, false, false) check(mtn("ls", "known"), 0, true, false) @@ -23,6 +23,7 @@ check(not qgrep("'subdir/test.db'", "std check(not qgrep("'subdir/test.db'", "stdout")) -- If it's not an in-use DB, it should work, though -check(mtn("add", "subdir/test.db"), 0, false, false) -check(mtn("ls", "known"), 0, true, false) +-- The last "add" changed _MTN/options database to subdir/test.db +check(mtn("--db=test.db", "add", "subdir/test.db"), 0, false, false) +check(mtn("--db=test.db", "ls", "known"), 0, true, false) check(qgrep("subdir/test.db", "stdout")) ============================================================ --- tests/(normal)_netsync_on_partially_unrelated_revisions/__driver__.lua 79d37ed87fa40ba7e6e4a00fd5662b45dbaf3531 +++ tests/(normal)_netsync_on_partially_unrelated_revisions/__driver__.lua 47e8f2683970556e169fc5f3fb80a37b145f3aaa @@ -31,7 +31,7 @@ remove("_MTN") end remove("_MTN") -check(mtn("setup", "--branch=testbranch", "."), 0, false, false) +check(mtn_no_ws("setup", "--branch=testbranch", "."), 0, false, false) addfile("testfile2", "This is test file 2") commit("testbranch") ============================================================ --- tests/_--rcfile=directory/__driver__.lua cbe466d9d4fc5a49f409a31be656870605971507 +++ tests/_--rcfile=directory/__driver__.lua 8911fae1f683a5b436670bdbf63b062f103a9ff9 @@ -8,7 +8,7 @@ check(get("bbb.rc", "gongolo/bbb.rc")) check(get("bbb.rc", "gongolo/bbb.rc")) -- note: rcfile is placed outside workdir -check(mtn("setup", "--branch=testbranch", "alt_wrk"), 0, false, false) +check(mtn_no_ws("setup", "--branch=testbranch", "alt_wrk"), 0, false, false) check(indir("alt_wrk", mtn("--root=.", "--rcfile=../gongolo", "status")), 0, true, false) check(qgrep("BOOGA BOOGACICCA CICCA", "stdout")) ============================================================ --- tests/_MTN_case-folding_security_patch/__driver__.lua 2ed48a126f4f597050edc0ae0d3dea6ab264327b +++ tests/_MTN_case-folding_security_patch/__driver__.lua c35abefdaa940ef01e5e509c3bf521f7571ea018 @@ -19,7 +19,7 @@ for _,i in pairs(names) do remove(i) end for _,i in pairs(names) do remove(i) end -- run setup again, because we've removed our bookkeeping dir. -check(mtn("--branch=testbranch", "setup", ".")) +check(mtn_no_ws("--branch=testbranch", "setup", ".")) -- files in bookkeeping dirs are also ignored by add -- (mkdir -p used because the directories already exist on case-folding FSes) @@ -39,7 +39,7 @@ remove("_MTN") -- just to make sure, check that it's not only add that fails, if it somehow -- sneaks into an internal format then that fails too remove("_MTN") -check(mtn("--branch=testbranch", "setup", ".")) +check(mtn_no_ws("--branch=testbranch", "setup", ".")) mkdir("_mTn") writefile("_MTN/revision", 'format_version "1"\n' ============================================================ --- tests/add_workspace_commit_in_another/__driver__.lua ebfd8941dd988f6cb963cfbdb9a75ad53da55eb4 +++ tests/add_workspace_commit_in_another/__driver__.lua 99b4728d41d30abf0864899da0c418cb11308129 @@ -16,7 +16,7 @@ copy("initial", "alicewd/initial") -- Alice does her add mkdir("alicewd") copy("initial", "alicewd/initial") -check(mtn("--branch=testbranch", "setup", "alicewd"), 0, false, false) +check(mtn_no_ws("--branch=testbranch", "setup", "alicewd"), 0, false, false) check(indir("alicewd", mtn("--root=.", "add", "initial")), 0, false, false) check(indir("alicewd", mtn("--root=.", "commit", "-m", 'initial commit')), 0, false, false) copy("foo.alice", "alicewd/foo") ============================================================ --- tests/annotate_file_on_multirooted_branch/__driver__.lua 90cd04a3e4a132b410a7d52915963376c5636f16 +++ tests/annotate_file_on_multirooted_branch/__driver__.lua f74b459e361bd32496cae9d030fd35939a4e9f14 @@ -20,7 +20,7 @@ remove("_MTN") remove("foo") remove("_MTN") -check(mtn("setup", "--branch=testbranch", ".")) +check(mtn_no_ws("setup", "--branch=testbranch", ".")) copy("foo.right", "foo") check(mtn("add", "foo"), 0, false, false) ============================================================ --- tests/automate_keys/__driver__.lua 42ad71325d1df9437aa6623996367bbeaa28fe93 +++ tests/automate_keys/__driver__.lua bc91d33865b7f41e38bf754201aa0ff32ffe0261 @@ -7,14 +7,14 @@ remove("_MTN/options") check(nodb_mtn("genkey", "address@hidden"), 0, false, false, string.rep("address@hidden", 2)) remove("_MTN/options") -check(mtn("genkey", "address@hidden"), +check(mtn_no_ws("genkey", "address@hidden"), 0, false, false, string.rep("address@hidden", 2)) remove("_MTN/options") check(nodb_mtn("dropkey", "address@hidden"), 0, false, false) -- we now have address@hidden in the keystore, address@hidden in both keystore --- and database, and address@hidden in only the database -check(mtn("automate", "keys"), 0, true, false) +-- and database, and address@hidden in only the database, and no _MTN/options +check(mtn_no_ws("automate", "keys"), 0, true, false) parsed = parse_basic_io(readfile("stdout")) locs = {} for _,line in pairs(parsed) do