summaryrefslogtreecommitdiff
path: root/testsuite/kill.test/kill.exp
blob: bf00fdf25e9f65bc217fde268ea2f7d46a76c35f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#
# Dejagnu testsuite for kill - part of procps
#
set kill ${topdir}kill

set test "kill with no arguments"
spawn $kill
expect_pass "$test" "Usage:\\s+kill pid ...\\s+Send SIGTERM to every process listed.\\r\\s+kill signal pid ...\\s+Send a signal to every process listed.\\r\\s+kill -s signal pid ...\\s+Send a signal to every process listed.\\r\\s+kill -l\\s+List all signal names.\\r\\s+kill -L\\s+List all signal names in a nice table.\\r\\s+kill -l signal\\s+Convert between signal numbers and names."

set test "kill list signal names"
spawn $kill -l
expect_pass "$test" "^\(\[A-Z12\]\\s*\)+$"

set test "kill list signal names in table"
spawn $kill -L
expect_pass "$test" "^\(\\s+\\d+ \[A-Z12\]+\)+\\s*$"

set test "kill convert signal name to number"
spawn  $kill -l HUP
expect_pass "$test" "^1\\s*"

set test "kill convert signal number to name"
spawn  $kill -l 1
expect_pass "$test" "^HUP\\s*"

#set test "kill numbered process"
#make_testproc
#if { [ file isdirectory "/proc/$testproc1_pid" ] && [ file isdirectory "/proc/$testproc2_pid" ] } {
#} else {
#    perror "Could not start test processes"
#}
#exec $kill -KILL $testproc1_pid
#wait
#if { [ file exists "/proc/$testproc1_pid" ] } {
#    exec kill $testproc2_pid
#    fail "$test (proc 1 exists)"
#} else {
#    exec $kill -KILL $testproc2_pid
#    wait
#    if { [ file exists "/proc/$testproc2_pid" ] } {
#        exec kill $testproc2_pid
#        fail "$test (proc 2 exists)"
#    } else {
#        pass "$test"
#    }
#}