2017-05-13 23:28:45 +02:00
|
|
|
-- Test if client's c:swap() corrupts the Lua stack
|
|
|
|
|
|
|
|
local runner = require("_runner")
|
|
|
|
local spawn = require("awful.spawn")
|
|
|
|
|
2019-02-28 09:24:12 +01:00
|
|
|
local had_exit, had_success
|
2017-05-13 23:28:45 +02:00
|
|
|
local had_error = false
|
|
|
|
|
2019-02-28 09:24:12 +01:00
|
|
|
local function check_done()
|
|
|
|
if had_exit and had_success then
|
|
|
|
if had_error then
|
|
|
|
runner.done("Some error occurred, see above")
|
|
|
|
else
|
|
|
|
runner.done()
|
|
|
|
end
|
2017-05-13 23:28:45 +02:00
|
|
|
end
|
|
|
|
end
|
2019-02-28 09:24:12 +01:00
|
|
|
|
|
|
|
local err = spawn.with_line_callback(
|
|
|
|
{ os.getenv("build_dir") .. "/test-gravity" },
|
|
|
|
{
|
|
|
|
exit = function(what, code)
|
|
|
|
assert(what == "exit", what)
|
|
|
|
assert(code == 0, "Exit code was " .. code)
|
|
|
|
had_exit = true
|
|
|
|
check_done()
|
|
|
|
end,
|
|
|
|
stderr = function(line)
|
|
|
|
had_error = true
|
|
|
|
print("Read on stderr: " .. line)
|
|
|
|
end,
|
|
|
|
stdout = function(line)
|
|
|
|
if line == "SUCCESS" then
|
|
|
|
had_success = true
|
|
|
|
check_done()
|
|
|
|
elseif line:sub(1, 5) ~= "LOG: " then
|
|
|
|
had_error = true
|
|
|
|
print("Read on stdout: " .. line)
|
|
|
|
end
|
2017-05-13 23:28:45 +02:00
|
|
|
end
|
2019-02-28 09:24:12 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
assert(type(err) ~= "string", err)
|
|
|
|
runner.run_direct()
|
2017-05-13 23:28:45 +02:00
|
|
|
|
|
|
|
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|