blob: 4641d7839454f732898000da38df65ed121c7a37 [file] [log] [blame]
Masatake YAMATO6077ad82014-12-24 20:59:32 +09001BEGIN {
Dmitry V. Levinda66e252015-03-05 17:30:23 +00002 lines = 6
Masatake YAMATO6077ad82014-12-24 20:59:32 +09003 fail = 0
Dmitry V. Levinc9cc4cb2015-01-07 20:14:19 +00004 addrlen = length(addr) + 3
Masatake YAMATO6077ad82014-12-24 20:59:32 +09005
Masatake YAMATO6077ad82014-12-24 20:59:32 +09006 r_i = "[1-9][0-9]*"
Dmitry V. Levinc9cc4cb2015-01-07 20:14:19 +00007 r_close_listen = "^close\\(0<UNIX:[" r_i ",\"" addr "\"]>\\) += 0$"
Dmitry V. Levined7ada22015-01-13 00:06:09 +00008 r_connect = "^connect\\(1<UNIX:\\[(" r_i ")\\]>, \\{sa_family=AF_(LOCAL|UNIX|FILE), sun_path=\"" addr "\"\\}, " addrlen "\\) += 0$"
Masatake YAMATO6077ad82014-12-24 20:59:32 +09009}
10
Dmitry V. Levinf0ed1672014-12-25 00:32:23 +000011NR == 1 && /^socket\(PF_(LOCAL|UNIX|FILE), SOCK_STREAM, 0\) += 1$/ {next}
12
13NR == 2 {if (match($0, r_close_listen)) next}
14
Masatake YAMATO6077ad82014-12-24 20:59:32 +090015NR == 3 {
16 if (match($0, r_connect, a)) {
17 inode = a[1]
Dmitry V. Levinf0ed1672014-12-25 00:32:23 +000018 r_close_connected = "^close\\(1<UNIX:\\[(" r_i ")->" r_i "\\]>\\) += 0$"
Masatake YAMATO6077ad82014-12-24 20:59:32 +090019 next
20 }
21}
Masatake YAMATO6077ad82014-12-24 20:59:32 +090022
Dmitry V. Levinda66e252015-03-05 17:30:23 +000023NR == 4 && /^--- SIGUSR1 / {next}
24
25NR == 5 {
Dmitry V. Levinf0ed1672014-12-25 00:32:23 +000026 if (inode != "" && r_close_connected != "" && match($0, r_close_connected, a) && a[1] == inode) {
27 next
28 }
29}
30
31NR == lines && $0 == "+++ exited with 0 +++" {next}
Masatake YAMATO6077ad82014-12-24 20:59:32 +090032
33{
34 print "Line " NR " does not match: " $0
35 fail=1
36}
37
38END {
39 if (NR != lines) {
40 print "Expected " lines " lines, found " NR " line(s)."
41 print ""
42 exit 1
43 }
44 if (fail) {
45 print ""
46 exit 1
47 }
48}