All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/2] net/traceroute: Rewrite into new API
@ 2019-04-29  7:27 Petr Vorel
  2019-04-29  7:28 ` [LTP] [PATCH 2/2] net/tracepath: " Petr Vorel
  2019-04-30 16:00 ` [LTP] [PATCH 1/2] net/traceroute: " Alexey Kodanev
  0 siblings, 2 replies; 7+ messages in thread
From: Petr Vorel @ 2019-04-29  7:27 UTC (permalink / raw)
  To: ltp

Add info about traceroute from iputils not being supported

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/network/traceroute/traceroute01.sh | 63 ++++++++------------
 1 file changed, 25 insertions(+), 38 deletions(-)

diff --git a/testcases/network/traceroute/traceroute01.sh b/testcases/network/traceroute/traceroute01.sh
index 1c8b66f55..8e9f46f45 100755
--- a/testcases/network/traceroute/traceroute01.sh
+++ b/testcases/network/traceroute/traceroute01.sh
@@ -1,39 +1,20 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2019 Petr Vorel <pvorel@suse.cz>
 # Copyright (c) 2017 Oracle and/or its affiliates. All Rights Reserved.
 # Copyright (c) International Business Machines  Corp., 2001
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
 
-TST_TOTAL=6
-TCID="traceroute01"
-TST_CLEANUP="cleanup"
-
-TST_USE_LEGACY_API=1
+TST_CNT=2
+TST_NEEDS_CMDS="traceroute"
+TST_SETUP="setup"
+TST_TESTFUNC="test"
 . tst_net.sh
 
-cleanup()
-{
-	tst_rmdir
-}
-
 setup()
 {
-	tst_resm TINFO "traceroute version:"
-	tst_resm TINFO $(traceroute --version 2>&1)
-
-	tst_test_cmds traceroute
-	tst_tmpdir
+	tst_res TINFO "traceroute version:"
+	tst_res TINFO $(traceroute --version 2>&1)
+	[ "$TST_IPV6" ] && tst_res TINFO "NOTE: tracepath6 from iputils is not supported"
 }
 
 run_trace()
@@ -51,24 +32,30 @@ run_trace()
 	grep -q "$bytes byte" out.log
 	if [ $? -ne 0 ]; then
 		cat out.log
-		tst_resm TFAIL "'$bytes byte' not found"
+		tst_res TFAIL "'$bytes byte' not found"
 	else
-		tst_resm TPASS "traceroute use $bytes bytes"
+		tst_res TPASS "traceroute use $bytes bytes"
 	fi
 
 	tail -1 out.log | grep -qE "$pattern"
 	if [ $? -ne 0 ]; then
 		cat out.log
-		tst_resm TFAIL "pattern '$pattern' not found in log"
+		tst_res TFAIL "pattern '$pattern' not found in log"
 	else
-		tst_resm TPASS "traceroute test completed with 1 hop"
+		tst_res TPASS "traceroute test completed with 1 hop"
 	fi
 }
 
-setup
-tst_resm TINFO "run traceroute with ICMP ECHO"
-run_trace -I
-tst_resm TINFO "run traceroute with TCP SYN"
-run_trace -T
+test1()
+{
+	tst_res TINFO "run traceroute with ICMP ECHO"
+	run_trace -I
+}
+
+test2()
+{
+	tst_res TINFO "run traceroute with TCP SYN"
+	run_trace -T
+}
 
-tst_exit
+tst_run
-- 
2.20.1


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

* [LTP] [PATCH 2/2] net/tracepath: Rewrite into new API
  2019-04-29  7:27 [LTP] [PATCH 1/2] net/traceroute: Rewrite into new API Petr Vorel
@ 2019-04-29  7:28 ` Petr Vorel
  2019-04-30 16:12   ` Alexey Kodanev
  2019-04-30 16:00 ` [LTP] [PATCH 1/2] net/traceroute: " Alexey Kodanev
  1 sibling, 1 reply; 7+ messages in thread
From: Petr Vorel @ 2019-04-29  7:28 UTC (permalink / raw)
  To: ltp

enhancements:
* Check for tracepath -6 when tracepath6 not available
  tracepath6 was removed in iputils s20161105 and replaced by tracepath -6,
  this way it's portable for both all iputils releases

* Print tracepath version if -V is available (added in inputils s20190324)

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 .../network/tcp_cmds/tracepath/tracepath01.sh | 60 +++++++++----------
 1 file changed, 29 insertions(+), 31 deletions(-)

diff --git a/testcases/network/tcp_cmds/tracepath/tracepath01.sh b/testcases/network/tcp_cmds/tracepath/tracepath01.sh
index fcfd54afb..037fca066 100755
--- a/testcases/network/tcp_cmds/tracepath/tracepath01.sh
+++ b/testcases/network/tcp_cmds/tracepath/tracepath01.sh
@@ -1,58 +1,56 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2019 Petr Vorel <pvorel@suse.cz>
 # Copyright (c) 2016 Oracle and/or its affiliates. All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
 # Author: Alexey Kodanev <alexey.kodanev@oracle.com>
 
-TCID=tracepath01
-TST_TOTAL=1
-TST_USE_LEGACY_API=1
+TST_TESTFUNC="do_test"
+TST_SETUP="setup"
 . tst_net.sh
 
-test_tracepath()
+setup()
+{
+	cmd="tracepath"
+
+	if [ "$TST_IPV6" ]; then
+		cmd="tracepath$TST_IPVER"
+		tst_cmd_available $cmd || cmd="tracepath -6"
+	fi
+	tst_test_cmds $(echo $cmd | cut -f 1 -d' ')
+
+	if $cmd -V >/dev/null 2>&1; then
+		tst_res TINFO "traceroute version:"
+		tst_res TINFO $($cmd -V 2>&1)
+	fi
+}
+
+do_test()
 {
-	local cmd="$1"
 	local len=1280
-	local output=
-	local ret=0
-	local rhost="$2"
-	tst_test_cmds "$cmd"
+	local output
+	local rhost="$(tst_ipaddr rhost)"
 
-	tst_resm TINFO "test $cmd with $rhost, pmtu is $len"
+	tst_res TINFO "test $cmd with $rhost, pmtu is $len"
 
 	output=$($cmd $rhost -l $len | grep "pmtu $len")
 	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "$cmd failed: pmtu $len not found in output"
+		tst_res TFAIL "$cmd failed: pmtu $len not found in output"
 		return
 	fi
 
 	# Usually only one hop is required to get to remote test machine
 	hops_num=$(echo "$output" | sed -nE 's/.*hops ([0-9]+).*/\1/p')
 	if [ -z "$hops_num" ]; then
-		tst_resm TFAIL "failed to trace path to '$rhost'"
+		tst_res TFAIL "failed to trace path to '$rhost'"
 		return
 	fi
 
 	if [ "$hops_num" -eq 0 ]; then
-		tst_resm TFAIL "can't trace path to '$rhost' in 1+ hops"
+		tst_res TFAIL "can't trace path to '$rhost' in 1+ hops"
 		return
 	fi
 
-	tst_resm TPASS "traced path to '$rhost' in $hops_num hops"
+	tst_res TPASS "traced path to '$rhost' in $hops_num hops"
 }
 
-test_tracepath tracepath$TST_IPV6 $(tst_ipaddr rhost)
-
-tst_exit
+tst_run
-- 
2.20.1


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

* [LTP] [PATCH 1/2] net/traceroute: Rewrite into new API
  2019-04-29  7:27 [LTP] [PATCH 1/2] net/traceroute: Rewrite into new API Petr Vorel
  2019-04-29  7:28 ` [LTP] [PATCH 2/2] net/tracepath: " Petr Vorel
@ 2019-04-30 16:00 ` Alexey Kodanev
  2019-05-01 15:34   ` Petr Vorel
  2019-05-02  6:31   ` Petr Vorel
  1 sibling, 2 replies; 7+ messages in thread
From: Alexey Kodanev @ 2019-04-30 16:00 UTC (permalink / raw)
  To: ltp

On 29.04.2019 10:27, Petr Vorel wrote:
> Add info about traceroute from iputils not being supported
> 
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>  testcases/network/traceroute/traceroute01.sh | 63 ++++++++------------
>  1 file changed, 25 insertions(+), 38 deletions(-)
> 
> diff --git a/testcases/network/traceroute/traceroute01.sh b/testcases/network/traceroute/traceroute01.sh
> index 1c8b66f55..8e9f46f45 100755
> --- a/testcases/network/traceroute/traceroute01.sh
> +++ b/testcases/network/traceroute/traceroute01.sh
> @@ -1,39 +1,20 @@
>  #!/bin/sh
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +# Copyright (c) 2019 Petr Vorel <pvorel@suse.cz>
>  # Copyright (c) 2017 Oracle and/or its affiliates. All Rights Reserved.
>  # Copyright (c) International Business Machines  Corp., 2001
> -#
> -# This program is free software; you can redistribute it and/or
> -# modify it under the terms of the GNU General Public License as
> -# published by the Free Software Foundation; either version 2 of
> -# the License, or (at your option) any later version.
> -#
> -# This program is distributed in the hope that it would be useful,
> -# but WITHOUT ANY WARRANTY; without even the implied warranty of
> -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> -# GNU General Public License for more details.
> -#
> -# You should have received a copy of the GNU General Public License
> -# along with this program. If not, see <http://www.gnu.org/licenses/>.
>  
> -TST_TOTAL=6
> -TCID="traceroute01"
> -TST_CLEANUP="cleanup"
> -
> -TST_USE_LEGACY_API=1
> +TST_CNT=2
> +TST_NEEDS_CMDS="traceroute"
> +TST_SETUP="setup"
> +TST_TESTFUNC="test"

TST_NEEDS_TMPDIR=1?


>  . tst_net.sh
>  
> -cleanup()
> -{
> -	tst_rmdir
> -}
> -
>  setup()
>  {
> -	tst_resm TINFO "traceroute version:"
> -	tst_resm TINFO $(traceroute --version 2>&1)
> -
> -	tst_test_cmds traceroute
> -	tst_tmpdir
> +	tst_res TINFO "traceroute version:"
> +	tst_res TINFO $(traceroute --version 2>&1)
> +	[ "$TST_IPV6" ] && tst_res TINFO "NOTE: tracepath6 from iputils is not supported"
>  }
>  
>  run_trace()
> @@ -51,24 +32,30 @@ run_trace()
>  	grep -q "$bytes byte" out.log
>  	if [ $? -ne 0 ]; then
>  		cat out.log
> -		tst_resm TFAIL "'$bytes byte' not found"
> +		tst_res TFAIL "'$bytes byte' not found"
>  	else
> -		tst_resm TPASS "traceroute use $bytes bytes"
> +		tst_res TPASS "traceroute use $bytes bytes"
>  	fi
>  
>  	tail -1 out.log | grep -qE "$pattern"
>  	if [ $? -ne 0 ]; then
>  		cat out.log
> -		tst_resm TFAIL "pattern '$pattern' not found in log"
> +		tst_res TFAIL "pattern '$pattern' not found in log"
>  	else
> -		tst_resm TPASS "traceroute test completed with 1 hop"
> +		tst_res TPASS "traceroute test completed with 1 hop"
>  	fi
>  }
>  
> -setup
> -tst_resm TINFO "run traceroute with ICMP ECHO"
> -run_trace -I
> -tst_resm TINFO "run traceroute with TCP SYN"
> -run_trace -T
> +test1()
> +{
> +	tst_res TINFO "run traceroute with ICMP ECHO"
> +	run_trace -I
> +}
> +
> +test2()
> +{
> +	tst_res TINFO "run traceroute with TCP SYN"
> +	run_trace -T
> +}
>  
> -tst_exit
> +tst_run
> 


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

* [LTP] [PATCH 2/2] net/tracepath: Rewrite into new API
  2019-04-29  7:28 ` [LTP] [PATCH 2/2] net/tracepath: " Petr Vorel
@ 2019-04-30 16:12   ` Alexey Kodanev
  2019-05-01 15:30     ` Petr Vorel
  0 siblings, 1 reply; 7+ messages in thread
From: Alexey Kodanev @ 2019-04-30 16:12 UTC (permalink / raw)
  To: ltp

On 29.04.2019 10:28, Petr Vorel wrote:
> enhancements:
> * Check for tracepath -6 when tracepath6 not available
>   tracepath6 was removed in iputils s20161105 and replaced by tracepath -6,
>   this way it's portable for both all iputils releases
> 
> * Print tracepath version if -V is available (added in inputils s20190324)
> 
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>  .../network/tcp_cmds/tracepath/tracepath01.sh | 60 +++++++++----------
>  1 file changed, 29 insertions(+), 31 deletions(-)


Acked-by: Alexey Kodanev <alexey.kodanev@oracle.com>

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

* [LTP] [PATCH 2/2] net/tracepath: Rewrite into new API
  2019-04-30 16:12   ` Alexey Kodanev
@ 2019-05-01 15:30     ` Petr Vorel
  0 siblings, 0 replies; 7+ messages in thread
From: Petr Vorel @ 2019-05-01 15:30 UTC (permalink / raw)
  To: ltp

Hi Alexey,

> On 29.04.2019 10:28, Petr Vorel wrote:
> > enhancements:
> > * Check for tracepath -6 when tracepath6 not available
> >   tracepath6 was removed in iputils s20161105 and replaced by tracepath -6,
> >   this way it's portable for both all iputils releases

> > * Print tracepath version if -V is available (added in inputils s20190324)

> > Signed-off-by: Petr Vorel <pvorel@suse.cz>
> > ---
> >  .../network/tcp_cmds/tracepath/tracepath01.sh | 60 +++++++++----------
> >  1 file changed, 29 insertions(+), 31 deletions(-)


> Acked-by: Alexey Kodanev <alexey.kodanev@oracle.com>
Thanks for a review, merged.

Kind regards,
Petr

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

* [LTP] [PATCH 1/2] net/traceroute: Rewrite into new API
  2019-04-30 16:00 ` [LTP] [PATCH 1/2] net/traceroute: " Alexey Kodanev
@ 2019-05-01 15:34   ` Petr Vorel
  2019-05-02  6:31   ` Petr Vorel
  1 sibling, 0 replies; 7+ messages in thread
From: Petr Vorel @ 2019-05-01 15:34 UTC (permalink / raw)
  To: ltp

Hi Alexey,

> On 29.04.2019 10:27, Petr Vorel wrote:
> > Add info about traceroute from iputils not being supported

> >  testcases/network/traceroute/traceroute01.sh | 63 ++++++++------------

> > -TST_TOTAL=6
> > -TCID="traceroute01"
> > -TST_CLEANUP="cleanup"
> > -
> > -TST_USE_LEGACY_API=1
> > +TST_CNT=2
> > +TST_NEEDS_CMDS="traceroute"
> > +TST_SETUP="setup"
> > +TST_TESTFUNC="test"

> TST_NEEDS_TMPDIR=1?
Thanks, yes it's needed (redirects to files).


Kind regards,
Petr

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

* [LTP] [PATCH 1/2] net/traceroute: Rewrite into new API
  2019-04-30 16:00 ` [LTP] [PATCH 1/2] net/traceroute: " Alexey Kodanev
  2019-05-01 15:34   ` Petr Vorel
@ 2019-05-02  6:31   ` Petr Vorel
  1 sibling, 0 replies; 7+ messages in thread
From: Petr Vorel @ 2019-05-02  6:31 UTC (permalink / raw)
  To: ltp

Hi Alexey,

> TST_NEEDS_TMPDIR=1?

Pushed with added TST_NEEDS_TMPDIR=1 and your Reviewed-by.
Thanks!
Petr

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

end of thread, other threads:[~2019-05-02  6:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-29  7:27 [LTP] [PATCH 1/2] net/traceroute: Rewrite into new API Petr Vorel
2019-04-29  7:28 ` [LTP] [PATCH 2/2] net/tracepath: " Petr Vorel
2019-04-30 16:12   ` Alexey Kodanev
2019-05-01 15:30     ` Petr Vorel
2019-04-30 16:00 ` [LTP] [PATCH 1/2] net/traceroute: " Alexey Kodanev
2019-05-01 15:34   ` Petr Vorel
2019-05-02  6:31   ` Petr Vorel

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.