All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [RFC PATCH v8 09/11] network/stress: Further enhancements for route4-rmmod
Date: Fri, 18 Aug 2017 18:44:35 +0200	[thread overview]
Message-ID: <20170818164437.13556-10-pvorel@suse.cz> (raw)
In-Reply-To: <20170818164437.13556-1-pvorel@suse.cz>

* Remove dependency to ifconfig.
* Use TCONF when test would break other interface.
* Raise TCONF only if the other device is in different than 'down' mode.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/network/stress/route/route4-rmmod | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/testcases/network/stress/route/route4-rmmod b/testcases/network/stress/route/route4-rmmod
index 9c1eade81..8cba6a9c1 100644
--- a/testcases/network/stress/route/route4-rmmod
+++ b/testcases/network/stress/route/route4-rmmod
@@ -41,20 +41,24 @@ do_setup()
 
 	route_setup
 
+	# NOTE: we have to use ethtool as
+	# /sys/class/net/<iface>/device/driver/module doesn't exist
+	# for virtual drivers (e.g. veth)
 	tst_check_cmds ethtool
 
 	tst_add_ipaddr_stress
 
 	# module driver of tested interface
 	MODULE="$(ethtool -i $(tst_iface) | grep driver | sed 's/driver:[[:blank:]]*//')"
+	[ -z "$MODULE" ] && tst_resm TBROK "module for interface '$(tst_iface)' not found"
 
 	# Check the other active interface uses the same driver
-	for ifname in $(ifconfig | grep ^eth | awk '{ print $1}'); do
+	for ifname in $(basename -a /sys/class/net/*); do
 		[ "$(tst_iface)" = "$ifname" ] && continue
 		[ "$ifname" = 'lo' ] && continue
 
 		module="$(ethtool -i $ifname | grep driver | sed 's/driver:[[:blank:]]*//')"
-		[ "$module" = "$MODULE" ] && \
+		[ "$module" = "$MODULE" -a "$(cat /sys/class/net/$ifname/operstate)" != "down" ] && \
 			tst_brkm TCONF "an active interface '$ifname' uses the same network driver '$MODULE' with the test interface '$(tst_iface)'"
 	done
 }
-- 
2.13.2


  parent reply	other threads:[~2017-08-18 16:44 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-18 16:44 [LTP] [RFC PATCH v8 00/11] Simplify network setup + fix some network stress tests Petr Vorel
2017-08-18 16:44 ` [LTP] [RFC PATCH v8 01/11] lib/test_net.sh: Add unused IP address helper functions Petr Vorel
2017-08-21 13:31   ` Alexey Kodanev
2017-08-22 17:18     ` Petr Vorel
2017-08-23  9:12       ` Alexey Kodanev
2017-08-18 16:44 ` [LTP] [RFC PATCH v8 02/11] network/stress: Add library helper for stress testing Petr Vorel
2017-08-18 16:44 ` [LTP] [RFC PATCH v8 03/11] network/stress: Simplify make_background_tcp_traffic usage Petr Vorel
2017-08-18 16:44 ` [LTP] [RFC PATCH v8 04/11] network/stress: Reduce the default number of cycles for various tests Petr Vorel
2017-08-18 16:44 ` [LTP] [RFC PATCH v8 05/11] lib/test_net.sh: tst_rhost_run: Add testcases/bin into PATH for SSH/RSH Petr Vorel
2017-08-21 13:42   ` Alexey Kodanev
2017-08-22 17:21     ` Petr Vorel
2017-08-18 16:44 ` [LTP] [RFC PATCH v8 06/11] network/stress: Fix and cleanup part of multicast IPv4 tests Petr Vorel
2017-08-21 13:52   ` Alexey Kodanev
2017-08-18 16:44 ` [LTP] [RFC PATCH v8 07/11] lib/test_net.sh: Add function reset_ltp_netspace() Petr Vorel
2017-08-21 15:31   ` Alexey Kodanev
2017-08-22 20:13     ` Petr Vorel
2017-08-23  9:39       ` Alexey Kodanev
2017-08-23 10:21         ` Petr Vorel
2017-08-18 16:44 ` [LTP] [RFC PATCH v8 08/11] network/stress: Fix and cleanup route IPv4 tests Petr Vorel
2017-08-22 11:46   ` Alexey Kodanev
2017-08-22 21:22     ` Petr Vorel
2017-08-23 13:17       ` Alexey Kodanev
2017-08-23 13:49         ` Petr Vorel
2017-08-23 13:34       ` Petr Vorel
2017-08-23 13:38         ` Alexey Kodanev
2017-08-23 13:57       ` Petr Vorel
2017-08-18 16:44 ` Petr Vorel [this message]
2017-08-18 16:44 ` [LTP] [RFC PATCH v8 10/11] network: Add tools for setup IP related environment variables Petr Vorel
2017-08-21  6:10   ` Petr Vorel
2017-08-22 12:23   ` Alexey Kodanev
2017-08-23 10:46     ` Petr Vorel
2017-08-18 16:44 ` [LTP] [RFC PATCH v8 11/11] network: Use tools to set up IPv4 and IPv6 related variables Petr Vorel
2017-08-22 12:49   ` Alexey Kodanev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170818164437.13556-10-pvorel@suse.cz \
    --to=pvorel@suse.cz \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.