diff --git a/plat/qemuppc/tests/build.lua b/plat/qemuppc/tests/build.lua index f0c2993c4..6581d93ef 100644 --- a/plat/qemuppc/tests/build.lua +++ b/plat/qemuppc/tests/build.lua @@ -1,49 +1,7 @@ -include("plat/build.lua") +include("tests/plat/build.lua") -local qemu = "qemu-system-ppc" -local tests = {} - -if os.execute("which "..qemu.." > /dev/null") ~= 0 then - print("warning: skipping tests which require ", qemu) -else - local testcases = filenamesof("./*.c", "./*.s", "./*.e", "./*.p") - - for _, f in ipairs(testcases) 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 = { "plat/qemuppc/tests/lib+lib" }, - vars = { - plat = "qemuppc", - lang = lang, - ackcflags = "-O0" - } - } - - tests[#tests+1] = normalrule { - name = fs, - outleaves = { "stamp" }, - ins = { - bin, - "./testdriver.sh" - }, - commands = { - "%{ins[2]} "..qemu.." %{ins[1]} 5", - "touch %{outs}" - } - } - end -end - -normalrule { - name = "tests", - outleaves = { "stamp" }, - ins = tests, - commands = { "touch %{outs}" } -} \ No newline at end of file +plat_testsuite { + name = "tests", + plat = "qemuppc", + method = "qemu-system-ppc" +} diff --git a/plat/qemuppc/tests/_dummy.c b/tests/plat/_dummy.c similarity index 100% rename from plat/qemuppc/tests/_dummy.c rename to tests/plat/_dummy.c diff --git a/plat/qemuppc/tests/brk_c.c b/tests/plat/brk_c.c similarity index 100% rename from plat/qemuppc/tests/brk_c.c rename to tests/plat/brk_c.c diff --git a/tests/plat/build.lua b/tests/plat/build.lua new file mode 100644 index 000000000..23685ba40 --- /dev/null +++ b/tests/plat/build.lua @@ -0,0 +1,57 @@ +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" + ) + + 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 = { "tests/plat/lib+lib" }, + vars = { + plat = e.plat, + lang = lang, + ackcflags = "-O0" + } + } + + tests[#tests+1] = normalrule { + name = fs, + outleaves = { "stamp" }, + ins = { + bin, + "tests/plat/testdriver.sh" + }, + commands = { + "%{ins[2]} "..e.method.." %{ins[1]} 5", + "touch %{outs}" + } + } + end + + return normalrule { + name = e.name, + outleaves = { "stamp" }, + ins = tests, + commands = { "touch %{outs}" } + } + end +) \ No newline at end of file diff --git a/plat/qemuppc/tests/calloc_c.c b/tests/plat/calloc_c.c similarity index 100% rename from plat/qemuppc/tests/calloc_c.c rename to tests/plat/calloc_c.c diff --git a/plat/qemuppc/tests/csa_e.c b/tests/plat/csa_e.c similarity index 100% rename from plat/qemuppc/tests/csa_e.c rename to tests/plat/csa_e.c diff --git a/plat/qemuppc/tests/csb_e.c b/tests/plat/csb_e.c similarity index 100% rename from plat/qemuppc/tests/csb_e.c rename to tests/plat/csb_e.c diff --git a/plat/qemuppc/tests/doublecmp_e.c b/tests/plat/doublecmp_e.c similarity index 100% rename from plat/qemuppc/tests/doublecmp_e.c rename to tests/plat/doublecmp_e.c diff --git a/plat/qemuppc/tests/from_d_to_si_e.c b/tests/plat/from_d_to_si_e.c similarity index 100% rename from plat/qemuppc/tests/from_d_to_si_e.c rename to tests/plat/from_d_to_si_e.c diff --git a/plat/qemuppc/tests/from_d_to_ui_e.c b/tests/plat/from_d_to_ui_e.c similarity index 100% rename from plat/qemuppc/tests/from_d_to_ui_e.c rename to tests/plat/from_d_to_ui_e.c diff --git a/plat/qemuppc/tests/from_si_to_d_e.c b/tests/plat/from_si_to_d_e.c similarity index 100% rename from plat/qemuppc/tests/from_si_to_d_e.c rename to tests/plat/from_si_to_d_e.c diff --git a/plat/qemuppc/tests/from_ui_to_d_e.c b/tests/plat/from_ui_to_d_e.c similarity index 100% rename from plat/qemuppc/tests/from_ui_to_d_e.c rename to tests/plat/from_ui_to_d_e.c diff --git a/plat/qemuppc/tests/inn_e.e b/tests/plat/inn_e.e similarity index 100% rename from plat/qemuppc/tests/inn_e.e rename to tests/plat/inn_e.e diff --git a/plat/qemuppc/tests/intadd_e.c b/tests/plat/intadd_e.c similarity index 100% rename from plat/qemuppc/tests/intadd_e.c rename to tests/plat/intadd_e.c diff --git a/plat/qemuppc/tests/intcmp_e.c b/tests/plat/intcmp_e.c similarity index 100% rename from plat/qemuppc/tests/intcmp_e.c rename to tests/plat/intcmp_e.c diff --git a/plat/qemuppc/tests/intdiv_e.c b/tests/plat/intdiv_e.c similarity index 100% rename from plat/qemuppc/tests/intdiv_e.c rename to tests/plat/intdiv_e.c diff --git a/plat/qemuppc/tests/intrem_e.c b/tests/plat/intrem_e.c similarity index 100% rename from plat/qemuppc/tests/intrem_e.c rename to tests/plat/intrem_e.c diff --git a/plat/qemuppc/tests/intshift_e.c b/tests/plat/intshift_e.c similarity index 100% rename from plat/qemuppc/tests/intshift_e.c rename to tests/plat/intshift_e.c diff --git a/plat/qemuppc/tests/intsub_e.c b/tests/plat/intsub_e.c similarity index 100% rename from plat/qemuppc/tests/intsub_e.c rename to tests/plat/intsub_e.c diff --git a/plat/qemuppc/tests/lib/build.lua b/tests/plat/lib/build.lua similarity index 100% rename from plat/qemuppc/tests/lib/build.lua rename to tests/plat/lib/build.lua diff --git a/plat/qemuppc/tests/lib/test.c b/tests/plat/lib/test.c similarity index 100% rename from plat/qemuppc/tests/lib/test.c rename to tests/plat/lib/test.c diff --git a/plat/qemuppc/tests/lib/test.h b/tests/plat/lib/test.h similarity index 100% rename from plat/qemuppc/tests/lib/test.h rename to tests/plat/lib/test.h diff --git a/plat/qemuppc/tests/newdispose_p.p b/tests/plat/newdispose_p.p similarity index 100% rename from plat/qemuppc/tests/newdispose_p.p rename to tests/plat/newdispose_p.p diff --git a/plat/qemuppc/tests/testdriver.sh b/tests/plat/testdriver.sh similarity index 100% rename from plat/qemuppc/tests/testdriver.sh rename to tests/plat/testdriver.sh