tests: test presence of all signals
This commit is contained in:
parent
c85b11835c
commit
51192ad58f
1 changed files with 28 additions and 3 deletions
31
test.lua
31
test.lua
|
@ -192,9 +192,34 @@ fs.remove("%s")]]):format(
|
||||||
return 'process.pidof("' .. proc .. '")'
|
return 'process.pidof("' .. proc .. '")'
|
||||||
end,
|
end,
|
||||||
signum = function ()
|
signum = function ()
|
||||||
local sig = "SIGKILL"
|
local sigs = {
|
||||||
|
"SIGABRT",
|
||||||
|
"SIGALRM",
|
||||||
|
"SIGBUS",
|
||||||
|
"SIGCHLD",
|
||||||
|
"SIGCONT",
|
||||||
|
"SIGFPE",
|
||||||
|
"SIGHUP",
|
||||||
|
"SIGILL",
|
||||||
|
"SIGINT",
|
||||||
|
"SIGKILL",
|
||||||
|
"SIGPIPE",
|
||||||
|
"SIGQUIT",
|
||||||
|
"SIGSEGV",
|
||||||
|
"SIGSTOP",
|
||||||
|
"SIGTERM",
|
||||||
|
"SIGTSTP",
|
||||||
|
"SIGTTIN",
|
||||||
|
"SIGTTOU",
|
||||||
|
"SIGTRAP",
|
||||||
|
"SIGURG",
|
||||||
|
"SIGUSR1",
|
||||||
|
"SIGUSR2"
|
||||||
|
}
|
||||||
|
|
||||||
assert(math.type(process.signum(sig)) == "integer")
|
for _, sig in ipairs(sigs) do
|
||||||
|
assert(math.type(process.signum(sig)) == "integer")
|
||||||
|
end
|
||||||
|
|
||||||
-- https://todo.sr.ht/~jeremy/callisto/2
|
-- https://todo.sr.ht/~jeremy/callisto/2
|
||||||
local ok, err = pcall(function ()
|
local ok, err = pcall(function ()
|
||||||
|
@ -203,7 +228,7 @@ fs.remove("%s")]]):format(
|
||||||
assert(not ok)
|
assert(not ok)
|
||||||
assert(err:find("no such signal$"))
|
assert(err:find("no such signal$"))
|
||||||
|
|
||||||
return 'process.signum("' .. sig .. '")'
|
return 'process.signum("' .. sigs[#sigs] .. '")'
|
||||||
end,
|
end,
|
||||||
send = function ()
|
send = function ()
|
||||||
local hdl = io.popen("sleep 2")
|
local hdl = io.popen("sleep 2")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue