blob: 640b47752839052e388026b1a64cee1d467df1e1 [file] [log] [blame]
Masatake YAMATO6077ad82014-12-24 20:59:32 +09001#!/bin/sh
2
3# Check decoding of address information (inode[->peer][,path])
4# associated with unix domain socket descriptors.
5
6. "${srcdir=.}/init.sh"
7
8# strace -yy is implemented using /proc/self/fd
9[ -d /proc/self/fd/ ] ||
10 framework_skip_ '/proc/self/fd/ is not available'
11
Masatake YAMATO6077ad82014-12-24 20:59:32 +090012check_prog sed
13
Dmitry V. Levin8f546642015-03-17 17:07:57 +000014run_prog ./netlink_unix_diag
Dmitry V. Levinc9cc4cb2015-01-07 20:14:19 +000015addr=unix-yy-local-stream
Dmitry V. Levin8f546642015-03-17 17:07:57 +000016run_prog ./net-accept-connect $addr
17run_strace_merge -yy -eclose,network $args
Masatake YAMATO6077ad82014-12-24 20:59:32 +090018
Dmitry V. Levin8f546642015-03-17 17:07:57 +000019child="$(sed -rn '/SIGCHLD/ s/^.*, si_pid=([1-9][0-9]*), .*/\1/p' "$LOG")"
20[ -n "$child" ] ||
21 dump_log_and_fail_with 'failed to find pid of child process'
Masatake YAMATO6077ad82014-12-24 20:59:32 +090022
Dmitry V. Levin8f546642015-03-17 17:07:57 +000023rm -f "$LOG"-*
24sed -rn "/^$child"' /!d; / socket\(/,$ s/^[0-9]+ +[^ ]+ (.+)/\1/p' "$LOG" > "$LOG"-connect &&
25sed -rn "/^$child"' /d; /SIGCHLD/d; / socket\(/,$ s/^[0-9]+ +[^ ]+ (.+)/\1/p' "$LOG" > "$LOG"-accept ||
26 dump_log_and_fail_with 'failed to separate logs'
Masatake YAMATO6077ad82014-12-24 20:59:32 +090027
Dmitry V. Levin8f546642015-03-17 17:07:57 +000028match_awk "$LOG-connect" "$srcdir"/unix-yy-connect.awk "$STRACE $args connect output mismatch" -v addr=$addr
29match_awk "$LOG-accept" "$srcdir"/unix-yy-accept.awk "$STRACE $args accept output mismatch" -v addr=$addr
Masatake YAMATO6077ad82014-12-24 20:59:32 +090030
31exit 0