On Wed, Jun 22, 2016 at 01:27:05PM +0000, Fabien Siron wrote: > * tests/netlink_parsing.test: New test. > * tests/netlink_parsing.c: New file. > * tests/.gitignore: Add netlink_parsing. > * tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add netlink_parsing.test. > diff --git a/tests/netlink_parsing.c b/tests/netlink_parsing.c > new file mode 100644 > index 0000000..3e7c983 > --- /dev/null > +++ b/tests/netlink_parsing.c > @@ -0,0 +1,119 @@ > +/* It won't harm to add a comment line here too, e.g. "Check decoding of netlink protocol." > +#include "tests.h" > +#include <errno.h> errno.h seems to be unused in this file. > diff --git a/tests/netlink_parsing.test b/tests/netlink_parsing.test > new file mode 100755 > index 0000000..c8313d1 > --- /dev/null > +++ b/tests/netlink_parsing.test > @@ -0,0 +1,43 @@ > +#!/bin/sh > +# > +# Check decoding of Netlink parsing. Check decoding of netlink protocol. I wonder whether netlink_protocol would be a better name for this test. > +# > +# Copyright (c) 2014 Masatake YAMATO <yam...@redhat.com> > +# Copyright (c) 2014-2016 Dmitry V. Levin <l...@altlinux.org> > +# Copyright (c) 2016 Fabien Siron <fabien.si...@epita.fr> > +# All rights reserved. > +# > +# Redistribution and use in source and binary forms, with or without > +# modification, are permitted provided that the following conditions > +# are met: > +# 1. Redistributions of source code must retain the above copyright > +# notice, this list of conditions and the following disclaimer. > +# 2. Redistributions in binary form must reproduce the above copyright > +# notice, this list of conditions and the following disclaimer in the > +# documentation and/or other materials provided with the distribution. > +# 3. The name of the author may not be used to endorse or promote products > +# derived from this software without specific prior written permission. > +# > +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR > +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES > +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. > +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, > +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT > +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, > +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY > +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT > +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF > +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > + > +. "${srcdir=.}/init.sh" > + > +check_prog sed > + > +run_prog "./$NAME" > /dev/null > + > +run_strace -a22 -v -eclose,network $args > "$EXP" > +# Filter out close() calls made by ld.so and libc. > +sed -n '/socket/,$p' < "$LOG" > "$OUT" > + > +match_diff "$OUT" "$EXP" > +rm -f "$EXP" "$OUT" As the test doesn't check decoding of close syscall, the test driver could be simplified further, e.g. . "${srcdir=.}/init.sh" # getfdproto is implemented using /proc/self/fd [ -d /proc/self/fd/ ] || framework_skip_ '/proc/self/fd/ is not available' run_strace_match_diff -e trace=network -- ldv
pgp91foqRMwYW.pgp
Description: PGP signature
------------------------------------------------------------------------------ Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San Francisco, CA to explore cutting-edge tech and listen to tech luminaries present their vision of the future. This family event has something for everyone, including kids. Get more information and register today. http://sdm.link/attshape
_______________________________________________ Strace-devel mailing list Strace-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/strace-devel