-- testbed-runner.lua — run the full balancerlite suite inside OpenWrt. package.path = "/testbed/src/?.lua;/testbed/src/?/init.lua;;" local files = { "tests/sha256.lua", "tests/state.lua", "tests/routing.lua", "tests/wg.lua", "tests/ctl.lua", "tests/smoke.lua", "tests/probes_config.lua", } local failures = 0 for _, f in ipairs(files) do print(string.rep("=", 50)) print("RUN " .. f) local ok, err = os.execute("lua " .. f .. " > /testbed/out-" .. f:match("tests/([%w_]+)%.lua") .. ".txt 2>&1") local rc = (ok and 0) or 1 print(" exit=" .. rc .. (err and (" err=" .. tostring(err)) or "")) if rc ~= 0 then failures = failures + 1 end end -- dump each output file local ofiles = { "out-sha256.txt", "out-state.txt", "out-routing.txt", "out-wg.txt", "out-ctl.txt", "out-smoke.txt", "out-probes_config.txt", } for _, f in ipairs(ofiles) do local fh = io.open("/testbed/" .. f, "r") if fh then local body = fh:read("*a") fh:close() print("----- " .. f .. " -----") print(body) end end print(string.rep("=", 50)) if failures == 0 then print("TESTBED RESULT: ALL 7 SUITES PASS") else print("TESTBED RESULT: " .. failures .. " suite(s) FAILED") end os.exit(failures == 0 and 0 or 1)