|
|
TEST_TIMEOUT = 10 |
|
|
|
|
|
function assert_loop(cq, timeout) |
|
|
local ok, err, _, thd = cq:loop(timeout) |
|
|
if not ok then |
|
|
if thd then |
|
|
err = debug.traceback(thd, err) |
|
|
end |
|
|
error(err, 2) |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
local cqueues = require "cqueues" |
|
|
local has_luacov, luacov_runner = pcall(require, "luacov.runner") |
|
|
if has_luacov then |
|
|
local wrap; wrap = cqueues.interpose("wrap", function(self, func, ...) |
|
|
func = luacov_runner.with_luacov(func) |
|
|
return wrap(self, func, ...) |
|
|
end) |
|
|
end |
|
|
|
|
|
|
|
|
local locale = os.getenv("LOCALE") |
|
|
if locale then |
|
|
os.setlocale(locale) |
|
|
if locale ~= os.setlocale(locale) then |
|
|
print("Locale " .. locale .. " is not available.") |
|
|
os.exit(1) |
|
|
end |
|
|
end |
|
|
|