From 51192ad58fb62503bf1528edf1f26dfae3bf4b52 Mon Sep 17 00:00:00 2001 From: Jeremy Baxter Date: Sun, 7 Apr 2024 07:12:42 +1200 Subject: [PATCH] tests: test presence of all signals --- test.lua | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/test.lua b/test.lua index 8bc2208..d40e4ff 100644 --- a/test.lua +++ b/test.lua @@ -192,9 +192,34 @@ fs.remove("%s")]]):format( return 'process.pidof("' .. proc .. '")' end, 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 local ok, err = pcall(function () @@ -203,7 +228,7 @@ fs.remove("%s")]]):format( assert(not ok) assert(err:find("no such signal$")) - return 'process.signum("' .. sig .. '")' + return 'process.signum("' .. sigs[#sigs] .. '")' end, send = function () local hdl = io.popen("sleep 2")