diff --git a/tests/kernel/usb_nic.pm b/tests/kernel/usb_nic.pm index ab069e953d37..832f481553dc 100644 --- a/tests/kernel/usb_nic.pm +++ b/tests/kernel/usb_nic.pm @@ -24,15 +24,11 @@ sub run { assert_script_run "echo \"BOOTPROTO='dhcp'\" > /etc/sysconfig/network/ifcfg-$interface"; assert_script_run "echo \"STARTMODE='auto'\" >> /etc/sysconfig/network/ifcfg-$interface"; - assert_script_run "ifup $interface"; + assert_script_run("ifup $interface -o debug", 60); - # wait until interface is up - my $timeout = 20; - ($timeout-- && sleep 5) while (script_run "ip -4 addr show $interface | grep inet" && $timeout); - - my $ping_peer = script_output "ip route show dev $interface | cut -d ' ' -f 7"; - assert_script_run "ping -I $interface -c 4 $ping_peer"; - assert_script_run "ifdown $interface"; + my $route = script_output "ip route show default"; + my @ping_peer = $route =~ /default via (\S+)/; + assert_script_run "ping -I $interface -c 4 @ping_peer"; } sub test_flags {