Dmitry V. Levin
3ec5c0492c
* tests/init.sh: Check for cat and rm. * tests/getdents.test: Check for awk. * tests/ptrace_setoptions.test: Check for grep. * tests/net-fd.test: Do not check for rm. * tests/net.test: Likewise. * tests/scm_rights-fd.test: Likewise. * tests/stat.test: Likewise. * tests/uio.test: Likewise.
60 lines
1.4 KiB
Bash
Executable File
60 lines
1.4 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# Check decoding of ip:port pairs associated with socket descriptors
|
|
|
|
. "${srcdir=.}/init.sh"
|
|
|
|
# strace -yy is implemented using /proc/self/fd
|
|
[ -d /proc/self/fd/ ] ||
|
|
framework_skip_ '/proc/self/fd/ is not available'
|
|
|
|
check_prog awk
|
|
check_prog sed
|
|
|
|
rm -f $LOG.* $LOG-*
|
|
|
|
./inet-accept-connect-send-recv ||
|
|
fail_ 'inet-accept-connect-send-recv failed'
|
|
|
|
./netlink_inet_diag || {
|
|
if [ $? -eq 77 ]; then
|
|
framework_skip_ 'NETLINK_INET_DIAG is not available'
|
|
else
|
|
fail_ 'netlink_inet_diag failed'
|
|
fi
|
|
}
|
|
|
|
args="-tt -ff -yy -o $LOG -eclose,network ./inet-accept-connect-send-recv"
|
|
$STRACE $args ||
|
|
fail_ "strace $args failed"
|
|
|
|
"$srcdir"/../strace-log-merge $LOG > $LOG || {
|
|
cat $LOG
|
|
fail_ 'strace-log-merge failed'
|
|
}
|
|
rm -f $LOG.*
|
|
|
|
child="$(sed -rn '/SIGCHLD/ s/^.*, si_pid=([1-9][0-9]*), .*/\1/p' $LOG)"
|
|
[ -n "$child" ] || {
|
|
cat $LOG
|
|
fail_ 'failed to find pid of child process'
|
|
}
|
|
|
|
sed -rn "/^$child"' /!d; / socket\(/,$ s/^[0-9]+ +[^ ]+ (.+)/\1/p' $LOG > $LOG-connect &&
|
|
sed -rn "/^$child"' /d; /SIGCHLD/d; / socket\(/,$ s/^[0-9]+ +[^ ]+ (.+)/\1/p' $LOG > $LOG-accept || {
|
|
cat $LOG
|
|
fail_ 'failed to separate logs'
|
|
}
|
|
|
|
awk -f "$srcdir"/net-yy-connect.awk $LOG-connect || {
|
|
cat $LOG-connect
|
|
fail_ "strace $args failed to decode socket descriptors properly"
|
|
}
|
|
|
|
awk -f "$srcdir"/net-yy-accept.awk $LOG-accept || {
|
|
cat $LOG-accept
|
|
fail_ "strace $args failed to decode socket descriptors properly"
|
|
}
|
|
|
|
exit 0
|