summaryrefslogtreecommitdiffstats
path: root/testsuite/killall.test
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 13:17:26 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 13:17:26 +0000
commita4dc4fbcc1b131061dcccd5cdcc2395d9a2ba784 (patch)
treebc531e7e083fff1668bb4e79e9692d8cc47aea95 /testsuite/killall.test
parentInitial commit. (diff)
downloadpsmisc-a4dc4fbcc1b131061dcccd5cdcc2395d9a2ba784.tar.xz
psmisc-a4dc4fbcc1b131061dcccd5cdcc2395d9a2ba784.zip
Adding upstream version 23.7.upstream/23.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testsuite/killall.test')
-rw-r--r--testsuite/killall.test/killall.exp32
1 files changed, 32 insertions, 0 deletions
diff --git a/testsuite/killall.test/killall.exp b/testsuite/killall.test/killall.exp
new file mode 100644
index 0000000..8bb3889
--- /dev/null
+++ b/testsuite/killall.test/killall.exp
@@ -0,0 +1,32 @@
+#
+# Testsuite for killall
+#
+
+set killall "${topdir}src/killall"
+set fake_proc_name "afakeprocname"
+
+set test "killall with no arguments"
+spawn $killall
+expect_pass "$test" "^Usage: killall \\\[OPTION\\\]\\.\\.\\. \\\[--\\\] NAME\\.\\.\\."
+
+set test "killall list signals"
+spawn $killall -l
+expect_pass "$test" "^(\[A-Z12\]+\\s*)+$"
+
+set test "killall process not found"
+spawn $killall ${fake_proc_name}
+expect_pass "$test" "${fake_proc_name}: no process found"
+
+set test "killall using -ve"
+spawn $killall -ve ${fake_proc_name}
+expect_pass "$test" "${fake_proc_name}: no process found"
+
+set signals [regexp -all -inline {\w+} [exec $killall -l]]
+foreach signame $signals {
+ set test "killall using signal $signame"
+ spawn $killall -$signame ${fake_proc_name}
+ expect_pass "$test" "${fake_proc_name}: no process found"
+ set test "killall using signal SIG$signame"
+ spawn $killall -SIG$signame ${fake_proc_name}
+ expect_pass "$test" "${fake_proc_name}: no process found"
+}