linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests: kmod: worked on errors which breaks the overall execution of the test script
@ 2019-01-17 21:02 Jeffrin Jose T
  2019-01-22 19:43 ` Luis Chamberlain
  0 siblings, 1 reply; 3+ messages in thread
From: Jeffrin Jose T @ 2019-01-17 21:02 UTC (permalink / raw)
  To: mcgrof, shuah; +Cc: linux-kernel, linux-kselftest, Jeffrin Jose T

The kmod.sh script breaks because an array is passed as input
instead of a single element input.This patch takes elements
one at a time and passed as input to the condition statement
which in turn fixes the error.There was an issue which had
the need for passing a single digit to the condition statement
which is fixed using regular expression.

Signed-off-by: Jeffrin Jose T <jeffrin@rajagiritech.edu.in>
---
 tools/testing/selftests/kmod/kmod.sh | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/kmod/kmod.sh b/tools/testing/selftests/kmod/kmod.sh
index 0a76314b4414..49b273c3646e 100755
--- a/tools/testing/selftests/kmod/kmod.sh
+++ b/tools/testing/selftests/kmod/kmod.sh
@@ -526,9 +526,12 @@ function run_all_tests()
 		TEST_ID=${i%:*:*}
 		ENABLED=$(get_test_enabled $TEST_ID)
 		TEST_COUNT=$(get_test_count $TEST_ID)
-		if [[ $ENABLED -eq "1" ]]; then
-			test_case $TEST_ID $TEST_COUNT
-		fi
+		for j in $ENABLED ; do
+		         CHECK=${j#*:*:}
+			 if [[ $CHECK -eq "1" ]]; then
+			     test_case $TEST_ID $TEST_COUNT
+			 fi
+		done
 	done
 }
 
-- 
2.20.1


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

* Re: [PATCH] selftests: kmod: worked on errors which breaks the overall execution of the test script
  2019-01-17 21:02 [PATCH] selftests: kmod: worked on errors which breaks the overall execution of the test script Jeffrin Jose T
@ 2019-01-22 19:43 ` Luis Chamberlain
       [not found]   ` <CAG=yYwmeGp7fT_3wPpnpHgzFUdYJuFCThUBaPL=DW9e4OZt_BA@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Luis Chamberlain @ 2019-01-22 19:43 UTC (permalink / raw)
  To: Jeffrin Jose T; +Cc: shuah, linux-kernel, linux-kselftest, Andrew Morton

On Fri, Jan 18, 2019 at 02:32:58AM +0530, Jeffrin Jose T wrote:
> The kmod.sh script breaks

First thanks for the patch! But now let's get to it: on what
distribution and version of bash does this break? The commit log should
refer to this and it would help me confirm the issue.

> because an array is passed

Which is the array?

> as input
> instead of a single element input.This patch takes elements
> one at a time and passed as input to the condition statement
> which in turn fixes the error.There was an issue which had
> the need for passing a single digit to the condition statement
> which is fixed using regular expression.
> 
> Signed-off-by: Jeffrin Jose T <jeffrin@rajagiritech.edu.in>
> ---
>  tools/testing/selftests/kmod/kmod.sh | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/testing/selftests/kmod/kmod.sh b/tools/testing/selftests/kmod/kmod.sh
> index 0a76314b4414..49b273c3646e 100755
> --- a/tools/testing/selftests/kmod/kmod.sh
> +++ b/tools/testing/selftests/kmod/kmod.sh
> @@ -526,9 +526,12 @@ function run_all_tests()
>  		TEST_ID=${i%:*:*}
>  		ENABLED=$(get_test_enabled $TEST_ID)
>  		TEST_COUNT=$(get_test_count $TEST_ID)
> -		if [[ $ENABLED -eq "1" ]]; then
> -			test_case $TEST_ID $TEST_COUNT
> -		fi

get_test_enabled() is supposed to do what you do open-handed here.
So the better question is why are you getting an array returned
for your version of bash.

> +		for j in $ENABLED ; do
> +		         CHECK=${j#*:*:}
> +			 if [[ $CHECK -eq "1" ]]; then
> +			     test_case $TEST_ID $TEST_COUNT
> +			 fi
> +		done
>  	done
>  }
>  
> -- 
> 2.20.1

  Luis

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

* Fwd: [PATCH] selftests: kmod: worked on errors which breaks the overall execution of the test script
       [not found]   ` <CAG=yYwmeGp7fT_3wPpnpHgzFUdYJuFCThUBaPL=DW9e4OZt_BA@mail.gmail.com>
@ 2019-01-28 18:25     ` Jeffrin Thalakkottoor
  0 siblings, 0 replies; 3+ messages in thread
From: Jeffrin Thalakkottoor @ 2019-01-28 18:25 UTC (permalink / raw)
  To: lkml

---------- Forwarded message ---------
From: Jeffrin Thalakkottoor <jeffrin@rajagiritech.edu.in>
Date: Mon, Jan 28, 2019 at 11:33 PM
Subject: Re: [PATCH] selftests: kmod: worked on errors which breaks
the overall execution of the test script
To: Luis Chamberlain <mcgrof@kernel.org>
Cc: Shuah Khan <shuah@kernel.org>, lkml
<linux-kernel@vger.kernel.org>, <linux-kselftest@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>



>
> on what
> distribution and version of bash does this break?

$cat /etc/issue
Debian GNU/Linux buster/sid \n \l

$
$uname -a
Linux debian 5.0.0-rc1+ #3 SMP Fri Jan 25 21:27:20 IST 2019 x86_64 GNU/Linux
$echo $BASH_VERSION
5.0.0(1)-release
$


>
> The commit log should
> refer to this and it would help me confirm the issue.

i like to send another version of patch which has things in the commit log
>
> > because an array is passed
> Which is the array?

${TEST_DATA#*:*:}
the above stuff sometimes contains array but not initially

>
> get_test_enabled() is supposed to do what you do open-handed here.
> So the better question is why are you getting an array returned
> for your version of bash.
>
iam not returning an array but ${TEST_DATA#*:*:}   sometimes holds array



-- 
software engineer
rajagiri school of engineering and technology


-- 
software engineer
rajagiri school of engineering and technology

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

end of thread, other threads:[~2019-01-28 18:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-17 21:02 [PATCH] selftests: kmod: worked on errors which breaks the overall execution of the test script Jeffrin Jose T
2019-01-22 19:43 ` Luis Chamberlain
     [not found]   ` <CAG=yYwmeGp7fT_3wPpnpHgzFUdYJuFCThUBaPL=DW9e4OZt_BA@mail.gmail.com>
2019-01-28 18:25     ` Fwd: " Jeffrin Thalakkottoor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).