diff options
author | Chris Down <chris@chrisdown.name> | 2020-02-17 10:11:46 -0500 |
---|---|---|
committer | Daniel Shahaf <danielsh@apache.org> | 2020-02-18 12:59:51 +0000 |
commit | cb5d8bfe8621c8029f97647ec543ce6e7c41fa58 (patch) | |
tree | 95301840b9bb4f49095f1944e2e88879cf0ac97f | |
parent | 51260963703bbc91944434648ae71a05addbcb05 (diff) | |
download | zsh-cb5d8bfe8621c8029f97647ec543ce6e7c41fa58.tar.gz zsh-cb5d8bfe8621c8029f97647ec543ce6e7c41fa58.tar.xz zsh-cb5d8bfe8621c8029f97647ec543ce6e7c41fa58.zip |
45451: builtins: kill: Add basic test suite
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.
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | Test/B11kill.ztst | 60 |
2 files changed, 64 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog index 290f1c6af..4d48d787c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2020-02-18 Chris Down <chris@chrisdown.name> + + * 45451: Test/B11kill.ztst: builtins: kill: Add basic test suite + 2020-02-17 brian m. carlson <sandals@crustytoothpaste.net> * github #48/0002: diff --git a/Test/B11kill.ztst b/Test/B11kill.ztst new file mode 100644 index 000000000..26d7a11fe --- /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 exit codes which are 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 |