# # # delete "tests/t_at_sign.at" # # delete "tests/t_automate_ancestry_difference.at" # # delete "tests/t_automate_descendents.at" # # delete "tests/t_automate_erase_ancestors.at" # # delete "tests/t_automate_leaves.at" # # delete "tests/t_automate_toposort.at" # # delete "tests/t_checkout_id_sets_branch.at" # # delete "tests/t_commit_log_3.at" # # delete "tests/t_cvsimport_samelog.at" # # delete "tests/t_db_execute.at" # # delete "tests/t_diff_first_rev.at" # # delete "tests/t_final_space.at" # # delete "tests/t_inodeprints.at" # # delete "tests/t_inodeprints_update.at" # # delete "tests/t_log_last_next.at" # # delete "tests/t_ls_known.at" # # delete "tests/t_netsync_largish_file.at" # # delete "tests/t_sql_gunzip.at" # # delete "tests/t_sticky_branch.at" # # add_dir "tests/automate_ancestry_difference" # # add_dir "tests/automate_descendents" # # add_dir "tests/automate_erase_ancestors" # # add_dir "tests/automate_leaves" # # add_dir "tests/automate_toposort" # # add_dir "tests/check_that_--xargs_and_-(at)_behave_correctly" # # add_dir "tests/checkout_without_--branch_sets_branch" # # add_dir "tests/commit_using__MTN_log_and_--message" # # add_dir "tests/common" # # add_dir "tests/db_execute" # # add_dir "tests/diff_in_a_never-committed_project" # # add_dir "tests/files_with_spaces_at_the_end" # # add_dir "tests/importing_CVS_files_with_identical_logs" # # add_dir "tests/inodeprints" # # add_dir "tests/listing_workspace_manifests" # # add_dir "tests/log_--last=N_--next=N" # # add_dir "tests/netsync_largish_file" # # add_dir "tests/sql_function_gunzip_(which_replaced_unpack)" # # add_dir "tests/sticky_branches" # # add_dir "tests/update_updates_inodeprints" # # add_file "tests/automate_ancestry_difference/__driver__.lua" # content [2b18e891d28c87e681cae262a3a31ea336eb4ade] # # add_file "tests/automate_descendents/__driver__.lua" # content [b169f5198dad22ec3e8dfe7127e4d5f26bf39e5d] # # add_file "tests/automate_erase_ancestors/__driver__.lua" # content [6af0ededd123a596151376d854a61caa9612e337] # # add_file "tests/automate_leaves/__driver__.lua" # content [8a6facf49f11334953dee41b0828457ffab4c848] # # add_file "tests/automate_toposort/__driver__.lua" # content [5c2eebd7c32fe5dcc369bfa3cf38ef8e8cbf2113] # # add_file "tests/check_that_--xargs_and_-(at)_behave_correctly/__driver__.lua" # content [81d1c7a8f2c1344bf65b41964dbeb2337c0b1b0b] # # add_file "tests/checkout_without_--branch_sets_branch/__driver__.lua" # content [55205d7fcc2a2c748f7ae9264dee34a0fb2e54e0] # # add_file "tests/commit_using__MTN_log_and_--message/__driver__.lua" # content [110e07dd7fd06bf5141a84c31d573af8af512c2d] # # add_file "tests/commit_using__MTN_log_and_--message/commit_log.lua" # content [09c926209c317efc447dbe6448fe891c2d86e958] # # add_file "tests/common/automate_ancestry.lua" # content [44980fb300dd64a7ef6fb3cf3fd9c9152953b084] # # add_file "tests/db_execute/__driver__.lua" # content [077230cbf8856a312cb59b375e9fccbeaa3534c2] # # add_file "tests/diff_in_a_never-committed_project/__driver__.lua" # content [deec2a101000baabf8cd4c687ab5430ea6f22d49] # # add_file "tests/files_with_spaces_at_the_end/__driver__.lua" # content [685a16e7b9c9f306a6533e83ece1456e78b7e810] # # add_file "tests/importing_CVS_files_with_identical_logs/__driver__.lua" # content [c449f049d81e25cd714aa8214b2f25eab4ef289d] # # add_file "tests/inodeprints/__driver__.lua" # content [dca8be709d7a7336fc4cfa1ef1b89e27bdabe0e1] # # add_file "tests/listing_workspace_manifests/__driver__.lua" # content [4f7b902626cfbb1fc0725b052b28cb1cbb54829f] # # add_file "tests/log_--last=N_--next=N/__driver__.lua" # content [aa76e4f861e6a73a7c8108796dadb017d3335bb1] # # add_file "tests/netsync_largish_file/__driver__.lua" # content [84f89f33bd31f8c1ecf75d199c8c881877a90e3b] # # add_file "tests/sql_function_gunzip_(which_replaced_unpack)/__driver__.lua" # content [a75cf54559b0ba34e8e24a9bf9ef21a92eab7fdc] # # add_file "tests/sticky_branches/__driver__.lua" # content [ed9188c29ff7be00e5ea2b7cde67b17432f8adda] # # add_file "tests/update_updates_inodeprints/__driver__.lua" # content [409d78bbf7e90bbe1b0c4ff995252b67b93545b9] # # patch "tester.lua" # from [2d9160c79827476de8af60abde5c6f7ea0a6f822] # to [c914b3f1af823b09b3891af2bdc67399880f47b3] # # patch "tests/automate_ancestors/__driver__.lua" # from [a37170def6261cd8ae768f8d8cf336f2f416a370] # to [1047d5c87aa3ac11b1dce31e313bd37ad8a1bf80] # # patch "testsuite.at" # from [657b10b3bf7ccaa263cff9617210401fc6a5c4cd] # to [106a1b130cc6ac73d67e440f774b6ef75544f2b2] # # patch "testsuite.lua" # from [3e5cb0ddb4c7e5b49f076e9fbf1d5d3c2a6cb5e9] # to [b83ad5558b02646a6fc3ade53cc0ebd7e4caaf8e] # ============================================================ --- tests/automate_ancestry_difference/__driver__.lua 2b18e891d28c87e681cae262a3a31ea336eb4ade +++ tests/automate_ancestry_difference/__driver__.lua 2b18e891d28c87e681cae262a3a31ea336eb4ade @@ -0,0 +1,33 @@ + +mtn_setup() + +-- A +-- / \ +-- B C +-- |\ +-- D E +-- \/ +-- F +runstdfile("tests/common/automate_ancestry.lua") + +revs = make_graph() + +-- Now do some checks +check(mtn("automate", "ancestry_difference", "c7539264e83c5d6af4c792f079b5d46e9c128665"), 1, false, false) +check(mtn("automate", "ancestry_difference", revs.a, "c7539264e83c5d6af4c792f079b5d46e9c128665"), 1, false, false) + +revmap("ancestry_difference", {revs.a}, {revs.a}) +revmap("ancestry_difference", {revs.a, revs.a}, {}) +revmap("ancestry_difference", {revs.a, revs.b}, {}) +revmap("ancestry_difference", {revs.a, revs.f}, {}) +revmap("ancestry_difference", {revs.f, revs.f}, {}) +revmap("ancestry_difference", {revs.b, revs.a}, {revs.b}) +revmap("ancestry_difference", {revs.b}, {revs.a, revs.b}, false) +revmap("ancestry_difference", {revs.f, revs.d, revs.e}, {revs.f}, false) +revmap("ancestry_difference", {revs.f, revs.e}, {revs.d, revs.f}, false) +revmap("ancestry_difference", {revs.b, revs.f}, {revs.b}) +acdef = {revs.a, revs.c, revs.d, revs.e, revs.f} +acedf = {revs.a, revs.c, revs.e, revs.d, revs.f} +x = pcall(revmap, "ancestry_difference", {revs.f}, acdef, false) +y = pcall(revmap, "ancestry_difference", {revs.f}, acedf, false) +check(x or y) ============================================================ --- tests/automate_descendents/__driver__.lua b169f5198dad22ec3e8dfe7127e4d5f26bf39e5d +++ tests/automate_descendents/__driver__.lua b169f5198dad22ec3e8dfe7127e4d5f26bf39e5d @@ -0,0 +1,26 @@ + +mtn_setup() + +check(mtn("automate", "descendents", "c7539264e83c5d6af4c792f079b5d46e9c128665"), 1, false, false) + +-- A +-- / \ +-- B C +-- |\ +-- D E +-- \/ +-- F +runstdfile("tests/common/automate_ancestry.lua") + +revs = make_graph() + +-- Now do some checks +revmap("descendents", {revs.b}, {}) +revmap("descendents", {revs.f}, {}) +revmap("descendents", {revs.d}, {revs.f}) +revmap("descendents", {revs.e}, {revs.f}) +revmap("descendents", {revs.c}, {revs.d, revs.e, revs.f}) +revmap("descendents", {revs.a}, {revs.d, revs.e, revs.f, revs.c, revs.b}) +revmap("descendents", {revs.d, revs.f}, {revs.f}) +revmap("descendents", {revs.d, revs.e, revs.f}, {revs.f}) +revmap("descendents", {revs.b, revs.d, revs.e, revs.f}, {revs.f}) ============================================================ --- tests/automate_erase_ancestors/__driver__.lua 6af0ededd123a596151376d854a61caa9612e337 +++ tests/automate_erase_ancestors/__driver__.lua 6af0ededd123a596151376d854a61caa9612e337 @@ -0,0 +1,30 @@ + +mtn_setup() + +check(mtn("automate", "erase_ancestors", "c7539264e83c5d6af4c792f079b5d46e9c128665"), 1, false, false) + +-- A +-- / \ +-- B C +-- |\ +-- D E +-- \/ +-- F +runstdfile("tests/common/automate_ancestry.lua") + +revs = make_graph() + +-- Now do some checks + +revmap("erase_ancestors", {}, {}) +for _,x in pairs(revs) do + revmap("erase_ancestors", {x}, {x}) +end +revmap("erase_ancestors", {revs.a, revs.b}, {revs.b}) +revmap("erase_ancestors", {revs.a, revs.c}, {revs.c}) +revmap("erase_ancestors", {revs.a, revs.f}, {revs.f}) + +revmap("erase_ancestors", {revs.b, revs.c}, {revs.b, revs.c}) +revmap("erase_ancestors", {revs.a, revs.b, revs.c}, {revs.b, revs.c}) +revmap("erase_ancestors", {revs.b, revs.f}, {revs.b, revs.f}) +revmap("erase_ancestors", {revs.a, revs.b, revs.f}, {revs.b, revs.f}) ============================================================ --- tests/automate_leaves/__driver__.lua 8a6facf49f11334953dee41b0828457ffab4c848 +++ tests/automate_leaves/__driver__.lua 8a6facf49f11334953dee41b0828457ffab4c848 @@ -0,0 +1,50 @@ + +mtn_setup() + +-- A +-- |\ +-- B C +-- \| +-- D +-- ^testbranch +-- ^otherbranch +revs = {} + +check(mtn("automate", "leaves"), 0, 0, false) + +addfile("testfile", "blah blah") +commit() +revs.a = base_revision() + +check(mtn("automate", "leaves"), 0, true, false) +check(trim(readfile("stdout")) == revs.a) + +writefile("testfile", "other stuff") +commit() +revs.b = base_revision() + +check(mtn("automate", "leaves"), 0, true, false) +check(trim(readfile("stdout")) == revs.b) + +revert_to(revs.a) + +addfile("otherfile", "other blah blah") +commit("otherbranch") +revs.c = base_revision() + +check(mtn("automate", "leaves"), 0, true, false) +canonicalize("stdout") +tmp = {revs.b, revs.c} +table.sort(tmp) +writefile("tmp", table.concat(tmp, "\n").."\n") +check(samefile("stdout", "tmp")) + +check(mtn("propagate", "testbranch", "otherbranch"), 0, false, false) +check(mtn("update"), 0, false, false) +revs.d = base_revision() + +check(revs.d ~= revs.b) +check(revs.d ~= revs.c) + +check_same_stdout(mtn("automate", "leaves"), mtn("automate", "heads", "otherbranch")) +check_different_stdout(mtn("automate", "leaves"), mtn("automate", "heads", "testbranch")) ============================================================ --- tests/automate_toposort/__driver__.lua 5c2eebd7c32fe5dcc369bfa3cf38ef8e8cbf2113 +++ tests/automate_toposort/__driver__.lua 5c2eebd7c32fe5dcc369bfa3cf38ef8e8cbf2113 @@ -0,0 +1,38 @@ + +mtn_setup() + +-- A +-- / \ +-- B C +-- |\ +-- D E +-- \/ +-- F +runstdfile("tests/common/automate_ancestry.lua") + +revs = make_graph() + +-- Now do some checks +check(mtn("automate", "toposort", "c7539264e83c5d6af4c792f079b5d46e9c128665"), 1, false, false) +check(mtn("automate", "toposort", ""), 1, false, false) + +revmap("toposort", {}, {}, false) +for _,x in pairs(revs) do + revmap("toposort", {x}, {x}, false) +end +revmap("toposort", {revs.a, revs.a}, {revs.a}, false) +revmap("toposort", {revs.a, revs.b}, {revs.a, revs.b}, false) +revmap("toposort", {revs.b, revs.a}, {revs.a, revs.b}, false) +revmap("toposort", {revs.a, revs.f}, {revs.a, revs.f}, false) +revmap("toposort", {revs.f, revs.a}, {revs.a, revs.f}, false) +acef = {revs.a, revs.c, revs.e, revs.f} +revmap("toposort", {revs.a, revs.c, revs.e, revs.f}, acef, false) +revmap("toposort", {revs.c, revs.a, revs.e, revs.f}, acef, false) +revmap("toposort", {revs.f, revs.c, revs.a, revs.e}, acef, false) +revmap("toposort", {revs.f, revs.e, revs.c, revs.a}, acef, false) +revmap("toposort", {}, {}, false) +cdef = {revs.c, revs.d, revs.e, revs.f} +cedf = {revs.c, revs.e, revs.d, revs.f} +x = pcall(revmap, "toposort", cdef, cdef, false) +y = pcall(revmap, "toposort", cdef, cedf, false) +check(x or y) ============================================================ --- tests/check_that_--xargs_and_-(at)_behave_correctly/__driver__.lua 81d1c7a8f2c1344bf65b41964dbeb2337c0b1b0b +++ tests/check_that_--xargs_and_-(at)_behave_correctly/__driver__.lua 81d1c7a8f2c1344bf65b41964dbeb2337c0b1b0b @@ -0,0 +1,33 @@ + +mtn_setup() + +-- Generate the general expected output, as we're testing using the +-- output of 'list --help' +check(raw_mtn("list", "--help"), 2, true, false) +rename("stdout", "expout") + +-- Check that --xargs works at all +writefile("at_test.input", "--help") +check(raw_mtn("list", "--xargs=at_test.input"), 2, {"expout"}, false) + +-- The rest of the checks use the short form, -@ + +-- Check that -@ works at all +writefile("at_test.input", "--help") +check(raw_mtn("list", "-@", "at_test.input"), 2, {"expout"}, false) + +-- Check that -@ works when injected in the middle of the arguments +-- (i.e. that it's prepended correctly) +writefile("at_test.input", "list") +check(raw_mtn("-@", "at_test.input", "--help"), 2, {"expout"}, false) + +-- Check that -@ works when used more than once +writefile("at_test.input1", "list") +writefile("at_test.input2", "--help") +check(raw_mtn("-@", "at_test.input1", "-@", "at_test.input2"), 2, {"expout"}, false) + +-- Check that -@ works with an argument file with no content +check(raw_mtn("list"), 2, true, false) +rename_over("stdout", "expout") +writefile("at_test.input") +check(raw_mtn("list", "-@", "at_test.input"), 2, {"expout"}, false) ============================================================ --- tests/checkout_without_--branch_sets_branch/__driver__.lua 55205d7fcc2a2c748f7ae9264dee34a0fb2e54e0 +++ tests/checkout_without_--branch_sets_branch/__driver__.lua 55205d7fcc2a2c748f7ae9264dee34a0fb2e54e0 @@ -0,0 +1,23 @@ + +mtn_setup() + +addfile("foo", "blah blah") +commit() +rev = base_revision() + +check(mtn("checkout", "--revision", rev, "codir1"), 0, false, false) +check(samefile("foo", "codir1/foo")) +writefile("codir1/foo", "hi maude") +-- verify that no branch is needed for commit +check(indir("codir1", mtn("commit", "--message=foo")), 0, false, false) + +check(mtn("cert", rev, "branch", "otherbranch")) + +-- but, now we can't checkout without a --branch... +-- need to make sure don't pick up branch from our local _MTN dir... +remove_recursive("_MTN") +check(mtn("checkout", "--revision", rev, "codir2"), 1, false, false) +check(mtn("checkout", "--revision", rev, "--branch=testbranch", "codir3"), 0, false, false) +check(samefile("foo", "codir3/foo")) +check(mtn("checkout", "--revision", rev, "--branch=otherbranch", "codir4"), 0, false, false) +check(samefile("foo", "codir4/foo")) ============================================================ --- tests/commit_using__MTN_log_and_--message/__driver__.lua 110e07dd7fd06bf5141a84c31d573af8af512c2d +++ tests/commit_using__MTN_log_and_--message/__driver__.lua 110e07dd7fd06bf5141a84c31d573af8af512c2d @@ -0,0 +1,12 @@ + +mtn_setup() + +getfile("commit_log.lua") + +writefile("_MTN/log", "Log entry") + +writefile("input.txt", "version 0 of the file") + +check(mtn("add", "input.txt"), 0, false, false) + +check(mtn("--branch=testbranch", "--rcfile=commit_log.lua", "commit", "--message=Cause me an error"), 1, false, false) ============================================================ --- tests/commit_using__MTN_log_and_--message/commit_log.lua 09c926209c317efc447dbe6448fe891c2d86e958 +++ tests/commit_using__MTN_log_and_--message/commit_log.lua 09c926209c317efc447dbe6448fe891c2d86e958 @@ -0,0 +1,3 @@ +function edit_comment(summary, user_log_file) + return user_log_file +end ============================================================ --- tests/common/automate_ancestry.lua 44980fb300dd64a7ef6fb3cf3fd9c9152953b084 +++ tests/common/automate_ancestry.lua 44980fb300dd64a7ef6fb3cf3fd9c9152953b084 @@ -0,0 +1,48 @@ + +function make_graph() + local revs = {} + addfile("testfile", "A") + commit() + revs.a = base_revision() + + writefile("testfile", "B") + commit() + revs.b = base_revision() + + revert_to(revs.a) + + writefile("testfile", "C") + commit() + revs.c = base_revision() + + writefile("testfile", "D") + commit() + revs.d = base_revision() + + revert_to(revs.c) + + addfile("otherfile", "E") + commit() + revs.e = base_revision() + + check(mtn("explicit_merge", revs.d, revs.e, "testbranch"), 0, false, false) + check(mtn("update"), 0, false, false) + revs.f = base_revision() + + check(revs.f ~= revs.d and revs.f ~= revs.e) + + return revs +end + +function revmap(name, from, to, dosort) + if dosort == nil then dosort = true end + check(mtn("automate", name, unpack(from)), 0, true, false) + canonicalize("stdout") + if dosort then table.sort(to) end + if to[1] == nil then + writefile("tmp", "") + else + writefile("tmp", table.concat(to, "\n").."\n") + end + check(samefile("tmp", "stdout")) +end ============================================================ --- tests/db_execute/__driver__.lua 077230cbf8856a312cb59b375e9fccbeaa3534c2 +++ tests/db_execute/__driver__.lua 077230cbf8856a312cb59b375e9fccbeaa3534c2 @@ -0,0 +1,32 @@ + +mtn_setup() + +two_col_table = "files" +col1 = "id" + +function dbex(...) + check(mtn("db", "execute", string.format(unpack(arg))), 0, true, false) +end + +dbex("INSERT INTO %s VALUES ('key1', 'value1')", two_col_table) + +dbex("SELECT * FROM %s", two_col_table) +check(qgrep("key1", "stdout")) +check(qgrep("value1", "stdout")) + +dbex("SELECT * FROM %s WHERE %s = 'nonsense'", two_col_table, col1) +check(not qgrep("key1", "stdout")) + +dbex("SELECT * FROM %s WHERE %s LIKE 'k%%'", two_col_table, col1) +check(qgrep("key1", "stdout")) + +dbex("DELETE FROM %s", two_col_table) + +dbex("SELECT * FROM %s", two_col_table) +check(not qgrep("key1", "stdout")) + +-- We used to have weird quoting bugs around "%" +-- string is split into two so the grep doesn't trigger on monotone's +-- chatter about what command it's going to execute... +dbex("SELECT '%%s' || 'tuff'") +check(qgrep('%stuff', "stdout")) ============================================================ --- tests/diff_in_a_never-committed_project/__driver__.lua deec2a101000baabf8cd4c687ab5430ea6f22d49 +++ tests/diff_in_a_never-committed_project/__driver__.lua deec2a101000baabf8cd4c687ab5430ea6f22d49 @@ -0,0 +1,7 @@ + +mtn_setup() + +addfile("testfile", "flagella") +check(mtn("diff"), 0, true, false) +check(qgrep("testfile", "stdout")) +check(qgrep("flagella", "stdout")) ============================================================ --- tests/files_with_spaces_at_the_end/__driver__.lua 685a16e7b9c9f306a6533e83ece1456e78b7e810 +++ tests/files_with_spaces_at_the_end/__driver__.lua 685a16e7b9c9f306a6533e83ece1456e78b7e810 @@ -0,0 +1,8 @@ + +mtn_setup() +skip_if(ostype == "Windows") +-- On Win32, the files "foo bar" and "foo bar " are the same, obviating this test + +writefile("foo bar ") +check(mtn("add", "foo bar "), 0, false, false) +commit() ============================================================ --- tests/importing_CVS_files_with_identical_logs/__driver__.lua c449f049d81e25cd714aa8214b2f25eab4ef289d +++ tests/importing_CVS_files_with_identical_logs/__driver__.lua c449f049d81e25cd714aa8214b2f25eab4ef289d @@ -0,0 +1,53 @@ + +skip_if(not existsonpath("cvs")) +mtn_setup() + +writefile("importme.0", "version 0 of test file") +writefile("importme.1", "version 1 of test file") +writefile("importme.2", "version 2 of test file") +writefile("importme.3", "version 3 of test file") + +tsha0=sha1("importme.0") +tsha1=sha1("importme.1") +tsha2=sha1("importme.2") +tsha3=sha1("importme.3") + +-- build the cvs repository + +cvsroot = test_root .. "/cvs-repository" +function cvs(...) + return {"cvs", "-d", cvsroot, unpack(arg)} +end +check(cvs("-q", "init"), 0, false, false) +check(exists(cvsroot)) +check(exists(cvsroot.."/CVSROOT")) +check(exists(cvsroot.."/CVSROOT/modules")) + +-- check out the workspace and make some commits + +check(cvs("co", "."), 0, false, false) +mkdir("testdir") +copyfile("importme.0", "testdir/importme") +check(cvs("add", "testdir"), 0, false, false) +check(cvs("add", "testdir/importme"), 0, false, false) +check(cvs("commit", "-m", 'commit 0', "testdir/importme"), 0, false, false) +copyfile("importme.1", "testdir/importme") +check(cvs("commit", "-m", 'commit same message', "testdir/importme"), 0, false, false) +copyfile("importme.2", "testdir/importme") +check(cvs("commit", "-m", 'commit same message', "testdir/importme"), 0, false, false) +copyfile("importme.3", "testdir/importme") +check(cvs("commit", "-m", 'commit 3', "testdir/importme"), 0, false, false) + +-- import into monotone and check presence of files + +check(mtn("--branch=testbranch", "cvs_import", cvsroot.."/testdir"), 0, false, false) +check(mtn("automate", "get_file", tsha0), 0, false) +check(mtn("automate", "get_file", tsha1), 0, false) +check(mtn("automate", "get_file", tsha2), 0, false) +check(mtn("automate", "get_file", tsha3), 0, false) + +-- also check that history is okay -- has a unique head, and it's the +-- right one. + +check(mtn("checkout", "--branch=testbranch", "mtcodir"), 0, false, false) +check(samefile("importme.3", "mtcodir/importme")) ============================================================ --- tests/inodeprints/__driver__.lua dca8be709d7a7336fc4cfa1ef1b89e27bdabe0e1 +++ tests/inodeprints/__driver__.lua dca8be709d7a7336fc4cfa1ef1b89e27bdabe0e1 @@ -0,0 +1,39 @@ + +mtn_setup() + +-- Turn them on +writefile("_MTN/inodeprints") + +check(mtn("diff"), 0, true, false) +check(qgrep("no changes", "stdout")) + +addfile("testfile", "blah blah") + +check(mtn("diff"), 0, true, false) +check(qgrep("blah blah", "stdout")) + +commit() + +-- Something should have been written to it +check(fsize("_MTN/inodeprints") ~= 0) +copyfile("_MTN/inodeprints", "ip1") + +-- And stuff should still work +check(mtn("diff"), 0, true, false) +check(qgrep("no changes", "stdout")) + +writefile("testfile", "stuff stuff") + +check(mtn("diff"), 0, true, false) +check(qgrep("stuff stuff", "stdout")) + +-- Make sure partial commit doesn't screw things up +addfile("otherfile", "other stuff") +check(mtn("commit", "otherfile", "--message=foo"), 0, false, false) + +-- Should have changed the inodeprints file +check(not samefile("_MTN/inodeprints", "ip1")) + +-- Still should think testfile is modified +check(mtn("diff"), 0, true, false) +check(qgrep("stuff stuff", "stdout")) ============================================================ --- tests/listing_workspace_manifests/__driver__.lua 4f7b902626cfbb1fc0725b052b28cb1cbb54829f +++ tests/listing_workspace_manifests/__driver__.lua 4f7b902626cfbb1fc0725b052b28cb1cbb54829f @@ -0,0 +1,33 @@ + +mtn_setup() + +check(mtn("ls", "missing"), 0, nil, false) + +writefile("foo", "the foo file") +writefile("bar", "the bar file") +check(mtn("add", "foo", "bar"), 0, false, false) + +check(mtn("ls", "known"), 0, true) +check(sort("stdout"), 0, "bar\nfoo\n") + +mkdir("dir") +writefile("dir/foo", "the foo file") +writefile("dir/bar", "the bar file") +check(mtn("add", "dir/foo", "dir/bar"), 0, false, false) + +check(mtn("ls", "known"), 0, true) +check(sort("stdout"), 0, "bar\ndir\ndir/bar\ndir/foo\nfoo\n") + +check(mtn("--branch=testbranch", "commit", "--message=committed"), 0, false, false) + +check(mtn("ls", "known"), 0, true) +check(sort("stdout"), 0, "bar\ndir\ndir/bar\ndir/foo\nfoo\n") + +check(mtn("drop", "foo"), 0, false, false) +rename("dir", "dir2") +check(mtn("rename", "dir", "dir2"), 0, false, false) +rename("bar", "baz") +check(mtn("rename", "bar", "baz"), 0, false, false) + +check(mtn("ls", "known"), 0, true) +check(sort("stdout"), 0, "baz\ndir2\ndir2/bar\ndir2/foo\n") ============================================================ --- tests/log_--last=N_--next=N/__driver__.lua aa76e4f861e6a73a7c8108796dadb017d3335bb1 +++ tests/log_--last=N_--next=N/__driver__.lua aa76e4f861e6a73a7c8108796dadb017d3335bb1 @@ -0,0 +1,32 @@ + +mtn_setup() + +addfile("foo", "foo") +commit() +foo = base_revision() + +addfile("bar", "bar") +commit() + +addfile("baz", "baz") +commit() + + +check(mtn("log", "--last=0"), 1, 0, false) + +for i = 1,3 do + check(mtn("log", "--last="..i), 0, true) + check(grep("^Revision:", "stdout"), 0, true) + check(numlines("stdout") == i) +end + +revert_to(foo) + + +check(mtn("log", "--next=0"), 1, 0, false) + +for i = 1,3 do + check(mtn("log", "--next="..i), 0, true) + check(grep("^Revision:", "stdout"), 0, true) + check(numlines("stdout") == i) +end ============================================================ --- tests/netsync_largish_file/__driver__.lua 84f89f33bd31f8c1ecf75d199c8c881877a90e3b +++ tests/netsync_largish_file/__driver__.lua 84f89f33bd31f8c1ecf75d199c8c881877a90e3b @@ -0,0 +1,20 @@ + +mtn_setup() +netsync.setup() + +-- Check that we can netsync a 32MB file. + +write_large_file("largish", 32) + +check(mtn("add", "largish"), 0, false, false) +commit() +file = sha1("largish") + +srv = netsync.start("testbranch") + +srv:pull("testbranch") + +srv:stop() + +check(mtn("--db=test2.db", "--branch=testbranch", "checkout", "other"), 0, false, false) +check(file == sha1("other/largish")) ============================================================ --- tests/sql_function_gunzip_(which_replaced_unpack)/__driver__.lua a75cf54559b0ba34e8e24a9bf9ef21a92eab7fdc +++ tests/sql_function_gunzip_(which_replaced_unpack)/__driver__.lua a75cf54559b0ba34e8e24a9bf9ef21a92eab7fdc @@ -0,0 +1,7 @@ + +mtn_setup() + +check(mtn("db", "execute", "select gunzip(X'1f8b08000000000000004d91416e1b310c00effb8a45ee49244a14c973aefd8161189444260bc4abc05eb4e8efabf6e0f44c903318eef6eb72d57d73bb1feb89049b33696c899c52cc8eaa85255aca1d0a292179d5725e96f1d92f37fbb9ddb7b1af27eb92ad2527ce9144dc4324552cc15120f7e04ade02f6f3bfbd6f2018954c8e217108812a774ae06e8c2167a00ea100149509fcd2a37dac4f2fd7e3598fe3767f5a56bf8deb94ae85d0c43a8a59eb52758a6473068e52da3c211d55d27959d7f518ebc9a516ece211a95a254950215856469b83cc2459b4db7fd0b70fdddfedc7787f40a1ea4c920a74e292d45082000b0925c296bd936189c00f68200c85c3d48ca152622cde3ab2c5bf5d1c6dc6ea35c7fc0d6d633f6e5b7d6d9bd6715cae631fc7d8ede5ebf7c3622e73634f5571860476950a314b0d39a2468ac90b49c48705276d1c7ab6d2c92303ceaf8265b2a84952ad983aa056382f7f003a0168da19020000')"), 0, true, false) + +check(qgrep("new_manifest \\[795cf87a1c37f7314f5aa6891e34d267a757fba6\\]", "stdout")) +check(qgrep("from \\[7b675e9ed59eecd9bac3f4ef828196c2069d5a93\\]", "stdout")) ============================================================ --- tests/sticky_branches/__driver__.lua ed9188c29ff7be00e5ea2b7cde67b17432f8adda +++ tests/sticky_branches/__driver__.lua ed9188c29ff7be00e5ea2b7cde67b17432f8adda @@ -0,0 +1,56 @@ + +mtn_setup() + +-- setup saves given branch +check(mtn("setup", "setupdir", "--branch=testbranch"), 0, false, false) +writefile("setupdir/foo", "blah blah") +check(indir("setupdir", mtn("add", "foo")), 0, false, false) +check(indir("setupdir", mtn("commit", "--message=foo")), 0, false, false) + +-- checkout saves given branch +check(mtn("checkout", "--branch=testbranch", "codir"), 0, false, false) +check(samefile("setupdir/foo", "codir/foo")) +writefile("codir/foo", "other other") +check(indir("codir", mtn("commit", "--message=foo")), 0, false, false) + +-- log doesn't affect given branch +check(indir("codir", mtn("log")), 0, false, false) +writefile("codir/foo", "more more") +check(indir("codir", mtn("commit", "--message=foo")), 0, false, false) +check(mtn("ls", "branches"), 0, true, false) +check(trim(readfile("stdout")) == "testbranch") + +-- commit saves given branch +writefile("codir/foo", "newbranch newbranch") +check(indir("codir", mtn("commit", "--branch=otherbranch", "--message=foo")), 0, false, false) +writefile("codir/foo", "newbranch 2 newbranch 2") +check(indir("codir", mtn("commit", "--message=foo")), 0, false, false) +check(mtn("checkout", "--branch=otherbranch", "otherdir"), 0, false, false) +check(samefile("codir/foo", "otherdir/foo")) + +-- update saves the given branch +check(mtn("checkout", "--branch=testbranch", "updir"), 0, false, false) +check(indir("updir", mtn("update", "--branch=otherbranch")), 0, false, false) +check(samefile("otherdir/foo", "updir/foo")) +writefile("otherdir/foo", "yet another chunk of entropy") +check(indir("otherdir", mtn("commit", "--message=foo")), 0, false, false) +check(indir("updir", mtn("update")), 0, false, false) +check(samefile("otherdir/foo", "updir/foo")) + +-- merge doesn't affect given branch +check(mtn("co", "--branch=testbranch", "third1"), 0, false, false) +writefile("third1/a", "1a") +check(indir("third1", mtn("add", "a")), 0, false, false) +check(indir("third1", mtn("commit", "--branch=third", "--message=foo")), 0, false, false) +check(mtn("co", "--branch=testbranch", "third2"), 0, false, false) +writefile("third2/b", "2b") +check(indir("third2", mtn("add", "b")), 0, false, false) +check(indir("third2", mtn("commit", "--branch=third", "--message=foo")), 0, false, false) +check(indir("codir", mtn("merge", "--branch=third")), 0, false, false) +check(mtn("automate", "heads", "third"), 0, true, false) +rename("stdout", "old-third-heads") +writefile("codir/foo", "more more") +check(indir("codir", mtn("commit", "--message=foo")), 0, false, false) +-- we check that this didn't create a new head of branch third +check(mtn("automate", "heads", "third"), 0, true, false) +check(samefile("stdout", "old-third-heads")) ============================================================ --- tests/update_updates_inodeprints/__driver__.lua 409d78bbf7e90bbe1b0c4ff995252b67b93545b9 +++ tests/update_updates_inodeprints/__driver__.lua 409d78bbf7e90bbe1b0c4ff995252b67b93545b9 @@ -0,0 +1,15 @@ + +mtn_setup() + +addfile("testfile", "blah blah") +commit() +r0 = base_revision() + +writefile("testfile", "stuff stuff") +commit() +r1 = base_revision() + +check(mtn("checkout", "--branch=testbranch", "--revision", r0, "td"), 0, false) +writefile("td/_MTN/inodeprints") +check(indir("td", mtn("update")), 0, false, false) +check(fsize("td/_MTN/inodeprints") ~= 0) ============================================================ --- tester.lua 2d9160c79827476de8af60abde5c6f7ea0a6f822 +++ tester.lua c914b3f1af823b09b3891af2bdc67399880f47b3 @@ -229,6 +229,12 @@ getstdfile(testname .. "/" .. name, as) end +function runstdfile(name) + local func, e = loadfile(srcdir.."/"..name) + if func == nil then err(e, 2) end + func() +end + function trim(str) return string.gsub(str, "^%s*(.-)%s*$", "%1") end @@ -385,21 +391,45 @@ return {dotail, unpack(arg)} end +function sort(...) + local function dosort(file) + local infile + if file == nil then + infile = files.stdin + else + infile = io.open(file) + end + local lines = {} + for l in infile:lines() do + table.insert(lines, l) + end + if file ~= nil then infile:close() end + table.sort(lines) + for _,l in ipairs(lines) do + files.stdout:write(l, "\n") + end + return 0 + end + return {dosort, unpack(arg)} +end + function log_file_contents(filename) L(readfile_q(filename), "\n") end function pre_cmd(stdin, ident) if ident == nil then ident = "ts-" end - if stdin ~= true then - local infile = io.open("stdin", "w") + if stdin == true then + copyfile("stdin", ident .. "stdin") + elseif type(stdin) == "table" then + copyfile(stdin[1], ident .. "stdin") + else + local infile = io.open(ident .. "stdin", "w") if stdin ~= nil and stdin ~= false then infile:write(stdin) end infile:close() end - os.remove(ident .. "stdin") - os.rename("stdin", ident .. "stdin") L("stdin:\n") log_file_contents(ident .. "stdin") end @@ -425,6 +455,10 @@ if contents ~= stdout then err("Check failed (stdout): doesn't match", 3) end + elseif type(stdout) == "table" then + if not samefile(ident .. "stdout", stdout[1]) then + err("Check failed (stdout): doesn't match", 3) + end elseif stdout == true then os.remove("stdout") os.rename(ident .. "stdout", "stdout") @@ -441,6 +475,10 @@ if contents ~= stderr then err("Check failed (stderr): doesn't match", 3) end + elseif type(stderr) == "table" then + if not samefile(ident .. "stderr", stderr[1]) then + err("Check failed (stderr): doesn't match", 3) + end elseif stderr == true then os.remove("stderr") os.rename(ident .. "stderr", "stderr") @@ -452,10 +490,12 @@ -- * true: ignore, copy to stdout -- * string: check that it matches the contents -- * nil: must be empty +-- * {string}: check that it matches the named file -- stdin can be: -- * true: use existing "stdin" file -- * nil, false: empty input -- * string: contents of string +-- * {string}: contents of the named file function bg(torun, ret, stdout, stderr, stdin) bgid = bgid + 1 ============================================================ --- tests/automate_ancestors/__driver__.lua a37170def6261cd8ae768f8d8cf336f2f416a370 +++ tests/automate_ancestors/__driver__.lua 1047d5c87aa3ac11b1dce31e313bd37ad8a1bf80 @@ -10,70 +10,14 @@ -- D E -- \/ -- F -revs = {} +runstdfile("tests/common/automate_ancestry.lua") -addfile("testfile", "A") -commit() -revs.a = base_revision() +revs = make_graph() -writefile("testfile", "B") -commit() -revs.b = base_revision() - -revert_to(revs.a) - -writefile("testfile", "C") -commit() -revs.c = base_revision() - -writefile("testfile", "D") -commit() -revs.d = base_revision() - -revert_to(revs.c) - -addfile("otherfile", "E") -commit() -revs.e = base_revision() - -check(mtn("explicit_merge", revs.d, revs.e, "testbranch"), 0, false, false) -check(mtn("update"), 0, false, false) -revs.f = base_revision() - -check(revs.f ~= revs.d) -check(revs.f ~= revs.e) - -- Now do some checks +revmap("ancestors", {revs.a}, {}) +revmap("ancestors", {revs.b}, {revs.a}) +revmap("ancestors", {revs.e}, {revs.a, revs.c}) +revmap("ancestors", {revs.f}, {revs.d, revs.a, revs.c, revs.e}) +revmap("ancestors", {revs.d, revs.f}, {revs.d, revs.a, revs.c, revs.e}) +revmap("ancestors", {revs.a, revs.b, revs.c}, {revs.a}) - -check(mtn("automate", "ancestors", revs.a), 0, 0, false) - -check(mtn("automate", "ancestors", revs.b), 0, true, false) -canonicalize("stdout") -writefile("tmp", revs.a.."\n") -check(samefile("tmp", "stdout")) - -check(mtn("automate", "ancestors", revs.e), 0, true, false) -canonicalize("stdout") -tmp = {revs.a, revs.c} -table.sort(tmp) -writefile("tmp", table.concat(tmp, "\n").."\n") -check(samefile("tmp", "stdout")) - -check(mtn("automate", "ancestors", revs.f), 0, true, false) -canonicalize("stdout") -tmp = {revs.d, revs.a, revs.c, revs.e} -table.sort(tmp) -writefile("tmp", table.concat(tmp, "\n").."\n") -check(samefile("tmp", "stdout")) - -check(mtn("automate", "ancestors", revs.d, revs.f), 0, true, false) -canonicalize("stdout") -tmp = {revs.d, revs.a, revs.c, revs.e} -table.sort(tmp) -writefile("tmp", table.concat(tmp, "\n").."\n") -check(samefile("tmp", "stdout")) - -check(mtn("automate", "ancestors", revs.a, revs.b, revs.c), 0, true, false) -canonicalize("stdout") -writefile("tmp", revs.a.."\n") -check(samefile("tmp", "stdout")) ============================================================ --- testsuite.at 657b10b3bf7ccaa263cff9617210401fc6a5c4cd +++ testsuite.at 106a1b130cc6ac73d67e440f774b6ef75544f2b2 @@ -608,25 +608,6 @@ # include all the sub-tests we're going to use -m4_include(tests/t_automate_descendents.at) -m4_include(tests/t_automate_erase_ancestors.at) -m4_include(tests/t_automate_toposort.at) -m4_include(tests/t_diff_first_rev.at) -m4_include(tests/t_automate_ancestry_difference.at) -m4_include(tests/t_automate_leaves.at) -m4_include(tests/t_log_last_next.at) -m4_include(tests/t_commit_log_3.at) -m4_include(tests/t_at_sign.at) -m4_include(tests/t_db_execute.at) -m4_include(tests/t_sql_gunzip.at) -m4_include(tests/t_final_space.at) -m4_include(tests/t_inodeprints.at) -m4_include(tests/t_inodeprints_update.at) -m4_include(tests/t_ls_known.at) -m4_include(tests/t_cvsimport_samelog.at) -m4_include(tests/t_sticky_branch.at) -m4_include(tests/t_checkout_id_sets_branch.at) -m4_include(tests/t_netsync_largish_file.at) m4_include(tests/t_update_off_branch.at) m4_include(tests/t_setup_checkout_modify_new_dir.at) m4_include(tests/t_rename_dir_add_dir_with_old_name.at) ============================================================ --- testsuite.lua 3e5cb0ddb4c7e5b49f076e9fbf1d5d3c2a6cb5e9 +++ testsuite.lua b83ad5558b02646a6fc3ade53cc0ebd7e4caaf8e @@ -492,3 +492,22 @@ table.insert(tests, "tests/drop_a_public_and_private_key") table.insert(tests, "tests/rename_moves_attributes") table.insert(tests, "tests/automate_ancestors") +table.insert(tests, "tests/automate_descendents") +table.insert(tests, "tests/automate_erase_ancestors") +table.insert(tests, "tests/automate_toposort") +table.insert(tests, "tests/diff_in_a_never-committed_project") +table.insert(tests, "tests/automate_ancestry_difference") +table.insert(tests, "tests/automate_leaves") +table.insert(tests, "tests/log_--last=N_--next=N") +table.insert(tests, "tests/commit_using__MTN_log_and_--message") +table.insert(tests, "tests/check_that_--xargs_and_-(at)_behave_correctly") +table.insert(tests, "tests/db_execute") +table.insert(tests, "tests/sql_function_gunzip_(which_replaced_unpack)") +table.insert(tests, "tests/files_with_spaces_at_the_end") +table.insert(tests, "tests/inodeprints") +table.insert(tests, "tests/update_updates_inodeprints") +table.insert(tests, "tests/listing_workspace_manifests") +table.insert(tests, "tests/importing_CVS_files_with_identical_logs") +table.insert(tests, "tests/sticky_branches") +table.insert(tests, "tests/checkout_without_--branch_sets_branch") +table.insert(tests, "tests/netsync_largish_file")