#
#
# patch "ChangeLog"
# from [9f6eedfc918dc1c50912ecdc99c9084ba4e3f196]
# to [247413032721a84e71cd34acca7fb2500b623934]
#
# patch "tester.lua"
# from [a88db551458681f3420e1606ca9956ead0a3357b]
# to [c27ae935d1c3fe519d4539b149cecdd209dab0a0]
#
# patch "tests/common/cvs.lua"
# from [0c2cf3c2efb0df62a1685923ddbc43fef17feb7b]
# to [b6d3b0aece6b3ec5e1128a702e49f387726ba757]
#
# patch "tests/importing_cvs_branches_with_correct_ancestory/__driver__.lua"
# from [e099fd52c8883ea4e243fa2483008fcf3103d64b]
# to [fa31cd63b45c828bf4a6461a13d661571e6bca2a]
#
# patch "tests/importing_cvs_files/__driver__.lua"
# from [53a20869275488855933ddf5097507a3a9f01f23]
# to [0170dbd22fc9bc14c8a6d16d6f85754d5a4dabf1]
#
# patch "tests/importing_cvs_files_with_identical_logs/__driver__.lua"
# from [b8405ae43172bf5a683703fd9c15cb9a240e8021]
# to [3cb0ee23b2ff8bf5307f24086e520efe5b931d7f]
#
# patch "tests/importing_cvs_with_vendor_imports_and_branches/__driver__.lua"
# from [9468d85e8b9acc33c4d4c69d2f28c3ff2efd6916]
# to [a9bbce79a2f24f68156023636326bc1825b78146]
#
============================================================
--- ChangeLog 9f6eedfc918dc1c50912ecdc99c9084ba4e3f196
+++ ChangeLog 247413032721a84e71cd34acca7fb2500b623934
@@ -1,5 +1,12 @@
2006-07-06 Timothy Brownawell
+ * tests/common/cvs.lua: Sleep after running CVS.
+ * tester.lua: Adjust command handling somewhat, so the above works.
+ * tests/*cvs*/__driver__.lua: Remove any sleep(1) lines. This is now
+ handled automatically.
+
+2006-07-06 Timothy Brownawell
+
* tests/importing_cvs_branches_with_correct_ancestory/__driver__.lua:
Move a sleep(). Maybe it'll work reliably now?
============================================================
--- tester.lua a88db551458681f3420e1606ca9956ead0a3357b
+++ tester.lua c27ae935d1c3fe519d4539b149cecdd209dab0a0
@@ -277,6 +277,24 @@
return ret
end
+function cmd_as_str(cmd_table)
+ local str = ""
+ for i,x in ipairs(cmd_table) do
+ if str ~= "" then str = str .. " " end
+ if type(x) == "function" then
+ str = str .. ""
+ else
+ local s = tostring(x)
+ if string.find(s, " ") then
+ str = str .. '"'..s..'"'
+ else
+ str = str .. s
+ end
+ end
+ end
+ return str
+end
+
function runcmd(cmd, prefix, bgnd)
if prefix == nil then prefix = "ts-" end
if type(cmd) ~= "table" then err("runcmd called with bad argument") end
@@ -300,19 +318,14 @@
end
local result
+ if cmd.logline ~= nil then
+ L(locheader(), cmd.logline, "\n")
+ else
+ L(locheader(), cmd_as_str(cmd), "\n")
+ end
if type(cmd[1]) == "function" then
- L(locheader(), " ")
- for i,x in ipairs(cmd) do
- if i ~= 1 then L(" ", tostring(x)) end
- end
- L("\n")
result = {pcall(unpack(cmd))}
elseif type(cmd[1]) == "string" then
- L(locheader())
- for i,x in ipairs(cmd) do
- L(" ", tostring(x))
- end
- L("\n")
if bgnd then
result = {pcall(spawn, unpack(cmd))}
else
@@ -389,7 +402,8 @@
end
function grep(...)
- local dogrep = function (flags, what, where)
+ local flags, what, where = unpack(arg)
+ local dogrep = function ()
if where == nil and string.sub(flags, 1, 1) ~= "-" then
where = what
what = flags
@@ -412,13 +426,14 @@
if where ~= nil then infile:close() end
return out
end
- return {dogrep, unpack(arg)}
+ return {dogrep, logline = "grep "..cmd_as_str(arg)}
end
function cat(...)
- local function docat(...)
+ local arguments = arg
+ local function docat()
local bsize = 8*1024
- for _,x in ipairs(arg) do
+ for _,x in ipairs(arguments) do
local infile
if x == "-" then
infile = files.stdin
@@ -436,11 +451,12 @@
end
return 0
end
- return {docat, unpack(arg)}
+ return {docat, logline = "cat "..cmd_as_str(arg)}
end
function tail(...)
- local function dotail(file, num)
+ local file, num = unpack(arg)
+ local function dotail()
if num == nil then num = 10 end
local mylines = {}
for l in io.lines(file) do
@@ -454,10 +470,10 @@
end
return 0
end
- return {dotail, unpack(arg)}
+ return {dotail, logline = "tail "..cmd_as_str(arg)}
end
-function sort(...)
+function sort(file)
local function dosort(file)
local infile
if file == nil then
@@ -476,7 +492,7 @@
end
return 0
end
- return {dosort, unpack(arg)}
+ return {dosort, file, logline = "sort "..file}
end
function log_file_contents(filename)
@@ -661,7 +677,22 @@
if not ok then err(res) end
return res
end
- return {do_indir, local_redirect = (type(what[1]) == "function")}
+ local want_local
+ if type(what[1]) == "function" then
+ if type(what.local_redirect) == "nil" then
+ want_local = true
+ else
+ want_local = what.local_redirect
+ end
+ else
+ want_local = false
+ end
+ local ll = "In directory "..dir..": "
+ if what.logline ~= nil then ll = ll .. tostring(what.logline)
+ else
+ ll = ll .. cmd_as_str(what)
+ end
+ return {do_indir, local_redirect = want_local, logline = ll}
end
function check(first, ...)
============================================================
--- tests/common/cvs.lua 0c2cf3c2efb0df62a1685923ddbc43fef17feb7b
+++ tests/common/cvs.lua b6d3b0aece6b3ec5e1128a702e49f387726ba757
@@ -1,11 +1,20 @@
skip_if(not existsonpath("cvs"))
function cvs(...)
+ local what
if os.getenv("OSTYPE") == "msys" then
- return {"cvs", "-d", cvsroot_nix, unpack(arg)}
+ what = {"cvs", "-d", cvsroot_nix, unpack(arg)}
else
- return {"cvs", "-d", cvsroot, unpack(arg)}
+ what = {"cvs", "-d", cvsroot, unpack(arg)}
end
+ local function do_cvs()
+ local ok, res = pcall(execute, unpack(what))
+ if not ok then err(res) end
+ sleep(1)
+ return res
+ end
+ local ll = cmd_as_str(what)
+ return {do_cvs, local_redirect = false, logline = ll}
end
function cvs_setup()
============================================================
--- tests/importing_cvs_branches_with_correct_ancestory/__driver__.lua e099fd52c8883ea4e243fa2483008fcf3103d64b
+++ tests/importing_cvs_branches_with_correct_ancestory/__driver__.lua fa31cd63b45c828bf4a6461a13d661571e6bca2a
@@ -42,7 +42,6 @@
check(cvs("commit", "-m", 'initial import', "testdir/file1", "testdir/file2", "testdir/changelog"), 0, false, false)
-- commit first changes
-sleep(1)
writefile("testdir/file1", readfile("file1.1"))
writefile("testdir/changelog", readfile("changelog.1"))
check(cvs("commit", "-m", 'first commit', "testdir/file1", "testdir/changelog"), 0, false, false)
@@ -52,14 +51,12 @@
check(indir("testdir", cvs("up", "-r", "branched")), 0, false, false)
-- alter the files on the branch
-sleep(1)
writefile("testdir/file2", readfile("file2.1"))
writefile("testdir/changelog", readfile("changelog.3"))
check(cvs("commit", "-m", 'commit on branch', "testdir/file2", "testdir/changelog"), 0, false, false)
-- and create some mainline changes after the branch
check(cvs("up", "-A"), 0, false, false)
-sleep(1)
writefile("testdir/file1", readfile("file1.2"))
writefile("testdir/changelog", readfile("changelog.2"))
check(cvs("commit", "-m", 'commit on mainline after branch', "testdir/file1", "testdir/changelog"), 0, false, false)
============================================================
--- tests/importing_cvs_files/__driver__.lua 53a20869275488855933ddf5097507a3a9f01f23
+++ tests/importing_cvs_files/__driver__.lua 0170dbd22fc9bc14c8a6d16d6f85754d5a4dabf1
@@ -20,15 +20,12 @@
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)
-sleep(1) -- these are needed to make sure the timestamp changes
writefile("testdir/importme", "version 1 of test file")
tsha1 = sha1("testdir/importme")
check(cvs("commit", "-m", 'commit 1', "testdir/importme"), 0, false, false)
-sleep(1)
writefile("testdir/importme", "version 2 of test file")
tsha2 = sha1("testdir/importme")
check(cvs("commit", "-m", 'commit 2', "testdir/importme"), 0, false, false)
-sleep(1)
writefile("testdir/importme", "version 3 of test file")
tsha3 = sha1("testdir/importme")
check(cvs("commit", "-m", 'commit 3', "testdir/importme"), 0, false, false)
============================================================
--- tests/importing_cvs_files_with_identical_logs/__driver__.lua b8405ae43172bf5a683703fd9c15cb9a240e8021
+++ tests/importing_cvs_files_with_identical_logs/__driver__.lua 3cb0ee23b2ff8bf5307f24086e520efe5b931d7f
@@ -17,15 +17,12 @@
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)
-sleep(1)
writefile("testdir/importme", "version 1 of test file")
tsha1 = sha1("testdir/importme")
check(cvs("commit", "-m", 'commit same message', "testdir/importme"), 0, false, false)
-sleep(1)
writefile("testdir/importme", "version 2 of test file")
tsha2 = sha1("testdir/importme")
check(cvs("commit", "-m", 'commit same message', "testdir/importme"), 0, false, false)
-sleep(1)
writefile("testdir/importme", "version 3 of test file")
tsha3 = sha1("testdir/importme")
check(cvs("commit", "-m", 'commit 3', "testdir/importme"), 0, false, false)
============================================================
--- tests/importing_cvs_with_vendor_imports_and_branches/__driver__.lua 9468d85e8b9acc33c4d4c69d2f28c3ff2efd6916
+++ tests/importing_cvs_with_vendor_imports_and_branches/__driver__.lua a9bbce79a2f24f68156023636326bc1825b78146
@@ -16,14 +16,12 @@
-- now we alter some of the files.
check(cvs("co", "testsrc"), 0, false, false)
-sleep(1)
writefile("file1.1", "version 1 of test file1")
copy("file1.1", "testsrc/file1")
check(cat("-", "changelog.0"), 0, true, false, "second changelog\n\n")
rename("stdout", "changelog.1")
copy("changelog.1", "testsrc/changelog")
check(indir("testsrc", cvs ("commit", "-m", 'commit 0')), 0, false, false)
-sleep(1)
check(cat("-", "changelog.1"), 0, true, false, "third changelog -not on branch-\n\n")
rename("stdout", "changelog.2")
@@ -32,7 +30,6 @@
check(indir("testsrc", cvs ("up", "-r", "branched")), 0, false, false)
-- alter the files on the branch
-sleep(1)
writefile("file1.2", "version 2 of test file1")
copy("file1.2", "testsrc/file1")
writefile("file2.1", "version 1 of test file2")
@@ -44,7 +41,6 @@
-- and create some mainline changes after the branch
check(indir("testsrc", cvs ("up", "-A")), 0, false, false)
-sleep(1)
copy("changelog.2", "testsrc/changelog")
check(indir("testsrc", cvs ("commit", "-m", 'commit on mainline after branch')), 0, false, false)