diff mbox

linux-generic: pktio: always test loop interface

Message ID 1438854902-15050-1-git-send-email-stuart.haslam@linaro.org
State New
Headers show

Commit Message

Stuart Haslam Aug. 6, 2015, 9:55 a.m. UTC
Test using the loop interface even when running as root.

https://bugs.linaro.org/show_bug.cgi?id=1735

Signed-off-by: Stuart Haslam <stuart.haslam@linaro.org>
---
 platform/linux-generic/test/pktio/pktio_run | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

Comments

Maxim Uvarov Aug. 6, 2015, 10:22 a.m. UTC | #1
On 08/06/15 12:55, Stuart Haslam wrote:
> Test using the loop interface even when running as root.
>
> https://bugs.linaro.org/show_bug.cgi?id=1735
>
> Signed-off-by: Stuart Haslam <stuart.haslam@linaro.org>
> ---
>   platform/linux-generic/test/pktio/pktio_run | 24 +++++++++++++++---------
>   1 file changed, 15 insertions(+), 9 deletions(-)
>
> diff --git a/platform/linux-generic/test/pktio/pktio_run b/platform/linux-generic/test/pktio/pktio_run
> index 9a70ac4..9144c97 100755
> --- a/platform/linux-generic/test/pktio/pktio_run
> +++ b/platform/linux-generic/test/pktio/pktio_run
> @@ -46,9 +46,8 @@ run_test()
>   {
>   	local ret=0
>   
> -	# the linux-generic implementation uses environment variables to
> -	# control which socket method is used, so try each combination to
> -	# ensure decent coverage.
> +	# environment variables are used to control which socket method is
> +	# used, so try each combination to ensure decent coverage.
>   	for distype in MMAP MMSG BASIC; do
>   		unset ODP_PKTIO_DISABLE_SOCKET_${distype}
>   	done
> @@ -67,26 +66,33 @@ run_test()
>   		echo "!!! FAILED !!!"
>   	fi
>   
> -	exit $ret
> +	return $ret
>   }
>   
>   run()
>   {
> -	#need to be root to set the interface: if not, run with default loopback.
> +	echo "pktio: using 'loop' device"
> +	pktio_main${EXEEXT}
> +	loop_ret=$?
> +
> +	# need to be root to run tests with real interfaces
>   	if [ "$(id -u)" != "0" ]; then
> -		echo "pktio: using 'loop' device"
> -		pktio_main${EXEEXT}
> -		exit $?
> +		exit $ret
>   	fi
>   
>   	if [ "$ODP_PKTIO_IF0" = "" ]; then
> -		# no interfaces specified on linux-generic, use defaults
> +		# no interfaces specified, use defaults

Patch is good. But that message should say what is defaults. Something like:

# no interfaces specified, use linux virtual interfaces set by pktio_env 
script

Maxim.
>   		setup_pktio_env clean
>   		export ODP_PKTIO_IF0=$IF0
>   		export ODP_PKTIO_IF1=$IF1
>   	fi
>   
>   	run_test
> +	ret=$?
> +
> +	[ $ret = 0 ] && ret=$loop_ret
> +
> +	exit $ret
>   }
>   
>   case "$1" in
Mike Holmes Aug. 13, 2015, 3:44 p.m. UTC | #2
ping - can we close this for 1.3 ?

On 6 August 2015 at 06:22, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:

> On 08/06/15 12:55, Stuart Haslam wrote:
>
>> Test using the loop interface even when running as root.
>>
>> https://bugs.linaro.org/show_bug.cgi?id=1735
>>
>> Signed-off-by: Stuart Haslam <stuart.haslam@linaro.org>
>> ---
>>   platform/linux-generic/test/pktio/pktio_run | 24
>> +++++++++++++++---------
>>   1 file changed, 15 insertions(+), 9 deletions(-)
>>
>> diff --git a/platform/linux-generic/test/pktio/pktio_run
>> b/platform/linux-generic/test/pktio/pktio_run
>> index 9a70ac4..9144c97 100755
>> --- a/platform/linux-generic/test/pktio/pktio_run
>> +++ b/platform/linux-generic/test/pktio/pktio_run
>> @@ -46,9 +46,8 @@ run_test()
>>   {
>>         local ret=0
>>   -     # the linux-generic implementation uses environment variables to
>> -       # control which socket method is used, so try each combination to
>> -       # ensure decent coverage.
>> +       # environment variables are used to control which socket method is
>> +       # used, so try each combination to ensure decent coverage.
>>         for distype in MMAP MMSG BASIC; do
>>                 unset ODP_PKTIO_DISABLE_SOCKET_${distype}
>>         done
>> @@ -67,26 +66,33 @@ run_test()
>>                 echo "!!! FAILED !!!"
>>         fi
>>   -     exit $ret
>> +       return $ret
>>   }
>>     run()
>>   {
>> -       #need to be root to set the interface: if not, run with default
>> loopback.
>> +       echo "pktio: using 'loop' device"
>> +       pktio_main${EXEEXT}
>> +       loop_ret=$?
>> +
>> +       # need to be root to run tests with real interfaces
>>         if [ "$(id -u)" != "0" ]; then
>> -               echo "pktio: using 'loop' device"
>> -               pktio_main${EXEEXT}
>> -               exit $?
>> +               exit $ret
>>         fi
>>         if [ "$ODP_PKTIO_IF0" = "" ]; then
>> -               # no interfaces specified on linux-generic, use defaults
>> +               # no interfaces specified, use defaults
>>
>
> Patch is good. But that message should say what is defaults. Something
> like:
>
> # no interfaces specified, use linux virtual interfaces set by pktio_env
> script
>
> Maxim.
>
>>                 setup_pktio_env clean
>>                 export ODP_PKTIO_IF0=$IF0
>>                 export ODP_PKTIO_IF1=$IF1
>>         fi
>>         run_test
>> +       ret=$?
>> +
>> +       [ $ret = 0 ] && ret=$loop_ret
>> +
>> +       exit $ret
>>   }
>>     case "$1" in
>>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
diff mbox

Patch

diff --git a/platform/linux-generic/test/pktio/pktio_run b/platform/linux-generic/test/pktio/pktio_run
index 9a70ac4..9144c97 100755
--- a/platform/linux-generic/test/pktio/pktio_run
+++ b/platform/linux-generic/test/pktio/pktio_run
@@ -46,9 +46,8 @@  run_test()
 {
 	local ret=0
 
-	# the linux-generic implementation uses environment variables to
-	# control which socket method is used, so try each combination to
-	# ensure decent coverage.
+	# environment variables are used to control which socket method is
+	# used, so try each combination to ensure decent coverage.
 	for distype in MMAP MMSG BASIC; do
 		unset ODP_PKTIO_DISABLE_SOCKET_${distype}
 	done
@@ -67,26 +66,33 @@  run_test()
 		echo "!!! FAILED !!!"
 	fi
 
-	exit $ret
+	return $ret
 }
 
 run()
 {
-	#need to be root to set the interface: if not, run with default loopback.
+	echo "pktio: using 'loop' device"
+	pktio_main${EXEEXT}
+	loop_ret=$?
+
+	# need to be root to run tests with real interfaces
 	if [ "$(id -u)" != "0" ]; then
-		echo "pktio: using 'loop' device"
-		pktio_main${EXEEXT}
-		exit $?
+		exit $ret
 	fi
 
 	if [ "$ODP_PKTIO_IF0" = "" ]; then
-		# no interfaces specified on linux-generic, use defaults
+		# no interfaces specified, use defaults
 		setup_pktio_env clean
 		export ODP_PKTIO_IF0=$IF0
 		export ODP_PKTIO_IF1=$IF1
 	fi
 
 	run_test
+	ret=$?
+
+	[ $ret = 0 ] && ret=$loop_ret
+
+	exit $ret
 }
 
 case "$1" in