Skip to contentSkip to conversation

network: portability: using tst_sleep instead of usleep

PATCH New Petr Vorel 2 participants 2 messages Nov 8, 2016 – Nov 9, 2016

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

PATCH 1/1 network: portability: using tst_sleep instead of usleep

---
 testcases/network/dhcp/dhcp_lib.sh              | 4 ++--
 testcases/network/tcp_cmds/ipneigh/ipneigh01.sh | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
testcases/network/dhcp/dhcp_lib.sh +2 -2
index 140619d..85f9b88 100755
@@ -26,12 +26,12 @@ stop_dhcp()
 	while [ $count -le 10 ]; do
 		pkill -x $dhcp_name
 		[ "$(pgrep -x $dhcp_name)" ] || return 0
-		usleep 100000
+		tst_sleep 100ms
 		count=$((count + 1))
 	done
 
 	pkill -9 -x $dhcp_name
-	usleep 100000
+	tst_sleep 100ms
 	[ "$(pgrep -x $dhcp_name)" ] && return 1 || return 0
 }
 
testcases/network/tcp_cmds/ipneigh/ipneigh01.sh +1 -1
index 736d149..31d6cc6 100755
@@ -52,7 +52,7 @@ do_test()
 				ret=0
 				break;
 			fi
-			usleep 100
+			tst_sleep 100us
 		done
 
 		[ "$ret" -ne 0 ] && \
Signature · 1 line
2.10.2
#1 lore raw

PATCH 1/1 network: portability: using tst_sleep instead of usleep

Hi,

Quoted 30 lines · Petr Vorel
---
  testcases/network/dhcp/dhcp_lib.sh              | 4 ++--
  testcases/network/tcp_cmds/ipneigh/ipneigh01.sh | 2 +-
  2 files changed, 3 insertions(+), 3 deletions(-)
testcases/network/dhcp/dhcp_lib.sh +2 -2
index 140619d..85f9b88 100755
@@ -26,12 +26,12 @@ stop_dhcp()
  	while [ $count -le 10 ]; do
  		pkill -x $dhcp_name
  		[ "$(pgrep -x $dhcp_name)" ] || return 0
-		usleep 100000
+		tst_sleep 100ms
  		count=$((count + 1))
  	done
 
  	pkill -9 -x $dhcp_name
-	usleep 100000
+	tst_sleep 100ms
  	[ "$(pgrep -x $dhcp_name)" ] && return 1 || return 0
  }
 
testcases/network/tcp_cmds/ipneigh/ipneigh01.sh +0 -0
index 736d149..31d6cc6 100755

testcases/network/tcp_cmds/ipneigh/ipneigh01.sh do_test() · line 55

Quoted 5 lines
testcases/network/tcp_cmds/ipneigh/ipneigh01.sh +1 -1
@@ -52,7 +52,7 @@ do_test()
  				ret=0
  				break;
  			fi
-			usleep 100
+			tst_sleep 100us

Patch applied. I've changed sleep time here to 'ms', it should have been "usleep 100000", so the patch is fixing it as well,
added comment about this in the patch.

Thanks,
Alexey

Quoted 3 lines
testcases/network/tcp_cmds/ipneigh/ipneigh01.sh +0 -0
  		done
 
  		[ "$ret" -ne 0 ] && \