From: <sk...@li...> - 2008-08-29 13:10:59
|
The coming patch stack fixes some of the testcases sent earlier on the list by Veerendra and adds new testcases for testing network namespace. The patches provides infrastructure for tcp testcass and add one testcase for ping command test. the series file is fix-libcrt.patch fix-file-test-error-in-parentns-script.patch add-ping-test-in-tcp-cmds.patch add-makefile-for-ping-testcase.patch add-makefile-in-tcp-dir.patch create-binary-for-testing-tcp-commands.patch add-runall-script-for-tcp-cmd-testcases.patch edit-Makefile-in-netns-directory-for-tcp-dir.patch add-tcp-run-in-runnetnstest.patch Please review them and provide your comments. -- Regards Sudhir Kumar Linux Technology Center IBM, India. |
From: <sk...@li...> - 2008-08-29 13:04:47
|
The coming patch stack fixes some of the testcases sent earlier on the list by Veerendra and adds new testcases for testing network namespace. The patches provides infrastructure for tcp testcass and add one testcase for ping command test. Content-Disposition: inline; filename=create-binary-for-testing-tcp-commands.patch This patch adds the binary to run all the tcp command testcase for the network namespace containers. The existing parent.sh script has been used for these tests as the script to be running in the parent namespace to avoid large code size. In case there is an exclusive requirement for communication among the child and parent you need to create a separate setup to run your test. Signed-off-by: Sudhir Kumar <sk...@li...> Index: containers/netns/test_tcp.c =================================================================== --- /dev/null +++ containers/netns/test_tcp.c @@ -0,0 +1,40 @@ +/************************************************************************* +* Copyright (c) International Business Machines Corp., 2008 +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See +* the GNU General Public License for more details. +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +* +***************************************************************************/ +/* ============================================================================ +* This testcase creates the child container to test the tcp command testcases +* inside the child namespace. The following program uses the library libclone +* api to create the Network namespace container and may be removed to use the +* containers management tools in future. +* +* The scripts parent.sh, runalltcpcmdtests.sh are passed as the parameters +* which will be running in the parent and child namespace respectively. +* Since these tests do not need anything to execute in parent namespace, we +* do not pass any script and just pass the NULL. +* +* Author: Sudhir Kumar <sk...@li...> 26/08/2008 +* ============================================================================*/ + + +#define NULL (void*)0 +extern int create_net_namespace(char *, char *); + +int main() +{ + int status; + status = create_net_namespace(NULL, "runalltcpcmdtests.sh"); + return status; +} -- Regards Sudhir Kumar Linux Technology Center IBM, India. |
From: <sk...@li...> - 2008-08-29 13:04:48
|
The coming patch stack fixes some of the testcases sent earlier on the list by Veerendra and adds new testcases for testing network namespace. The patches provides infrastructure for tcp testcass and add one testcase for ping command test. Content-Disposition: inline; filename=add-runall-script-for-tcp-cmd-testcases.patch This patch adds the script to run all the tcp command testcase for the network namespace containers. Other tcp command testcases can be run through this script by making the test entry as below. In case there is an exclusive requirement for communication among the child and parent you need to create a separate setup to run your test as the parent script for these testcases is as simple as possible. Signed-off-by: Sudhir Kumar <sk...@li...> Index: containers/netns/runalltcpcmdtests.sh =================================================================== --- /dev/null +++ containers/netns/runalltcpcmdtests.sh @@ -0,0 +1,48 @@ +#!/bin/bash +#*********************************************************************** +# +# Copyright (c) International Business Machines Corp., 2008 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See +# the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this pronram; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# Filename: runalltcpcmdtests.sh +# Purpose: runs all the testcases inside tcp directory +# +# Author: Sudhir Kumar <sk...@li...> +# Date: 25/08/08 +#*********************************************************************** + +export TCID="tcp_commands" +export TST_TOTAL=1 +export TST_COUNT=1 + +# Start execution of testcases +echo "********************************************" +tst_resm TINFO "Running all tcp commands testcases" +echo "********************************************" +tst_resm TINFO "Running ping testcase" + +ns_ping01.sh +if [ $? -ne 0 ]; then + tst_resm TFAIL "ping test failed"; +else + tst_resm TPASS "ping test passed"; +fi + +# Add other tcp testcases here + +tst_resm TINFO "All tcp commands testcases run complete" +echo "*************************************************" +exit 0; -- Regards Sudhir Kumar Linux Technology Center IBM, India. |
From: <sk...@li...> - 2008-08-29 13:04:49
|
The coming patch stack fixes some of the testcases sent earlier on the list by Veerendra and adds new testcases for testing network namespace. The patches provides infrastructure for tcp testcass and add one testcase for ping command test. Content-Disposition: inline; filename=add-tcp-run-in-runnetnstest.patch This patch edits the runnetnstest.sh script in the top directory for running all tcp command testcase for the network namespace. Signed-off-by: Sudhir Kumar <sk...@li...> Index: containers/netns/runnetnstest.sh =================================================================== --- containers.orig/netns/runnetnstest.sh +++ containers/netns/runnetnstest.sh @@ -77,6 +77,17 @@ else fi echo +test_tcp +rc=$? +if [ $rc -ne 0 ]; then + exit_code=$rc + errmesg="some of tcp commad testcases FAIL $exit_code ; " + echo $errmesg +else + echo "test_tcp: PASS" +fi +echo + par_chld_ftp rc=$? if [ $rc -ne 0 ]; then -- Regards Sudhir Kumar Linux Technology Center IBM, India. |
From: Sudhir K. <sk...@li...> - 2008-08-29 13:13:10
|
On Fri, Aug 29, 2008 at 04:35:37PM +0530, sk...@li... wrote: > The coming patch stack fixes some of the testcases sent earlier on the list by Veerendra > and adds new testcases for testing network namespace. The patches provides infrastructure > for tcp testcass and add one testcase for ping command test. > Content-Disposition: inline; filename=add-tcp-run-in-runnetnstest.patch > Seems something is screwed up in my uqilt mail setup. I see mbox contains these lines for all the patches, which should not be. Anyway it does not affect the purpose yet sorry for the extra lines. -- Regards Sudhir Kumar Linux Technology Center IBM, India. |
From: <sk...@li...> - 2008-08-29 13:04:50
|
The coming patch stack fixes some of the testcases sent earlier on the list by Veerendra and adds new testcases for testing network namespace. The patches provides infrastructure for tcp testcass and add one testcase for ping command test. Content-Disposition: inline; filename=fix-file-test-error-in-parentns-script.patch A file test on an unset vriable will give a pass, so the current test fails. (var scrpt may not have been set before calling :))This patch fixes that error. Signed-off-by: Sudhir Kumar <sk...@li...> Index: containers/libclone/libnetns.c Index: containers/netns/parentns.sh =================================================================== --- containers.orig/netns/parentns.sh +++ containers/netns/parentns.sh @@ -54,7 +54,7 @@ status=0 echo $vnet1 > /tmp/FIFO2 # Executes the script if it is passed as an argument. - if [ -f $scrpt ] ; then + if [ ! -z $scrpt ] && [ -f $scrpt ] ; then source $scrpt fi -- Regards Sudhir Kumar Linux Technology Center IBM, India. |
From: <sk...@li...> - 2008-08-29 13:04:50
|
The coming patch stack fixes some of the testcases sent earlier on the list by Veerendra and adds new testcases for testing network namespace. The patches provides infrastructure for tcp testcass and add one testcase for ping command test. Content-Disposition: inline; filename=add-makefile-for-ping-testcase.patch This patch adds the Makefile for ping command testcase for the network namespace. Signed-off-by: Sudhir Kumar <sk...@li...> Index: containers/netns/tcp/ping/Makefile =================================================================== --- /dev/null +++ containers/netns/tcp/ping/Makefile @@ -0,0 +1,32 @@ +#*********************************************************************** +# +# Copyright (c) International Business Machines Corp., 2008 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See +# the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this pronram; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# Filename: Makefile +# Purpose: make install for ping testfile +# +# Author: Sudhir Kumar <sk...@li...> +# Date: 25/08/08 +#*********************************************************************** + +all: + +install: + chmod +x ns_ping01.sh ; + ln -f ns_ping01.sh ../../../../../../testcases/bin + +clean: -- Regards Sudhir Kumar Linux Technology Center IBM, India. |
From: <sk...@li...> - 2008-08-29 13:04:52
|
The coming patch stack fixes some of the testcases sent earlier on the list by Veerendra and adds new testcases for testing network namespace. The patches provides infrastructure for tcp testcass and add one testcase for ping command test. Content-Disposition: inline; filename=add-makefile-in-tcp-dir.patch This patch adds the Makefile in the tcp directory for all tcp command testcase for the network namespace. Signed-off-by: Sudhir Kumar <sk...@li...> Index: containers/netns/tcp/Makefile =================================================================== --- /dev/null +++ containers/netns/tcp/Makefile @@ -0,0 +1,37 @@ +#*********************************************************************** +# +# Copyright (c) International Business Machines Corp., 2008 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See +# the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this pronram; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# Filename: Makefile +# Purpose: make support for all tcp testcases +# +# Author: Sudhir Kumar <sk...@li...> +# Date: 25/08/08 +#*********************************************************************** + +SUBDIRS = `ls */Makefile | sed "s/Makefile//g"` + +all: + @set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i ; done + +install: + @set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i install ; done + +clean: + @set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i clean ; done + + -- Regards Sudhir Kumar Linux Technology Center IBM, India. |
From: <sk...@li...> - 2008-08-29 13:07:18
|
The coming patch stack fixes some of the testcases sent earlier on the list by Veerendra and adds new testcases for testing network namespace. The patches provides infrastructure for tcp testcass and add one testcase for ping command test. Content-Disposition: inline; filename=fix-libcrt.patch This patch fixes errors in the library providing function for creating network namespace container. It also adds support for passing a NULL instead of an script to this function. This is helpful in case the test has nothing extra to execute in the parent namespcae. Signed-off-by: Sudhir Kumar <sk...@li...> Index: containers/libclone/libnetns.c =================================================================== --- containers.orig/libclone/libnetns.c +++ containers/libclone/libnetns.c @@ -44,7 +44,7 @@ extern pid_t getsid(pid_t pid); int crtchild(char *s1 , char *s2) { - char *cmd[] = { "/bin/bash", s1, s2, (char *)0 }; + char *cmd[] = { "--", s1, s2, (char *)0 }; execve("/bin/bash", cmd, __environ); printf("The code would not reach here on success\n"); perror("execve"); @@ -75,7 +75,13 @@ int create_net_namespace(char *p1, char par = malloc(len + 70); child = malloc(len + 70); - sprintf(par, "%s/testcases/kernel/containers/netns/parentns.sh %s" , ltproot, p1); + if (p1 == NULL) + sprintf(par, "%s/testcases/kernel/containers/netns/parentns.sh" , + ltproot); + else + sprintf(par, "%s/testcases/kernel/containers/netns/parentns.sh %s" , + ltproot, p1); + sprintf(child, "%s/testcases/kernel/containers/netns/childns.sh" , ltproot); if ((pid = fork()) == 0) { -- Regards Sudhir Kumar Linux Technology Center IBM, India. |
From: <sk...@li...> - 2008-08-29 13:08:28
|
The coming patch stack fixes some of the testcases sent earlier on the list by Veerendra and adds new testcases for testing network namespace. The patches provides infrastructure for tcp testcass and add one testcase for ping command test. Content-Disposition: inline; filename=edit-Makefile-in-netns-directory-for-tcp-dir.patch This patch edits the Makefile in the top directory for all tcp command testcase for the network namespace. Signed-off-by: Sudhir Kumar <sk...@li...> Index: containers/netns/Makefile =================================================================== --- containers.orig/netns/Makefile +++ containers/netns/Makefile @@ -21,6 +21,7 @@ CFLAGS += -Wall -g CPPFLAGS += -I../../../../include -I../libclone LDLIBS += -L../../../../lib -L../libclone ../libclone/libnetns.a -lltp +SUBDIRS=tcp SCRIPTS = initialize.sh parentns.sh childns.sh \ parent.sh child.sh \ parent_view.sh parent_share.sh child_propogate.sh \ @@ -28,7 +29,7 @@ parent_1.sh parent_2.sh child_1.sh child delchild.sh rename_net.sh \ paripv6.sh childipv6.sh \ par_ftp.sh ch_ftp.sh container_ftp.pl \ -runnetnstest.sh \ +runnetnstest.sh runalltcpcmdtests.sh SRCS = $(wildcard *.c) TARGETS = $(patsubst %.c,%,$(SRCS)) @@ -39,11 +40,14 @@ NOLTP_TARGETS = $(patsubst %.c,%_noltp,$ all: $(TARGETS) @chmod +x $(SCRIPTS) + @set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i ; done install: for i in $(TARGETS) $(SCRIPTS) runnetnstest.sh check_netns_enabled; do ln -f $$i ../../../bin/$$i ; chmod +x runnetnstest.sh ; done + @set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i install ; done noltp: $(NOLTP_TARGETS) clean: rm -f $(TARGETS) *.o $(NOLTP_TARGETS) + @set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i clean ; done -- Regards Sudhir Kumar Linux Technology Center IBM, India. |
From: <sk...@li...> - 2008-08-29 13:09:46
|
The coming patch stack fixes some of the testcases sent earlier on the list by Veerendra and adds new testcases for testing network namespace. The patches provides infrastructure for tcp testcass and add one testcase for ping command test. Content-Disposition: inline; filename=add-ping-test-in-tcp-cmds.patch This patch adds the ping command testcase for the network namespace containers. The patch applies on top of the patchset sent for other netns testcases. Original copyright and history included. Signed-off-by: Sudhir Kumar <sk...@li...> Index: containers/netns/tcp/ping/ns_ping01.sh =================================================================== --- /dev/null +++ containers/netns/tcp/ping/ns_ping01.sh @@ -0,0 +1,106 @@ +#! /bin/sh +#*********************************************************************** +# +# Copyright (c) International Business Machines Corp., 2008 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See +# the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this pronram; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# +# +# FILE : ping +# +# PURPOSE: To test the basic functionality of the `ping` command. +# +# SETUP: Assumes the child namespcae veth device address is defined in file +# initialize.sh as IP1 +# +# HISTORY: +# 06/06/03 Manoj Iyer ma...@ma... +# - Modified testcase to use test APIs and also fixed minor bugs +# 03/01 Robbie Williamson (ro...@us...) +# -Ported +# 21/08/08 Sudhir Kumar <sk...@li...> +# - Modified the testcase for testing into the containers environment +# +# +#*********************************************************************** +# Uncomment line below for debug output +#trace_logic=${trace_logic:-"set -x"} +$trace_logic + +source initialize.sh ; +TC=ping + +RHOST=$IP1 +COUNT=${COUNT:-2} +SLEEPTIME=${SLEEPTIME:-0} +PACKETSIZES=${PACKETSIZES:-"8 16 32 64 128 256 512 1024 2048 4064"} + +# FUNCTION: exists +# Checks whether a command exist on system or not +exists() +{ + for cmd in $1 + do + which $cmd 2>&1 1>/dev/null + if [ $? -ne 0 ] ;then + tst_resm TBROK "Test broke: command $cmd not found" + exit 1 + fi + done +} + + +# FUNCTION: run_test +# PURPOSE: Executes the testcases. + +run_test() +{ + $trace_logic + tst_resm TINFO "ping with different size ICMP packets" + for packetsize in $PACKETSIZES + do + tst_resm TINFO "calling ping with packet size = $packetsize" + ping -R -c $COUNT -s $packetsize $RHOST 2>&1 1>/dev/null + [ $? -eq 0 ] || end_test "failed: ping -c $COUNT + -s $packetsize $RHOST" + sleep $SLEEPTIME + done +} + +# FUNCTION NAME: end_test (does cleanup) +# PARAMETERS: pass string to be printed if the testcase fails + +end_test() +{ + $trace_logic + + if [ $# -eq 0 ]; then + tst_resm TPASS "Test Successful"; + exit 0; + else + tst_resm TFAIL "Test Failed: $@" + exit 1 + fi +} + +# FUNCTION: MAIN + +export TCID="ping01" +export TST_TOTAL=1 +export TST_COUNT=1 +exists "ping" +run_test +end_test -- Regards Sudhir Kumar Linux Technology Center IBM, India. |