blob: b5bb901e1d33f43da2a50f09d17d078c08b9e594 [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. Levin3d463be2015-08-02 01:41:26 +00007 r_socket = "^socket\\(PF_(LOCAL|UNIX|FILE), SOCK_STREAM, 0\\) += 1<UNIX:\\[(" r_i ")\\]>$"
Dmitry V. Levinc9cc4cb2015-01-07 20:14:19 +00008 r_close_listen = "^close\\(0<UNIX:[" r_i ",\"" addr "\"]>\\) += 0$"
Masatake YAMATO6077ad82014-12-24 20:59:32 +09009}
10
Dmitry V. Levin3d463be2015-08-02 01:41:26 +000011NR == 1 {
12 if (match($0, r_socket, a)) {
13 inode = a[2]
14 r_connect = "^connect\\(1<UNIX:\\[" inode "\\]>, \\{sa_family=AF_(LOCAL|UNIX|FILE), sun_path=\"" addr "\"\\}, " addrlen "\\) += 0$"
15 next
16 }
17}
Dmitry V. Levinf0ed1672014-12-25 00:32:23 +000018
19NR == 2 {if (match($0, r_close_listen)) next}
20
Masatake YAMATO6077ad82014-12-24 20:59:32 +090021NR == 3 {
Dmitry V. Levin3d463be2015-08-02 01:41:26 +000022 if (r_connect != "" && match($0, r_connect)) {
Dmitry V. Levinf0ed1672014-12-25 00:32:23 +000023 r_close_connected = "^close\\(1<UNIX:\\[(" r_i ")->" r_i "\\]>\\) += 0$"
Masatake YAMATO6077ad82014-12-24 20:59:32 +090024 next
25 }
26}
Masatake YAMATO6077ad82014-12-24 20:59:32 +090027
Dmitry V. Levinda66e252015-03-05 17:30:23 +000028NR == 4 && /^--- SIGUSR1 / {next}
29
30NR == 5 {
Dmitry V. Levinf0ed1672014-12-25 00:32:23 +000031 if (inode != "" && r_close_connected != "" && match($0, r_close_connected, a) && a[1] == inode) {
32 next
33 }
34}
35
36NR == lines && $0 == "+++ exited with 0 +++" {next}
Masatake YAMATO6077ad82014-12-24 20:59:32 +090037
38{
39 print "Line " NR " does not match: " $0
40 fail=1
41}
42
43END {
44 if (NR != lines) {
45 print "Expected " lines " lines, found " NR " line(s)."
46 print ""
47 exit 1
48 }
49 if (fail) {
50 print ""
51 exit 1
52 }
53}