All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 0/4] lib/shell: run commands with 'timeout'
@ 2017-05-24  8:40 Alexey Kodanev
  2017-05-24  8:40 ` [LTP] [PATCH 1/4] lib/test_net: print TPASS/TFAIL inside tst_ping() Alexey Kodanev
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Alexey Kodanev @ 2017-05-24  8:40 UTC (permalink / raw)
  To: ltp

The first three patches remove usage of shell functions with
'ROD' based functions and the last one adds 'timeout' command
to the both shell libraries.

Alexey Kodanev (4):
  lib/test_net: print TPASS/TFAIL inside tst_ping()
  net: remove EXPECT_PASS usage with tst_ping()
  net/virt_lib.sh: don't use ROD_SILENT with shell function
  lib/test: run ROD_BASE() & tst_rod() with 'timeout' cmd

 testcases/lib/test.sh                              |    7 +++++--
 testcases/lib/test_net.sh                          |    4 ++--
 testcases/lib/tst_test.sh                          |   11 +++++++----
 .../network/stress/broken_ip/broken_ip4-checksum   |    2 +-
 .../network/stress/broken_ip/broken_ip4-dstaddr    |    2 +-
 .../network/stress/broken_ip/broken_ip4-fragment   |    2 +-
 testcases/network/stress/broken_ip/broken_ip4-ihl  |    2 +-
 .../network/stress/broken_ip/broken_ip4-protcol    |    2 +-
 .../network/stress/broken_ip/broken_ip4-totlen     |    2 +-
 .../network/stress/broken_ip/broken_ip4-version    |    2 +-
 .../network/stress/broken_ip/broken_ip6-dstaddr    |    2 +-
 .../network/stress/broken_ip/broken_ip6-nexthdr    |    2 +-
 testcases/network/stress/broken_ip/broken_ip6-plen |    2 +-
 .../network/stress/broken_ip/broken_ip6-version    |    2 +-
 testcases/network/stress/icmp/icmp-uni-basic.sh    |    5 -----
 testcases/network/stress/icmp/icmp-uni-vti.sh      |    2 +-
 testcases/network/stress/interface/if-lib.sh       |    7 +------
 testcases/network/stress/interface/if-mtu-change   |    2 +-
 testcases/network/stress/interface/if4-addr-change |    4 ++--
 testcases/network/virt/virt_lib.sh                 |    9 ++++++---
 20 files changed, 36 insertions(+), 37 deletions(-)


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [LTP] [PATCH 1/4] lib/test_net: print TPASS/TFAIL inside tst_ping()
  2017-05-24  8:40 [LTP] [PATCH 0/4] lib/shell: run commands with 'timeout' Alexey Kodanev
@ 2017-05-24  8:40 ` Alexey Kodanev
  2017-05-24  8:40 ` [LTP] [PATCH 2/4] net: remove EXPECT_PASS usage with tst_ping() Alexey Kodanev
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Alexey Kodanev @ 2017-05-24  8:40 UTC (permalink / raw)
  To: ltp

Since there is no usage of 'expected fail' in the tests with
tst_ping() and new shell library doesn't support passing shell
functions to EXPECT_PASS, set test result inside tst_ping.

Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
 testcases/lib/test_net.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/testcases/lib/test_net.sh b/testcases/lib/test_net.sh
index dae066b..2ed6fb4 100644
--- a/testcases/lib/test_net.sh
+++ b/testcases/lib/test_net.sh
@@ -426,9 +426,9 @@ tst_ping()
 			-s $size -i 0 > /dev/null 2>&1
 		ret=$?
 		if [ $ret -eq 0 ]; then
-			tst_resm TINFO "tst_ping IPv${TST_IPV6:-4} msg_size $size pass"
+			tst_resm TPASS "tst_ping IPv${TST_IPV6:-4} msg_size $size pass"
 		else
-			tst_resm TINFO "tst_ping IPv${TST_IPV6:-4} msg_size $size fail"
+			tst_resm TFAIL "tst_ping IPv${TST_IPV6:-4} msg_size $size fail"
 			break
 		fi
 	done
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [LTP] [PATCH 2/4] net: remove EXPECT_PASS usage with tst_ping()
  2017-05-24  8:40 [LTP] [PATCH 0/4] lib/shell: run commands with 'timeout' Alexey Kodanev
  2017-05-24  8:40 ` [LTP] [PATCH 1/4] lib/test_net: print TPASS/TFAIL inside tst_ping() Alexey Kodanev
@ 2017-05-24  8:40 ` Alexey Kodanev
  2017-09-11 12:57   ` Alexey Kodanev
  2017-05-24  8:40 ` [LTP] [PATCH 3/4] net/virt_lib.sh: don't use ROD_SILENT with shell function Alexey Kodanev
  2017-05-24  8:40 ` [LTP] [PATCH 4/4] lib/test: run ROD_BASE() & tst_rod() with 'timeout' cmd Alexey Kodanev
  3 siblings, 1 reply; 7+ messages in thread
From: Alexey Kodanev @ 2017-05-24  8:40 UTC (permalink / raw)
  To: ltp

Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
 .../network/stress/broken_ip/broken_ip4-checksum   |    2 +-
 .../network/stress/broken_ip/broken_ip4-dstaddr    |    2 +-
 .../network/stress/broken_ip/broken_ip4-fragment   |    2 +-
 testcases/network/stress/broken_ip/broken_ip4-ihl  |    2 +-
 .../network/stress/broken_ip/broken_ip4-protcol    |    2 +-
 .../network/stress/broken_ip/broken_ip4-totlen     |    2 +-
 .../network/stress/broken_ip/broken_ip4-version    |    2 +-
 .../network/stress/broken_ip/broken_ip6-dstaddr    |    2 +-
 .../network/stress/broken_ip/broken_ip6-nexthdr    |    2 +-
 testcases/network/stress/broken_ip/broken_ip6-plen |    2 +-
 .../network/stress/broken_ip/broken_ip6-version    |    2 +-
 testcases/network/stress/icmp/icmp-uni-basic.sh    |    5 -----
 testcases/network/stress/icmp/icmp-uni-vti.sh      |    2 +-
 testcases/network/stress/interface/if-lib.sh       |    7 +------
 testcases/network/stress/interface/if-mtu-change   |    2 +-
 testcases/network/stress/interface/if4-addr-change |    4 ++--
 16 files changed, 16 insertions(+), 26 deletions(-)

diff --git a/testcases/network/stress/broken_ip/broken_ip4-checksum b/testcases/network/stress/broken_ip/broken_ip4-checksum
index 33667ba..ff30fbf 100644
--- a/testcases/network/stress/broken_ip/broken_ip4-checksum
+++ b/testcases/network/stress/broken_ip/broken_ip4-checksum
@@ -27,6 +27,6 @@ tst_resm TINFO "Sending ICMPv4 with wrong chksum field for $NS_DURATION sec"
 
 tst_icmp -t $NS_DURATION -s "0 100 500 1000 1472" -c
 
-EXPECT_PASS tst_ping
+tst_ping
 
 tst_exit
diff --git a/testcases/network/stress/broken_ip/broken_ip4-dstaddr b/testcases/network/stress/broken_ip/broken_ip4-dstaddr
index b4b676e..eb236f2 100644
--- a/testcases/network/stress/broken_ip/broken_ip4-dstaddr
+++ b/testcases/network/stress/broken_ip/broken_ip4-dstaddr
@@ -27,6 +27,6 @@ tst_resm TINFO "Sending ICMPv4 with wrong dst address for $NS_DURATION sec"
 
 tst_icmp -t $NS_DURATION -s "0 100 500 1000 1472" -i
 
-EXPECT_PASS tst_ping
+tst_ping
 
 tst_exit
diff --git a/testcases/network/stress/broken_ip/broken_ip4-fragment b/testcases/network/stress/broken_ip/broken_ip4-fragment
index dbef193..8f2aca9 100644
--- a/testcases/network/stress/broken_ip/broken_ip4-fragment
+++ b/testcases/network/stress/broken_ip/broken_ip4-fragment
@@ -27,6 +27,6 @@ tst_resm TINFO "Sending ICMPv4 with wrong frag. info for $NS_DURATION sec"
 
 tst_icmp -t $NS_DURATION -s "0 100 500 1000 1472" -f
 
-EXPECT_PASS tst_ping
+tst_ping
 
 tst_exit
diff --git a/testcases/network/stress/broken_ip/broken_ip4-ihl b/testcases/network/stress/broken_ip/broken_ip4-ihl
index 48deb3b..2e136a5 100644
--- a/testcases/network/stress/broken_ip/broken_ip4-ihl
+++ b/testcases/network/stress/broken_ip/broken_ip4-ihl
@@ -27,6 +27,6 @@ tst_resm TINFO "Sending ICMPv4 with wrong header len field for $NS_DURATION sec"
 
 tst_icmp -t $NS_DURATION -s "0 100 500 1000 1472" -l
 
-EXPECT_PASS tst_ping
+tst_ping
 
 tst_exit
diff --git a/testcases/network/stress/broken_ip/broken_ip4-protcol b/testcases/network/stress/broken_ip/broken_ip4-protcol
index b4b767c..a57ce61 100644
--- a/testcases/network/stress/broken_ip/broken_ip4-protcol
+++ b/testcases/network/stress/broken_ip/broken_ip4-protcol
@@ -27,6 +27,6 @@ tst_resm TINFO "Sending ICMPv4 with wrong proto field for $NS_DURATION sec"
 
 tst_icmp -t $NS_DURATION -s "0 100 500 1000 1472" -p
 
-EXPECT_PASS tst_ping
+tst_ping
 
 tst_exit
diff --git a/testcases/network/stress/broken_ip/broken_ip4-totlen b/testcases/network/stress/broken_ip/broken_ip4-totlen
index 051d969..4466487 100644
--- a/testcases/network/stress/broken_ip/broken_ip4-totlen
+++ b/testcases/network/stress/broken_ip/broken_ip4-totlen
@@ -27,6 +27,6 @@ tst_resm TINFO "Sending ICMPv4 with wrong total len field for $NS_DURATION sec"
 
 tst_icmp -t $NS_DURATION -s "0 100 500 1000 1472" -L
 
-EXPECT_PASS tst_ping
+tst_ping
 
 tst_exit
diff --git a/testcases/network/stress/broken_ip/broken_ip4-version b/testcases/network/stress/broken_ip/broken_ip4-version
index c3ccf7f..83cf568 100644
--- a/testcases/network/stress/broken_ip/broken_ip4-version
+++ b/testcases/network/stress/broken_ip/broken_ip4-version
@@ -27,6 +27,6 @@ tst_resm TINFO "Sending ICMPv4 with wrong version field for $NS_DURATION sec"
 
 tst_icmp -t $NS_DURATION -s "0 100 500 1000 1472" -v
 
-EXPECT_PASS tst_ping
+tst_ping
 
 tst_exit
diff --git a/testcases/network/stress/broken_ip/broken_ip6-dstaddr b/testcases/network/stress/broken_ip/broken_ip6-dstaddr
index 5da38ab..ea7d66d 100644
--- a/testcases/network/stress/broken_ip/broken_ip6-dstaddr
+++ b/testcases/network/stress/broken_ip/broken_ip6-dstaddr
@@ -27,6 +27,6 @@ tst_resm TINFO "Sending ICMPv6 with wrong dst address for $NS_DURATION sec"
 
 tst_icmp -t $NS_DURATION -s "0 100 500 1000 1452" -i
 
-EXPECT_PASS tst_ping
+tst_ping
 
 tst_exit
diff --git a/testcases/network/stress/broken_ip/broken_ip6-nexthdr b/testcases/network/stress/broken_ip/broken_ip6-nexthdr
index bb1bdcb..ebbef5e 100644
--- a/testcases/network/stress/broken_ip/broken_ip6-nexthdr
+++ b/testcases/network/stress/broken_ip/broken_ip6-nexthdr
@@ -27,6 +27,6 @@ tst_resm TINFO "Sending ICMPv4 with wrong next header for $NS_DURATION sec"
 
 tst_icmp -t $NS_DURATION -s "0 100 500 1000 1452" -n
 
-EXPECT_PASS tst_ping
+tst_ping
 
 tst_exit
diff --git a/testcases/network/stress/broken_ip/broken_ip6-plen b/testcases/network/stress/broken_ip/broken_ip6-plen
index 8eacbf4..e93cdcc 100644
--- a/testcases/network/stress/broken_ip/broken_ip6-plen
+++ b/testcases/network/stress/broken_ip/broken_ip6-plen
@@ -27,6 +27,6 @@ tst_resm TINFO "Sending ICMPv4 with wrong payload len for $NS_DURATION sec"
 
 tst_icmp -t $NS_DURATION -s "0 100 500 1000 1452" -L
 
-EXPECT_PASS tst_ping
+tst_ping
 
 tst_exit
diff --git a/testcases/network/stress/broken_ip/broken_ip6-version b/testcases/network/stress/broken_ip/broken_ip6-version
index cdce71f..3eff2d7 100644
--- a/testcases/network/stress/broken_ip/broken_ip6-version
+++ b/testcases/network/stress/broken_ip/broken_ip6-version
@@ -27,6 +27,6 @@ tst_resm TINFO "Sending ICMPv6 with wrong version field for $NS_DURATION sec"
 
 tst_icmp -t $NS_DURATION -s "0 100 500 1000 1452" -v
 
-EXPECT_PASS tst_ping
+tst_ping
 
 tst_exit
diff --git a/testcases/network/stress/icmp/icmp-uni-basic.sh b/testcases/network/stress/icmp/icmp-uni-basic.sh
index 2aae945..7e50386 100755
--- a/testcases/network/stress/icmp/icmp-uni-basic.sh
+++ b/testcases/network/stress/icmp/icmp-uni-basic.sh
@@ -57,10 +57,5 @@ if $DO_IPSEC ; then
 fi
 
 tst_ping $lhost_ifname $rhost_addr $IPSEC_SIZE_ARRAY
-if [ $? -ne 0 ]; then
-	tst_resm TFAIL "Checked IPv${TST_IPV6:-4} $IPSEC_PROTO $IPSEC_MODE"
-else
-	tst_resm TPASS "Checked IPv${TST_IPV6:-4} $IPSEC_PROTO $IPSEC_MODE"
-fi
 
 tst_exit
diff --git a/testcases/network/stress/icmp/icmp-uni-vti.sh b/testcases/network/stress/icmp/icmp-uni-vti.sh
index a19c869..b9a1034 100755
--- a/testcases/network/stress/icmp/icmp-uni-vti.sh
+++ b/testcases/network/stress/icmp/icmp-uni-vti.sh
@@ -27,7 +27,7 @@ do_test()
 	IPSEC_SIZE_ARRAY="${IPSEC_SIZE_ARRAY:-10 100 1000 10000 65507}"
 
 	tst_resm TINFO "Sending ICMP messages..."
-	EXPECT_PASS tst_ping $tst_vti $ip_rmt_tun $IPSEC_SIZE_ARRAY
+	tst_ping $tst_vti $ip_rmt_tun $IPSEC_SIZE_ARRAY
 }
 
 tst_ipsec_setup_vti
diff --git a/testcases/network/stress/interface/if-lib.sh b/testcases/network/stress/interface/if-lib.sh
index 4168dd0..000f742 100644
--- a/testcases/network/stress/interface/if-lib.sh
+++ b/testcases/network/stress/interface/if-lib.sh
@@ -58,12 +58,7 @@ check_connectivity()
 
 	[ -n "$restore" ] && restore_ipaddr
 
-	tst_ping
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "$(tst_iface) is broken"
-		return 1
-	fi
-	return 0
+	tst_ping || return 1
 }
 
 restore_ipaddr()
diff --git a/testcases/network/stress/interface/if-mtu-change b/testcases/network/stress/interface/if-mtu-change
index 637fa63..01cbec6 100644
--- a/testcases/network/stress/interface/if-mtu-change
+++ b/testcases/network/stress/interface/if-mtu-change
@@ -91,7 +91,7 @@ test_body()
 
 		tst_sleep $CHANGE_INTERVAL
 
-		EXPECT_PASS tst_ping $(tst_ipaddr) $(tst_ipaddr rhost) "1 1000 65507"
+		tst_ping $(tst_ipaddr) $(tst_ipaddr rhost) "1 1000 65507"
 
 		# Check the background TCP traffic
 		pgrep -x netstress > /dev/null || make_background_tcp_traffic
diff --git a/testcases/network/stress/interface/if4-addr-change b/testcases/network/stress/interface/if4-addr-change
index 54b8fd5..cbe22ce 100644
--- a/testcases/network/stress/interface/if4-addr-change
+++ b/testcases/network/stress/interface/if4-addr-change
@@ -61,9 +61,9 @@ while [ $cnt -lt $NS_TIMES ]; do
 	[ $(($cnt % $CHECK_INTERVAL)) -ne 0 ] && continue
 
 	tst_resm TINFO "ping $(tst_ipaddr):$(tst_ipaddr rhost) ${cnt}/$NS_TIMES"
-	EXPECT_PASS tst_ping
+	tst_ping
 done
 
-EXPECT_PASS tst_ping
+tst_ping
 
 tst_exit
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [LTP] [PATCH 3/4] net/virt_lib.sh: don't use ROD_SILENT with shell function
  2017-05-24  8:40 [LTP] [PATCH 0/4] lib/shell: run commands with 'timeout' Alexey Kodanev
  2017-05-24  8:40 ` [LTP] [PATCH 1/4] lib/test_net: print TPASS/TFAIL inside tst_ping() Alexey Kodanev
  2017-05-24  8:40 ` [LTP] [PATCH 2/4] net: remove EXPECT_PASS usage with tst_ping() Alexey Kodanev
@ 2017-05-24  8:40 ` Alexey Kodanev
  2017-05-24  8:40 ` [LTP] [PATCH 4/4] lib/test: run ROD_BASE() & tst_rod() with 'timeout' cmd Alexey Kodanev
  3 siblings, 0 replies; 7+ messages in thread
From: Alexey Kodanev @ 2017-05-24  8:40 UTC (permalink / raw)
  To: ltp

Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
 testcases/network/virt/virt_lib.sh |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/testcases/network/virt/virt_lib.sh b/testcases/network/virt/virt_lib.sh
index 6036b42..05eaf0d 100644
--- a/testcases/network/virt/virt_lib.sh
+++ b/testcases/network/virt/virt_lib.sh
@@ -157,7 +157,8 @@ virt_multiple_add_test()
 	tst_resm TINFO "add $virt_count $virt_type, then delete"
 
 	for i in $(seq $start_id $max); do
-		ROD_SILENT "virt_add ltp_v$i id $i $opt"
+		virt_add ltp_v$i id $i $opt || \
+			tst_brkm TFAIL "failed to create 'ltp_v0 $opt'"
 		ROD_SILENT "ip link set ltp_v$i up"
 	done
 
@@ -177,7 +178,8 @@ virt_add_delete_test()
 	tst_resm TINFO "add/del $virt_type $virt_count times"
 
 	for i in $(seq 0 $max); do
-		ROD_SILENT "virt_add ltp_v0 $opt"
+		virt_add ltp_v0 $opt || \
+			tst_brkm TFAIL "failed to create 'ltp_v0 $opt'"
 		ROD_SILENT "ip link set ltp_v0 up"
 		ROD_SILENT "ip link delete ltp_v0"
 	done
@@ -190,7 +192,8 @@ virt_setup()
 	local opt_r="$2"
 
 	tst_resm TINFO "setup local ${virt_type} with '$opt'"
-	ROD_SILENT "virt_add ltp_v0 $opt"
+	virt_add ltp_v0 $opt || \
+		tst_brkm TBROK "failed to create 'ltp_v0 $opt'"
 
 	tst_resm TINFO "setup rhost ${virt_type} with '$opt_r'"
 	virt_add_rhost "$opt_r"
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [LTP] [PATCH 4/4] lib/test: run ROD_BASE() & tst_rod() with 'timeout' cmd
  2017-05-24  8:40 [LTP] [PATCH 0/4] lib/shell: run commands with 'timeout' Alexey Kodanev
                   ` (2 preceding siblings ...)
  2017-05-24  8:40 ` [LTP] [PATCH 3/4] net/virt_lib.sh: don't use ROD_SILENT with shell function Alexey Kodanev
@ 2017-05-24  8:40 ` Alexey Kodanev
  2017-06-27 14:53   ` Cyril Hrubis
  3 siblings, 1 reply; 7+ messages in thread
From: Alexey Kodanev @ 2017-05-24  8:40 UTC (permalink / raw)
  To: ltp

Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
 testcases/lib/test.sh     |    7 +++++--
 testcases/lib/tst_test.sh |   11 +++++++----
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/testcases/lib/test.sh b/testcases/lib/test.sh
index 2e4d868..5247873 100644
--- a/testcases/lib/test.sh
+++ b/testcases/lib/test.sh
@@ -253,9 +253,9 @@ ROD_BASE()
 	done
 
 	if [ -n "$flag" ]; then
-		$cmd > $file
+		$TST_TIMECMD $cmd > $file
 	else
-		$@
+		$TST_TIMECMD $@
 	fi
 }
 
@@ -425,3 +425,6 @@ if [ "$TST_NEEDS_CHECKPOINTS" = "1" ]; then
 	ROD_SILENT chmod 600 "$LTP_IPC_PATH"
 	export LTP_IPC_PATH
 fi
+
+command -v timeout > /dev/null 2>&1 && \
+	TST_TIMECMD="timeout -s 9 $((300 * ${LTP_TIMEOUT_MUL:-1}))s"
diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
index 087adda..c4fbe86 100644
--- a/testcases/lib/tst_test.sh
+++ b/testcases/lib/tst_test.sh
@@ -116,7 +116,7 @@ tst_brk()
 
 ROD_SILENT()
 {
-	tst_rod $@ > /dev/null 2>&1
+	$TST_TIMECMD tst_rod $@ > /dev/null 2>&1
 	if [ $? -ne 0 ]; then
 		tst_brk TBROK "$@ failed"
 	fi
@@ -124,7 +124,7 @@ ROD_SILENT()
 
 ROD()
 {
-	tst_rod "$@"
+	$TST_TIMECMD tst_rod "$@"
 	if [ $? -ne 0 ]; then
 		tst_brk TBROK "$@ failed"
 	fi
@@ -132,7 +132,7 @@ ROD()
 
 EXPECT_PASS()
 {
-	tst_rod "$@"
+	$TST_TIMECMD tst_rod "$@"
 	if [ $? -eq 0 ]; then
 		tst_res TPASS "$@ passed as expected"
 	else
@@ -143,7 +143,7 @@ EXPECT_PASS()
 EXPECT_FAIL()
 {
 	# redirect stderr since we expect the command to fail
-	tst_rod "$@" 2> /dev/null
+	$TST_TIMECMD tst_rod "$@" 2> /dev/null
 	if [ $? -ne 0 ]; then
 		tst_res TPASS "$@ failed as expected"
 	else
@@ -430,3 +430,6 @@ else
 		tst_brk TBROK "Unexpected positional arguments '$@'"
 	fi
 fi
+
+command -v timeout > /dev/null 2>&1 && \
+	TST_TIMECMD="timeout -s 9 $((300 * ${LTP_TIMEOUT_MUL:-1}))s"
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [LTP] [PATCH 4/4] lib/test: run ROD_BASE() & tst_rod() with 'timeout' cmd
  2017-05-24  8:40 ` [LTP] [PATCH 4/4] lib/test: run ROD_BASE() & tst_rod() with 'timeout' cmd Alexey Kodanev
@ 2017-06-27 14:53   ` Cyril Hrubis
  0 siblings, 0 replies; 7+ messages in thread
From: Cyril Hrubis @ 2017-06-27 14:53 UTC (permalink / raw)
  To: ltp

Hi!
> diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
> index 087adda..c4fbe86 100644
> --- a/testcases/lib/tst_test.sh
> +++ b/testcases/lib/tst_test.sh
> @@ -116,7 +116,7 @@ tst_brk()
>  
>  ROD_SILENT()
>  {
> -	tst_rod $@ > /dev/null 2>&1
> +	$TST_TIMECMD tst_rod $@ > /dev/null 2>&1

It would be a bit cleaner to add the timeout capability to the tst_rod
and pass timeout to tst_rod as a first parameter here. Which would fix
the second (below) that I have for this patch.

>  	if [ $? -ne 0 ]; then
>  		tst_brk TBROK "$@ failed"
>  	fi
> @@ -124,7 +124,7 @@ ROD_SILENT()
>  
>  ROD()
>  {
> -	tst_rod "$@"
> +	$TST_TIMECMD tst_rod "$@"
>  	if [ $? -ne 0 ]; then
>  		tst_brk TBROK "$@ failed"
>  	fi
> @@ -132,7 +132,7 @@ ROD()
>  
>  EXPECT_PASS()
>  {
> -	tst_rod "$@"
> +	$TST_TIMECMD tst_rod "$@"
>  	if [ $? -eq 0 ]; then
>  		tst_res TPASS "$@ passed as expected"
>  	else
> @@ -143,7 +143,7 @@ EXPECT_PASS()
>  EXPECT_FAIL()
>  {
>  	# redirect stderr since we expect the command to fail
> -	tst_rod "$@" 2> /dev/null
> +	$TST_TIMECMD tst_rod "$@" 2> /dev/null
>  	if [ $? -ne 0 ]; then
>  		tst_res TPASS "$@ failed as expected"
>  	else
> @@ -430,3 +430,6 @@ else
>  		tst_brk TBROK "Unexpected positional arguments '$@'"
>  	fi
>  fi
> +
> +command -v timeout > /dev/null 2>&1 && \
> +	TST_TIMECMD="timeout -s 9 $((300 * ${LTP_TIMEOUT_MUL:-1}))s"

I do not like that we silently disable the timeout if 'timeout' command
is not available. I would rather add tst_timeout.c helper to the lib/ as
we do for instance for tst_sleep to support sub-second sleep intervals.

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [LTP] [PATCH 2/4] net: remove EXPECT_PASS usage with tst_ping()
  2017-05-24  8:40 ` [LTP] [PATCH 2/4] net: remove EXPECT_PASS usage with tst_ping() Alexey Kodanev
@ 2017-09-11 12:57   ` Alexey Kodanev
  0 siblings, 0 replies; 7+ messages in thread
From: Alexey Kodanev @ 2017-09-11 12:57 UTC (permalink / raw)
  To: ltp

Hi,

Applied the first two patches from the set:

[PATCH 1/4] lib/test_net: print TPASS/TFAIL inside tst_ping()
[PATCH 2/4] net: remove EXPECT_PASS usage with tst_ping()

Best regards,
Alexey

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-09-11 12:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-24  8:40 [LTP] [PATCH 0/4] lib/shell: run commands with 'timeout' Alexey Kodanev
2017-05-24  8:40 ` [LTP] [PATCH 1/4] lib/test_net: print TPASS/TFAIL inside tst_ping() Alexey Kodanev
2017-05-24  8:40 ` [LTP] [PATCH 2/4] net: remove EXPECT_PASS usage with tst_ping() Alexey Kodanev
2017-09-11 12:57   ` Alexey Kodanev
2017-05-24  8:40 ` [LTP] [PATCH 3/4] net/virt_lib.sh: don't use ROD_SILENT with shell function Alexey Kodanev
2017-05-24  8:40 ` [LTP] [PATCH 4/4] lib/test: run ROD_BASE() & tst_rod() with 'timeout' cmd Alexey Kodanev
2017-06-27 14:53   ` Cyril Hrubis

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.