zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH v3 1/3] builtins: kill: Add basic test suite
@ 2020-02-17 15:11 Chris Down
  2020-02-17 15:12 ` [PATCH v3 2/3] builtins: kill: Add `kill ''` regression test with explicit sigspec Chris Down
  0 siblings, 1 reply; 8+ messages in thread
From: Chris Down @ 2020-02-17 15:11 UTC (permalink / raw)
  To: zsh-workers; +Cc: Daniel Shahaf

This is not totally comprehensive, but at least it's a start for the
core functionality. In the next commits, we'll also use this base to add
some regression tests.
---
 Test/B11kill.ztst | 60 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)
 create mode 100644 Test/B11kill.ztst

diff --git a/Test/B11kill.ztst b/Test/B11kill.ztst
new file mode 100644
index 000000000..c254b0925
--- /dev/null
+++ b/Test/B11kill.ztst
@@ -0,0 +1,60 @@
+# Tests for the kill builtin.
+#
+# The exit codes 11 and 19 in this file don't mean anything special, they're
+# just an exit code which is specific enough that the failure of `kill` itself
+# can be differentiated from exiting due to executing a trap.
+
+%test
+
+# Correct invocation
+
+  if zmodload zsh/system &>/dev/null; then
+    (
+      trap 'exit 19' TERM
+      kill $sysparams[pid]
+    )
+  else
+    ZTST_skip='Cannot zmodload zsh/system, skipping kill with no sigspec'
+  fi
+19:kill with no sigspec
+
+
+  if zmodload zsh/system &>/dev/null; then
+    (
+      trap 'exit 11' USR1
+      kill -USR1 $sysparams[pid]
+    )
+  else
+    ZTST_skip='Cannot zmodload zsh/system, skipping kill with sigspec'
+  fi
+11:kill with sigspec
+
+# Incorrect invocation
+
+  (
+    kill a b c
+  )
+3:kill with multiple wrong inputs should increment status
+?(eval):kill:2: illegal pid: a
+?(eval):kill:2: illegal pid: b
+?(eval):kill:2: illegal pid: c
+
+  (
+    kill -INT a b c
+  )
+3:kill with sigspec and wrong inputs should increment status
+?(eval):kill:2: illegal pid: a
+?(eval):kill:2: illegal pid: b
+?(eval):kill:2: illegal pid: c
+
+  (
+    kill
+  )
+1:kill with no arguments
+?(eval):kill:2: not enough arguments
+
+  (
+    kill -INT
+  )
+1:kill with sigspec only
+?(eval):kill:2: not enough arguments
-- 
2.25.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-02-18 19:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-17 15:11 [PATCH v3 1/3] builtins: kill: Add basic test suite Chris Down
2020-02-17 15:12 ` [PATCH v3 2/3] builtins: kill: Add `kill ''` regression test with explicit sigspec Chris Down
2020-02-17 15:12   ` [PATCH v3 3/3] builtins: kill: Do not signal current process group when pid is empty Chris Down
2020-02-18 13:04   ` [PATCH v3 2/3] builtins: kill: Add `kill ''` regression test with explicit sigspec Daniel Shahaf
2020-02-18 15:26     ` Chris Down
2020-02-18 16:42       ` Daniel Shahaf
2020-02-18 18:50         ` Chris Down
2020-02-18 19:37           ` Daniel Shahaf

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).