2016-11-25 20:02:51 +00:00
|
|
|
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",
|
2016-12-06 21:07:22 +00:00
|
|
|
"tests/plat/*.p",
|
|
|
|
"tests/plat/bugs/*.mod"
|
2016-11-25 20:02:51 +00:00
|
|
|
)
|
|
|
|
|
2016-11-26 10:23:25 +00:00
|
|
|
acklibrary {
|
|
|
|
name = "lib",
|
|
|
|
srcs = { "tests/plat/lib/test.c" },
|
2016-12-11 22:06:37 +00:00
|
|
|
hdrs = {
|
|
|
|
"tests/plat/lib/test.h",
|
|
|
|
"tests/plat/lib/Test.def"
|
|
|
|
},
|
2016-11-26 10:23:25 +00:00
|
|
|
vars = { plat = e.plat },
|
|
|
|
}
|
|
|
|
|
2016-11-25 20:02:51 +00:00
|
|
|
local tests = {}
|
|
|
|
for _, f in ipairs(testfiles) do
|
2016-12-06 21:07:22 +00:00
|
|
|
local fs = replace(basename(f), "%.[^.]+$", "")
|
|
|
|
local _, _, lang = fs:find("_([^_]+)$")
|
2016-11-25 20:02:51 +00:00
|
|
|
if not lang then
|
|
|
|
lang = "e"
|
|
|
|
end
|
|
|
|
|
|
|
|
local bin = ackprogram {
|
|
|
|
name = fs.."_bin",
|
|
|
|
srcs = { f },
|
2016-11-26 10:23:25 +00:00
|
|
|
deps = { "+lib" },
|
2016-11-25 20:02:51 +00:00
|
|
|
vars = {
|
|
|
|
plat = e.plat,
|
|
|
|
lang = lang,
|
|
|
|
ackcflags = "-O0"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tests[#tests+1] = normalrule {
|
|
|
|
name = fs,
|
2016-12-01 22:03:30 +00:00
|
|
|
outleaves = { e.plat.."-"..fs.."-testlog.txt" },
|
2016-11-25 20:02:51 +00:00
|
|
|
ins = {
|
|
|
|
bin,
|
2016-11-29 19:59:43 +00:00
|
|
|
"tests/plat/testdriver.sh",
|
|
|
|
"util/build+testrunner"
|
2016-11-25 20:02:51 +00:00
|
|
|
},
|
|
|
|
commands = {
|
2016-12-06 21:07:22 +00:00
|
|
|
"(%{ins[2]} "..e.method.." %{ins[1]} 5 %{ins[3]} || echo FAILED) > %{outs}",
|
2016-11-25 20:02:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2016-12-01 22:03:30 +00:00
|
|
|
return bundle {
|
2016-11-25 20:02:51 +00:00
|
|
|
name = e.name,
|
2016-12-01 22:03:30 +00:00
|
|
|
srcs = tests,
|
2016-11-25 20:02:51 +00:00
|
|
|
}
|
|
|
|
end
|
|
|
|
)
|