2019-09-27 16:15:10 +00:00
|
|
|
|
2016-11-25 20:02:51 +00:00
|
|
|
include("plat/build.lua")
|
|
|
|
|
|
|
|
definerule("plat_testsuite",
|
|
|
|
{
|
|
|
|
plat = { type="string" },
|
|
|
|
method = { type="string" },
|
2019-11-15 20:33:15 +00:00
|
|
|
-- added bugs/bug-203-ego-sr_c-O3.c
|
2019-09-05 17:13:02 +00:00
|
|
|
sets = { type="table", default={"core", "b", "bugs", "m2", "floats", "long-long"}},
|
2018-06-08 06:59:04 +00:00
|
|
|
skipsets = { type="table", default={}},
|
2019-06-16 22:41:49 +00:00
|
|
|
tests = { type="targets", default={} },
|
2016-11-25 20:02:51 +00:00
|
|
|
},
|
|
|
|
function(e)
|
|
|
|
-- Remember this is executed from the caller's directory; local
|
|
|
|
-- target names will resolve there.
|
2019-06-16 22:52:09 +00:00
|
|
|
local testfiles = filenamesof(e.tests)
|
2018-06-08 06:59:04 +00:00
|
|
|
local skipsets = {}
|
|
|
|
for _, set in ipairs(e.skipsets) do
|
|
|
|
skipsets[set] = true
|
|
|
|
end
|
|
|
|
for _, set in ipairs(e.sets) do
|
|
|
|
if not skipsets[set] then
|
2022-07-14 21:57:54 +00:00
|
|
|
local fs = filenamesof("tests/plat/"..set.."+srcs")
|
2018-06-08 06:59:04 +00:00
|
|
|
for _, f in ipairs(fs) do
|
|
|
|
testfiles[#testfiles+1] = f
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2016-11-25 20:02:51 +00:00
|
|
|
|
2016-11-26 10:23:25 +00:00
|
|
|
acklibrary {
|
|
|
|
name = "lib",
|
2016-12-31 17:38:52 +00:00
|
|
|
srcs = {
|
|
|
|
"tests/plat/lib/test.c",
|
|
|
|
"tests/plat/lib/test_b.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
|
2019-06-16 22:52:09 +00:00
|
|
|
local fs = replace(basename(f), "%.[^.]+$", "")
|
2016-12-06 21:07:22 +00:00
|
|
|
local _, _, lang = fs:find("_([^_]+)$")
|
2016-11-25 20:02:51 +00:00
|
|
|
if not lang then
|
|
|
|
lang = "e"
|
|
|
|
end
|
|
|
|
|
2019-11-15 20:33:15 +00:00
|
|
|
-- If lang is "c-O3", then build with -O3.
|
|
|
|
local _, _, optimize = lang:find("(-O[^-]*)$")
|
|
|
|
if optimize then
|
|
|
|
lang = lang:sub(1, -1 - #optimize)
|
|
|
|
else
|
|
|
|
optimize = "-O0"
|
|
|
|
end
|
|
|
|
|
2016-11-25 20:02:51 +00:00
|
|
|
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,
|
2019-11-15 20:33:15 +00:00
|
|
|
ackcflags = optimize.." -Bmain"
|
2016-11-25 20:02:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-03 13:13:43 +00:00
|
|
|
local methoddep = nil
|
|
|
|
local methodpath = e.method
|
|
|
|
if e.method:find("%+") then
|
|
|
|
methoddep = e.method
|
|
|
|
methodpath = "%{ins[4]}"
|
|
|
|
end
|
2016-11-25 20:02:51 +00:00
|
|
|
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",
|
2018-06-03 13:13:43 +00:00
|
|
|
"util/build+testrunner",
|
|
|
|
methoddep,
|
2016-11-25 20:02:51 +00:00
|
|
|
},
|
|
|
|
commands = {
|
2018-06-03 13:13:43 +00:00
|
|
|
"%{ins[2]} "..methodpath.." %{ins[1]} 15 %{ins[3]} > %{outs}; true",
|
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
|
2016-12-31 17:38:52 +00:00
|
|
|
)
|