From patchwork Wed Apr 17 11:47:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kodanev X-Patchwork-Id: 1086924 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.b="l0fch0Gy"; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44kgTF14JRz9s4V for ; Wed, 17 Apr 2019 21:47:29 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id A9E70294AA1 for ; Wed, 17 Apr 2019 13:47:26 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [217.194.8.4]) by picard.linux.it (Postfix) with ESMTP id 450C13EB010 for ; Wed, 17 Apr 2019 13:47:25 +0200 (CEST) Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-4.smtp.seeweb.it (Postfix) with ESMTPS id 06A0E1001757 for ; Wed, 17 Apr 2019 13:47:21 +0200 (CEST) Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x3HBjKTv182695 for ; Wed, 17 Apr 2019 11:47:22 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=BWkjpzYII2WrvpDfgSdUmT+1qDzGcTb4F0zzdkP5TJo=; b=l0fch0GyH1YKjErPdW8NEE7gnGG7mz1o+6jfSSFYYu46jUr+WFlIZGdapmp9k3PhKZps 0LCctnf3kbBZsVyZyFNwbGd/c1Oqhfn9l5ohv8NoDhg6r6aAYvXYoVujo3KM9fqjF9FC U1SI1LLiuWfbv5D/uEly3X2JgFHXEihOLODjHp/MAwYOkeNjSu52eieluBGUkA65hII8 Jkr7WGp0qKfVojw80nd4jEGVS3s6ODo+N69IluSG03n2WbL/BkQX4+snnP1LhSIBWu70 PAWrjcJ9qdl2LNjYebxBt9yoCn9kY4cpOZgdGg7oPRYkLT2sxTXUM3tnrI37ZqPpiXdr 0w== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 2rusnf0bja-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 17 Apr 2019 11:47:22 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x3HBiP9E147151 for ; Wed, 17 Apr 2019 11:45:22 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3020.oracle.com with ESMTP id 2rubq6vxwp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 17 Apr 2019 11:45:21 +0000 Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x3HBjLbK021615 for ; Wed, 17 Apr 2019 11:45:21 GMT Received: from ak.ru.oracle.com (/10.162.80.29) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 17 Apr 2019 04:45:21 -0700 From: Alexey Kodanev To: ltp@lists.linux.it Date: Wed, 17 Apr 2019 14:47:30 +0300 Message-Id: <1555501650-16626-3-git-send-email-alexey.kodanev@oracle.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1555501650-16626-1-git-send-email-alexey.kodanev@oracle.com> References: <1555501650-16626-1-git-send-email-alexey.kodanev@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9229 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904170082 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9229 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904170083 X-Virus-Scanned: clamav-milter 0.99.2 at in-4.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, SPF_HELO_PASS, SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-4.smtp.seeweb.it Subject: [LTP] [PATCH 3/3][COMMITTED] network/ping{01|02}: convert to new API with improvements X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.18 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" * Use SPDX-License-Identifier. * Make the variables in the for loop to be local. * ping01: set minimum possible interval without super user privileges: test time decreased from 20 seconds to 4 seconds. * ping02: test uses flood ping with zero interval, so add "needs root". Signed-off-by: Alexey Kodanev --- testcases/network/tcp_cmds/ping/Makefile | 21 +-------------- testcases/network/tcp_cmds/ping/ping01.sh | 34 +++++++----------------- testcases/network/tcp_cmds/ping/ping02.sh | 39 +++++++++------------------- 3 files changed, 25 insertions(+), 69 deletions(-) diff --git a/testcases/network/tcp_cmds/ping/Makefile b/testcases/network/tcp_cmds/ping/Makefile index 703f8ce..f8293e5 100644 --- a/testcases/network/tcp_cmds/ping/Makefile +++ b/testcases/network/tcp_cmds/ping/Makefile @@ -1,24 +1,7 @@ -# -# network/tcp_cmds/ping testcases Makefile. -# -# Copyright (C) 2009, Cisco Systems Inc. -# -# 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., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009, Cisco Systems Inc. # # Ngie Cooper, July 2009 -# top_srcdir ?= ../../../.. diff --git a/testcases/network/tcp_cmds/ping/ping01.sh b/testcases/network/tcp_cmds/ping/ping01.sh index e127481..916f057 100755 --- a/testcases/network/tcp_cmds/ping/ping01.sh +++ b/testcases/network/tcp_cmds/ping/ping01.sh @@ -1,20 +1,8 @@ #! /bin/sh -# Copyright (c) 2014-2016 Oracle and/or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2014-2019 Oracle and/or its affiliates. All Rights Reserved. # Copyright (c) International Business Machines Corp., 2000 # -# 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 would 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, see . -# # PURPOSE: To test the basic functionality of the `ping` command. # # SETUP: If "RHOST" is not exported, then the local hostname is used. @@ -25,10 +13,9 @@ # 03/01 Robbie Williamson (robbiew@us.ibm.com) # -Ported -TST_TOTAL=10 -TCID="ping01" +TST_SETUP="do_setup" +TST_TESTFUNC="do_test" -TST_USE_LEGACY_API=1 . tst_net.sh do_setup() @@ -43,14 +30,13 @@ do_setup() do_test() { - tst_resm TINFO "$PING_CMD with $PACKETSIZES ICMP packets" + tst_res TINFO "$PING_CMD with $PACKETSIZES ICMP packets" local ipaddr=$(tst_ipaddr rhost) - for packetsize in $PACKETSIZES; do - EXPECT_PASS $PING_CMD -c $COUNT -s $packetsize $ipaddr \>/dev/null + local s + + for s in $PACKETSIZES; do + EXPECT_PASS $PING_CMD -i 0.2 -c $COUNT -s $s $ipaddr \>/dev/null done } -do_setup -do_test - -tst_exit +tst_run diff --git a/testcases/network/tcp_cmds/ping/ping02.sh b/testcases/network/tcp_cmds/ping/ping02.sh index 04069f2..b245210 100755 --- a/testcases/network/tcp_cmds/ping/ping02.sh +++ b/testcases/network/tcp_cmds/ping/ping02.sh @@ -1,23 +1,11 @@ #! /bin/sh -# Copyright (c) 2016 Oracle and/or its affiliates. All Rights Reserved. -# -# 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 would 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, see . - -TST_TOTAL=10 -TCID="ping02" - -TST_USE_LEGACY_API=1 +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2016-2019 Oracle and/or its affiliates. All Rights Reserved. + +TST_SETUP="do_setup" +TST_TESTFUNC="do_test" +TST_NEEDS_ROOT=1 + . tst_net.sh do_setup() @@ -34,15 +22,14 @@ do_test() { local pat="000102030405060708090a0b0c0d0e0f" - tst_resm TINFO "flood $PING: ICMP packets filled with pattern '$pat'" + tst_res TINFO "flood $PING: ICMP packets filled with pattern '$pat'" local ipaddr=$(tst_ipaddr rhost) - for psize in $PACKETSIZES; do - EXPECT_PASS $PING -c $COUNT -f -s $psize $ipaddr -p "$pat" \>/dev/null + local s + + for s in $PACKETSIZES; do + EXPECT_PASS $PING -c $COUNT -f -s $s $ipaddr -p "$pat" \>/dev/null done } -do_setup -do_test - -tst_exit +tst_run