ack/tests/plat/build.lua
George Koehler 26de4c1ab1 Add test for EM _rck_. Fix traps in PowerPC ncg.
The new test rck_e.e segfaults on PowerPC unless I make some changes.
The inline code for _rck_ was wrong because it didn't allow the trap
handler to return.  _sig_ forgot to push the old trap handler.

Move plat/linuxppc/libsys/trap.s to mach/powerpc/libem/trp.s and
rewrite it with simplified/extended mnemonics.  Remove .trap alias for
.trp procedure.  Add a missing `mtspr lr, r0` so we can return from
the trap handler.  Call write() and _exit() so trp.s works with both
linuxppc and osxppc.  Before, Mac OS X was wrongly using the trap.s
for Linux.

In powerpc/libem, simplify .aar4; teach .csa and .csb to raise the
trap if the default target is zero.

C programs don't need these changes.  You may relink your C programs
with the changed .csa and .csb, but C code doesn't raise the trap.
Modula-2 code can raise traps, so you may want to relink your Modula-2
programs with the changed libem, but you might keep your old .o files
from Modula-2.  You may need to recompile your Pascal programs (delete
old .o files from Pascal) because the Pascal compiler might use _rck_.
2017-12-24 22:37:52 -05:00

81 lines
1.7 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/dup_e.e",
"tests/plat/exg_e.e",
"tests/plat/inn_e.e",
"tests/plat/rck_e.e",
"tests/plat/rotate_e.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",
"tests/plat/m2/ConvTest_mod.mod",
"tests/plat/m2/NestProc_mod.mod",
"tests/plat/m2/OpenArray_mod.mod",
"tests/plat/m2/Set100_mod.mod",
"tests/plat/m2/StringTest_mod.mod"
)
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]} 15 %{ins[3]} > %{outs}; true",
}
}
end
return bundle {
name = e.name,
srcs = tests,
}
end
)