include("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") for _, f in ipairs(testcases) do local fs = replace(basename(f), "%..$", "") local bin = ackprogram { name = fs.."_bin", srcs = { f }, deps = { "plat/qemuppc/tests/lib+lib" }, vars = { plat = "qemuppc", lang = "e", } } 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}" } }