about summary refs log tree commit diff
path: root/Test/B11kill.ztst
blob: 26d7a11fe11e552afec54b015786cff14d5185cf (plain) (blame)
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
49
50
51
52
53
54
55
56
57
58
59
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