ack/tests/plat/build.lua
George Koehler 3d6ee435cf Fix pattern that was rewriting func(! var, var) as func(1).
Bug reported by Rune, see
 - https://sourceforge.net/p/tack/mailman/message/35809953/
 - https://github.com/davidgiven/ack/issues/62

In EM code, beq and bne pop 2 values and compare them, but teq and tne
pop only 1 value and compare it with zero.  We need cms to compare 2
values; other patterns may convert cmi or cmu to cms.
2017-10-29 14:53:33 -04:00

72 lines
1.4 KiB
Lua

include("plat/build.lua")
definerule("plat_testsuite",
{
plat = { type="string" },
method = { type="string" },
},
function(e)
-- Remember this is executed from the caller's directory; local
-- target names will resolve there.
local testfiles = filenamesof(
"tests/plat/*.c",
"tests/plat/*.e",
"tests/plat/*.p",
"tests/plat/b/*.b",
"tests/plat/bugs/bug-22-inn_mod.mod",
"tests/plat/bugs/bug-62-notvar_var_e.c"
)
acklibrary {
name = "lib",
srcs = {
"tests/plat/lib/test.c",
"tests/plat/lib/test_b.c",
},
hdrs = {
"tests/plat/lib/test.h",
"tests/plat/lib/Test.def"
},
vars = { plat = e.plat },
}
local tests = {}
for _, f in ipairs(testfiles) do
local fs = replace(basename(f), "%.[^.]+$", "")
local _, _, lang = fs:find("_([^_]+)$")
if not lang then
lang = "e"
end
local bin = ackprogram {
name = fs.."_bin",
srcs = { f },
deps = { "+lib" },
vars = {
plat = e.plat,
lang = lang,
ackcflags = "-O0 -Bmain"
}
}
tests[#tests+1] = normalrule {
name = fs,
outleaves = { e.plat.."-"..fs.."-testlog.txt" },
ins = {
bin,
"tests/plat/testdriver.sh",
"util/build+testrunner"
},
commands = {
"(%{ins[2]} "..e.method.." %{ins[1]} 5 %{ins[3]} || echo @@FAIL) > %{outs}",
}
}
end
return bundle {
name = e.name,
srcs = tests,
}
end
)