Return-path: Received: from mail-wi0-f180.google.com ([209.85.212.180]:60136 "EHLO mail-wi0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933880Ab3CSWOH (ORCPT ); Tue, 19 Mar 2013 18:14:07 -0400 MIME-Version: 1.0 In-Reply-To: <20130319.145258.1891905092469394685.davem@davemloft.net> References: <20130319.145258.1891905092469394685.davem@davemloft.net> Date: Wed, 20 Mar 2013 00:14:05 +0200 Message-ID: (sfid-20130319_231416_756473_A2E5DAB3) Subject: Re: [PATCH] net: Add socket() system call self test. From: Daniel Baluta To: David Miller Cc: netdev@vger.kernel.org, netfilter-devel@vger.kernel.org, linux-wireless@vger.kernel.org Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-wireless-owner@vger.kernel.org List-ID: Hi David, On Tue, Mar 19, 2013 at 8:52 PM, David Miller wrote: > > Signed-off-by: David S. Miller > --- > > As mentioned during the netfilter workshop, we will be adding > all sorts of networking tests now that 3.9.x has a selftest > framework in place. > > The first test I'm adding to net-next does some very simple > testing of the socket() system call. > > Feel free to send patches for more tests, making the run > script more powerful (perhaps by taking a whitespace > seperated list of tests to run on the command line), and > adding more checks to the socket.c test. > > Thanks. > > tools/testing/selftests/Makefile | 1 + > tools/testing/selftests/net-socket/Makefile | 16 ++++ > .../testing/selftests/net-socket/run_netsocktests | 12 +++ > tools/testing/selftests/net-socket/socket.c | 92 ++++++++++++++++++++++ > 4 files changed, 121 insertions(+) > create mode 100644 tools/testing/selftests/net-socket/Makefile > create mode 100644 tools/testing/selftests/net-socket/run_netsocktests > create mode 100644 tools/testing/selftests/net-socket/socket.c > > diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile > index 3cc0ad7..7c6280f 100644 > --- a/tools/testing/selftests/Makefile > +++ b/tools/testing/selftests/Makefile > @@ -5,6 +5,7 @@ TARGETS += vm > TARGETS += cpu-hotplug > TARGETS += memory-hotplug > TARGETS += efivarfs > +TARGETS += net-socket > > all: > for TARGET in $(TARGETS); do \ > diff --git a/tools/testing/selftests/net-socket/Makefile b/tools/testing/selftests/net-socket/Makefile > new file mode 100644 > index 0000000..f27ee10 > --- /dev/null > +++ b/tools/testing/selftests/net-socket/Makefile > @@ -0,0 +1,16 @@ > +# Makefile for net-socket selftests > + > +CC = $(CROSS_COMPILE)gcc > +CFLAGS = -Wall > + > +NET_SOCK_PROGS = socket > + > +all: $(NET_SOCK_PROGS) > +%: %.c > + $(CC) $(CFLAGS) -o $@ $^ > + > +run_tests: all > + @/bin/sh ./run_netsocktests || echo "vmtests: [FAIL]" > + > +clean: > + $(RM) $(NET_SOCK_PROGS) > diff --git a/tools/testing/selftests/net-socket/run_netsocktests b/tools/testing/selftests/net-socket/run_netsocktests I think it's better to have a selftests/net directory dedicated for networking tests. Over time the number of net-{x} directories may become very large. Daniel.