From patchwork Mon May 14 10:37:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Smorodskyi X-Patchwork-Id: 912845 X-Patchwork-Delegate: petr.vorel@gmail.com 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=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.com Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40kxwc1kHPz9s0q for ; Mon, 14 May 2018 20:37:35 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id B45D71A95CC for ; Mon, 14 May 2018 12:37:32 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [IPv6:2001:4b78:1:20::5]) by picard.linux.it (Postfix) with ESMTP id BB4F83E602A for ; Mon, 14 May 2018 12:37:30 +0200 (CEST) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by in-5.smtp.seeweb.it (Postfix) with ESMTPS id A09B2600C2F for ; Mon, 14 May 2018 12:37:27 +0200 (CEST) Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id D313FAB37 for ; Mon, 14 May 2018 10:37:26 +0000 (UTC) From: Anton Smorodskyi To: ltp@lists.linux.it Date: Mon, 14 May 2018 12:37:09 +0200 Message-Id: <20180514103709.4632-1-asmorodskyi@suse.com> X-Mailer: git-send-email 2.13.6 X-Virus-Scanned: clamav-milter 0.99.2 at in-5.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=-0.0 required=7.0 tests=SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-5.smtp.seeweb.it Cc: Anton Smorodskyi Subject: [LTP] [PATCH 1/1] ipneigh : Use new API 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" Besides all obvious changes for moving to new API, also was done : 1. more generic variable names 2. add check for del command failure --- testcases/network/tcp_cmds/ipneigh/ipneigh01.sh | 64 ++++++++++++------------- 1 file changed, 31 insertions(+), 33 deletions(-) diff --git a/testcases/network/tcp_cmds/ipneigh/ipneigh01.sh b/testcases/network/tcp_cmds/ipneigh/ipneigh01.sh index 9af3aa31e..da4c07402 100755 --- a/testcases/network/tcp_cmds/ipneigh/ipneigh01.sh +++ b/testcases/network/tcp_cmds/ipneigh/ipneigh01.sh @@ -1,4 +1,5 @@ #!/bin/sh +# Copyright (c) 2018 SUSE Linux GmbH # Copyright (c) 2016 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 @@ -18,8 +19,8 @@ TCID=ipneigh01 NUMLOOPS=${NUMLOOPS:-50} -TST_TOTAL=2 -TST_USE_LEGACY_API=1 +TST_TESTFUNC=do_test +TST_CNT=2 . tst_net.sh do_setup() @@ -30,55 +31,52 @@ do_setup() do_test() { - local arp_show_cmd="$1" - local arp_del_cmd="$2" + local rhost=$(tst_ipaddr rhost) + case $1 in + 1) + local show_cmd="ip neigh show" + local del_cmd="ip neigh del $rhost dev $(tst_iface)" + ;; + 2) + if [ -n "$TST_IPV6" ] then + tst_res TCONF "'arp cmd doesn't support IPv6, skipping test-case" + fi + local show_cmd="arp -a" + local del_cmd="arp -d $rhost" + ;; + esac local entry_name [ "$TST_IPV6" ] && entry_name="NDISC" || entry_name="ARP" - tst_resm TINFO "Stress auto-creation of $entry_name cache entry" - tst_resm TINFO "by pinging '$rhost' and deleting entry again" - tst_resm TINFO "with '$arp_del_cmd'" + tst_res TINFO "Stress auto-creation of $entry_name cache entry" + tst_res TINFO "by pinging '$rhost' and deleting entry again" + tst_res TINFO "with '$del_cmd'" for i in $(seq 1 $NUMLOOPS); do ping$TST_IPV6 -q -c1 $rhost > /dev/null local k - local ret=1 - # wait for arp entry at least 3 seconds for k in $(seq 1 30); do - $arp_show_cmd | grep -q $rhost - if [ $? -eq 0 ]; then - ret=0 - break; + $show_cmd | grep -q $rhost + if [ $? -ne 0 ]; then + tst_brk TFAIL "$entry_name entry '$rhost' not listed" fi tst_sleep 100ms done - [ "$ret" -ne 0 ] && \ - tst_brkm TFAIL "$entry_name entry '$rhost' not listed" + $del_cmd + if [ $? -ne 0 ]; then + tst_brk TFAIL "fail to delete entry" + fi - $arp_del_cmd - - $arp_show_cmd | grep -q "${rhost}.*$(tst_hwaddr rhost)" && \ - tst_brkm TFAIL "'$arp_del_cmd' failed, entry has " \ + $show_cmd | grep -q "${rhost}.*$(tst_hwaddr rhost)" && \ + tst_brk TFAIL "'$del_cmd' failed, entry has " \ "$(tst_hwaddr rhost)' $i/$NUMLOOPS" done - tst_resm TPASS "verified adding/removing of $entry_name cache entry" + tst_res TPASS "verified adding/removing of $entry_name cache entry" } -do_setup - -rhost=$(tst_ipaddr rhost) - -if [ -z "$TST_IPV6" ]; then - do_test "arp -a" "arp -d $rhost" -else - tst_resm TCONF "'arp cmd doesn't support IPv6, skipping test-case" -fi - -do_test "ip neigh show" "ip neigh del $rhost dev $(tst_iface)" - -tst_exit +tst_run \ No newline at end of file