Skip to content

Commit

Permalink
usb-nic: Improve interface start and ping default gateway
Browse files Browse the repository at this point in the history
Sometimes, it takes a lot of time to setup network interface. Timeout
for interface setup was increased. There was also added debug option
to display more details. There is no need for loop before ping,
network is already setup when is ifup done. Ping peer was changed to
gateway to fully validate network functionality.
  • Loading branch information
czerw authored and frankenmichl committed Apr 16, 2024
1 parent aad1705 commit 5bea16f
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions tests/kernel/usb_nic.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 5bea16f

Please sign in to comment.