All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [RFC PATCH 0/9] testcases: small improvements with TCONF
@ 2018-04-23  9:46 =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
  2018-04-23  9:46 ` [LTP] [RFC PATCH 1/9] testcases: su: Fix userdel use =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
                   ` (8 more replies)
  0 siblings, 9 replies; 30+ messages in thread
From: =?unknown-8bit?q?Myl=C3=A8ne?= Josserand @ 2018-04-23  9:46 UTC (permalink / raw)
  To: ltp

Hello everyone,

I am currently trying LTP on an embededed device and while running
some tests, I noticed that some of them are returning "FAIL" but most
of the time, it is because some binaries (or options) are not available
on my root filesystem. Instead of returning "FAIL", I think they should 
return "TCONF". This is what this series does.

I haven't finished to run all the tests yet so I will send another bunch
of patches with other improvements. As it is the first time I used this
project and that I contributes to it, reviews or feedbacks on this first
set of patches would be very appreciated.

Thank you in advance!

Best regards,
Mylène

Mylène Josserand (9):
  testcases: su: Fix userdel use
  testcases: ar: Add TST_NEEDS_CMDS on "ar"
  testcases: file: Add TST_NEEDS_CMDS on readelf
  testcases: tar: Add TST_NEEDS_CMDS on gzip and bzip
  testcases: logrotate: Check if "file" command exists
  testcases: wc: Add "unrecognized option" as TCONF
  testcases: df: Add "--printf" option as needed commands
  testcases: test.sh: Check if "getconf" is available
  testcases: cpuset: Check if "getconf" is available

 testcases/commands/ar/ar01                                    | 3 +++
 testcases/commands/df/df01.sh                                 | 2 ++
 testcases/commands/file/file01.sh                             | 2 ++
 testcases/commands/logrotate/logrotate_tests.sh               | 3 ++-
 testcases/commands/su/su01                                    | 6 ++++--
 testcases/commands/tar/tar_tests.sh                           | 2 ++
 testcases/commands/wc/wc01.sh                                 | 2 +-
 testcases/kernel/controllers/cpuset/cpuset_regression_test.sh | 2 ++
 testcases/lib/test.sh                                         | 2 ++
 9 files changed, 20 insertions(+), 4 deletions(-)

-- 
2.11.0


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

* [LTP] [RFC PATCH 1/9] testcases: su: Fix userdel use
  2018-04-23  9:46 [LTP] [RFC PATCH 0/9] testcases: small improvements with TCONF =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
@ 2018-04-23  9:46 ` =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
  2018-04-23 10:13   ` Cyril Hrubis
  2018-04-23  9:46 ` [LTP] [RFC PATCH 2/9] testcases: ar: Add TST_NEEDS_CMDS on "ar" =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 30+ messages in thread
From: =?unknown-8bit?q?Myl=C3=A8ne?= Josserand @ 2018-04-23  9:46 UTC (permalink / raw)
  To: ltp

In case "getent" command is not available in the system,
the userdel command will never be executed and for the
second use, the test will fail with:
     useradd: user 'su_usr1' already exists

Fix that by moving "userdel" command in a new line.

Signed-off-by: Mylène Josserand <mylene.josserand@bootlin.com>
---
 testcases/commands/su/su01 | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/testcases/commands/su/su01 b/testcases/commands/su/su01
index 34386d937..1eedcb636 100755
--- a/testcases/commands/su/su01
+++ b/testcases/commands/su/su01
@@ -86,7 +86,8 @@ rm -f $TEST_ENV_FILE > /dev/null 2>&1
 #Create 1st test user
     #erase user if he may exist , so we can have a clean en
         rm -rf /home/$TEST_USER1
-        getent passwd $TEST_USER1 > /dev/null 2>&1 && userdel $TEST_USER1
+        getent passwd $TEST_USER1 > /dev/null 2>&1
+	userdel $TEST_USER1
 	sleep 1
 
         useradd -m -g users $TEST_USER1
@@ -121,7 +122,8 @@ rm -f $TEST_ENV_FILE > /dev/null 2>&1
 #Create 2nd test user
 	#erase user if he may exist , so we can have a clean en
         rm -rf /home/$TEST_USER2
-        getent passwd $TEST_USER2 > /dev/null 2>&1 && userdel $TEST_USER2
+        getent passwd $TEST_USER2 > /dev/null 2>&1
+	userdel $TEST_USER2
 	sleep 1
 
         useradd -m -g users $TEST_USER2
-- 
2.11.0


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

* [LTP] [RFC PATCH 2/9] testcases: ar: Add TST_NEEDS_CMDS on "ar"
  2018-04-23  9:46 [LTP] [RFC PATCH 0/9] testcases: small improvements with TCONF =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
  2018-04-23  9:46 ` [LTP] [RFC PATCH 1/9] testcases: su: Fix userdel use =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
@ 2018-04-23  9:46 ` =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
  2018-04-23 10:25   ` Cyril Hrubis
  2018-05-16  9:27   ` Petr Vorel
  2018-04-23  9:46 ` [LTP] [RFC PATCH 3/9] testcases: file: Add TST_NEEDS_CMDS on readelf =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
                   ` (6 subsequent siblings)
  8 siblings, 2 replies; 30+ messages in thread
From: =?unknown-8bit?q?Myl=C3=A8ne?= Josserand @ 2018-04-23  9:46 UTC (permalink / raw)
  To: ltp

In case "ar" binary is not available, the test will fail.
It should return a TCONF as we just do not have the binary.

This commit adds TST_NEEDS_CMDS macro on "ar". Thanks to that,
it will return "TCONF" and not "FAIL" when "ar" is not available.

Signed-off-by: Mylène Josserand <mylene.josserand@bootlin.com>
---
 testcases/commands/ar/ar01 | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/testcases/commands/ar/ar01 b/testcases/commands/ar/ar01
index ddab2e0f0..edaa24657 100644
--- a/testcases/commands/ar/ar01
+++ b/testcases/commands/ar/ar01
@@ -22,9 +22,12 @@
 #
 # This is a basic ar command test.
 #
+AR=${AR:=ar}
 TST_CNT=17
 TST_TESTFUNC=test
 TST_NEEDS_TMPDIR=1
+TST_NEEDS_CMDS="$AR"
+
 . tst_test.sh
 
 test1()
-- 
2.11.0


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

* [LTP] [RFC PATCH 3/9] testcases: file: Add TST_NEEDS_CMDS on readelf
  2018-04-23  9:46 [LTP] [RFC PATCH 0/9] testcases: small improvements with TCONF =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
  2018-04-23  9:46 ` [LTP] [RFC PATCH 1/9] testcases: su: Fix userdel use =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
  2018-04-23  9:46 ` [LTP] [RFC PATCH 2/9] testcases: ar: Add TST_NEEDS_CMDS on "ar" =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
@ 2018-04-23  9:46 ` =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
  2018-05-16  9:34   ` Petr Vorel
  2018-04-23  9:46 ` [LTP] [RFC PATCH 4/9] testcases: tar: Add TST_NEEDS_CMDS on gzip and bzip =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 30+ messages in thread
From: =?unknown-8bit?q?Myl=C3=A8ne?= Josserand @ 2018-04-23  9:46 UTC (permalink / raw)
  To: ltp

This test is using "readelf" binary that can be
unavailable on the system.
Instead of failing, it should return a TCONF.

This is what this commit is doing by adding "readelf"
in TST_NEEDS_CMDS macro.

Signed-off-by: Mylène Josserand <mylene.josserand@bootlin.com>
---
 testcases/commands/file/file01.sh | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/testcases/commands/file/file01.sh b/testcases/commands/file/file01.sh
index e04b32e86..b72760e9f 100755
--- a/testcases/commands/file/file01.sh
+++ b/testcases/commands/file/file01.sh
@@ -28,6 +28,8 @@ TST_CNT=20
 TST_SETUP=setup
 TST_TESTFUNC=do_test
 TST_NEEDS_TMPDIR=1
+TST_NEEDS_CMDS="readelf"
+
 . tst_test.sh
 
 setup()
-- 
2.11.0


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

* [LTP] [RFC PATCH 4/9] testcases: tar: Add TST_NEEDS_CMDS on gzip and bzip
  2018-04-23  9:46 [LTP] [RFC PATCH 0/9] testcases: small improvements with TCONF =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
                   ` (2 preceding siblings ...)
  2018-04-23  9:46 ` [LTP] [RFC PATCH 3/9] testcases: file: Add TST_NEEDS_CMDS on readelf =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
@ 2018-04-23  9:46 ` =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
  2018-05-16  9:38   ` Petr Vorel
  2018-04-23  9:46 ` [LTP] [RFC PATCH 5/9] testcases: logrotate: Check if "file" command exists =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 30+ messages in thread
From: =?unknown-8bit?q?Myl=C3=A8ne?= Josserand @ 2018-04-23  9:46 UTC (permalink / raw)
  To: ltp

Add TST_NEEDS_CMDS to return a TCONF in case "gzip"
and "bzip2" binaries are not available on the system.

Signed-off-by: Mylène Josserand <mylene.josserand@bootlin.com>
---
 testcases/commands/tar/tar_tests.sh | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/testcases/commands/tar/tar_tests.sh b/testcases/commands/tar/tar_tests.sh
index 7ac18a4e5..946e9c7b1 100755
--- a/testcases/commands/tar/tar_tests.sh
+++ b/testcases/commands/tar/tar_tests.sh
@@ -27,6 +27,8 @@
 TST_CNT=6
 TST_TESTFUNC=do_test
 TST_NEEDS_TMPDIR=1
+TST_NEEDS_CMDS="gzip bzip2"
+
 . tst_test.sh
 
 TAR_FILES="file1 file2 file3"
-- 
2.11.0


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

* [LTP] [RFC PATCH 5/9] testcases: logrotate: Check if "file" command exists
  2018-04-23  9:46 [LTP] [RFC PATCH 0/9] testcases: small improvements with TCONF =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
                   ` (3 preceding siblings ...)
  2018-04-23  9:46 ` [LTP] [RFC PATCH 4/9] testcases: tar: Add TST_NEEDS_CMDS on gzip and bzip =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
@ 2018-04-23  9:46 ` =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
  2018-05-16  9:45   ` Petr Vorel
  2018-05-16 10:20   ` Petr Vorel
  2018-04-23  9:46 ` [LTP] [RFC PATCH 6/9] testcases: wc: Add "unrecognized option" as TCONF =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
                   ` (3 subsequent siblings)
  8 siblings, 2 replies; 30+ messages in thread
From: =?unknown-8bit?q?Myl=C3=A8ne?= Josserand @ 2018-04-23  9:46 UTC (permalink / raw)
  To: ltp

Add "file" binary in the list of commands to check if
they exist or not.

Signed-off-by: Mylène Josserand <mylene.josserand@bootlin.com>
---
 testcases/commands/logrotate/logrotate_tests.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/testcases/commands/logrotate/logrotate_tests.sh b/testcases/commands/logrotate/logrotate_tests.sh
index f5a22ddde..021972294 100755
--- a/testcases/commands/logrotate/logrotate_tests.sh
+++ b/testcases/commands/logrotate/logrotate_tests.sh
@@ -97,10 +97,11 @@ init()
 		 return $RC
 	fi
 
-	# check if commands tst_*, logrotate, awk exists.
+	# check if commands tst_*, logrotate, awk and file exists.
 	chk_ifexists INIT tst_resm  || return $RC
 	chk_ifexists INIT logrotate || return $RC
 	chk_ifexists INIT awk       || return $RC
+	chk_ifexists INIT file      || return $RC
 
 	return $RC
 }
-- 
2.11.0


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

* [LTP] [RFC PATCH 6/9] testcases: wc: Add "unrecognized option" as TCONF
  2018-04-23  9:46 [LTP] [RFC PATCH 0/9] testcases: small improvements with TCONF =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
                   ` (4 preceding siblings ...)
  2018-04-23  9:46 ` [LTP] [RFC PATCH 5/9] testcases: logrotate: Check if "file" command exists =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
@ 2018-04-23  9:46 ` =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
  2018-05-16 10:00   ` Petr Vorel
  2018-06-04 15:33   ` Petr Vorel
  2018-04-23  9:46 ` [LTP] [RFC PATCH 7/9] testcases: df: Add "--printf" option as needed commands =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
                   ` (2 subsequent siblings)
  8 siblings, 2 replies; 30+ messages in thread
From: =?unknown-8bit?q?Myl=C3=A8ne?= Josserand @ 2018-04-23  9:46 UTC (permalink / raw)
  To: ltp

In case we are using Busybox, for example, some options
may not available and leads to a test failure.
This commit adds "unrecognized option" parsing to return the
test as a TCONF and not FAIL anymore.

Signed-off-by: Mylène Josserand <mylene.josserand@bootlin.com>
---
 testcases/commands/wc/wc01.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/commands/wc/wc01.sh b/testcases/commands/wc/wc01.sh
index e72819c51..74d69e254 100755
--- a/testcases/commands/wc/wc01.sh
+++ b/testcases/commands/wc/wc01.sh
@@ -40,7 +40,7 @@ wc_test()
 
 	eval $wc_cmd > temp 2>&1
 	if [ $? -ne 0 ]; then
-		grep -q -E "unknown option|invalid option" temp
+		grep -q -E "unknown option|invalid option|unrecognized option" temp
 		if [ $? -eq 0 ]; then
 			tst_res TCONF "$wc_cmd not supported."
 		else
-- 
2.11.0


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

* [LTP] [RFC PATCH 7/9] testcases: df: Add "--printf" option as needed commands
  2018-04-23  9:46 [LTP] [RFC PATCH 0/9] testcases: small improvements with TCONF =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
                   ` (5 preceding siblings ...)
  2018-04-23  9:46 ` [LTP] [RFC PATCH 6/9] testcases: wc: Add "unrecognized option" as TCONF =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
@ 2018-04-23  9:46 ` =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
  2018-04-23 10:22   ` Cyril Hrubis
  2018-04-23  9:46 ` [LTP] [RFC PATCH 8/9] testcases: test.sh: Check if "getconf" is available =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
  2018-04-23  9:46 ` [LTP] [RFC PATCH 9/9] testcases: cpuset: " =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
  8 siblings, 1 reply; 30+ messages in thread
From: =?unknown-8bit?q?Myl=C3=A8ne?= Josserand @ 2018-04-23  9:46 UTC (permalink / raw)
  To: ltp

In case Busybox is used with minimal configuration, the option
"--printf" is not available so the test is failing.

Add this option in the needed commands to return a TCONF
if it is not available.

Signed-off-by: Mylène Josserand <mylene.josserand@bootlin.com>
---
 testcases/commands/df/df01.sh | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/testcases/commands/df/df01.sh b/testcases/commands/df/df01.sh
index fbf1e2f2a..147620020 100755
--- a/testcases/commands/df/df01.sh
+++ b/testcases/commands/df/df01.sh
@@ -26,6 +26,8 @@ TST_PARSE_ARGS=parse_args
 TST_NEEDS_ROOT=1
 TST_NEEDS_TMPDIR=1
 TST_NEEDS_DEVICE=1
+TST_NEEDS_CMDS="stat --printf=%f"
+
 . tst_test.sh
 
 usage()
-- 
2.11.0


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

* [LTP] [RFC PATCH 8/9] testcases: test.sh: Check if "getconf" is available
  2018-04-23  9:46 [LTP] [RFC PATCH 0/9] testcases: small improvements with TCONF =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
                   ` (6 preceding siblings ...)
  2018-04-23  9:46 ` [LTP] [RFC PATCH 7/9] testcases: df: Add "--printf" option as needed commands =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
@ 2018-04-23  9:46 ` =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
  2018-04-23 10:17   ` Cyril Hrubis
  2018-04-23  9:46 ` [LTP] [RFC PATCH 9/9] testcases: cpuset: " =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
  8 siblings, 1 reply; 30+ messages in thread
From: =?unknown-8bit?q?Myl=C3=A8ne?= Josserand @ 2018-04-23  9:46 UTC (permalink / raw)
  To: ltp

In case TST_NEEDS_CHECKPOINTS is set to 1, the "getconf"
binary is used. This binary may not be installed in the system
and it will return a FAIL. Instead, add a check on this binary
to return "TCONF" in that case.

Signed-off-by: Mylène Josserand <mylene.josserand@bootlin.com>
---
 testcases/lib/test.sh | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/testcases/lib/test.sh b/testcases/lib/test.sh
index bce9893a9..b27dbf4ab 100644
--- a/testcases/lib/test.sh
+++ b/testcases/lib/test.sh
@@ -421,6 +421,8 @@ fi
 if [ "$TST_NEEDS_CHECKPOINTS" = "1" ]; then
 	LTP_IPC_PATH="/dev/shm/ltp_${TCID}_$$"
 
+	tst_check_cmds "getconf"
+
 	LTP_IPC_SIZE=$(getconf PAGESIZE)
 	if [ $? -ne 0 ]; then
 		tst_brkm TBROK "getconf PAGESIZE failed"
-- 
2.11.0


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

* [LTP] [RFC PATCH 9/9] testcases: cpuset: Check if "getconf" is available
  2018-04-23  9:46 [LTP] [RFC PATCH 0/9] testcases: small improvements with TCONF =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
                   ` (7 preceding siblings ...)
  2018-04-23  9:46 ` [LTP] [RFC PATCH 8/9] testcases: test.sh: Check if "getconf" is available =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
@ 2018-04-23  9:46 ` =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
  2018-04-23 10:19   ` Cyril Hrubis
  8 siblings, 1 reply; 30+ messages in thread
From: =?unknown-8bit?q?Myl=C3=A8ne?= Josserand @ 2018-04-23  9:46 UTC (permalink / raw)
  To: ltp

The "getconf" binary is used by cpuset_regression_test.sh
and may not be installed in the system. The test will fail
but it is a misconfiguration so let's use "tst_check_cmds"
to check if this binary is available and return a TCONF error
if not.

Signed-off-by: Mylène Josserand <mylene.josserand@bootlin.com>
---
 testcases/kernel/controllers/cpuset/cpuset_regression_test.sh | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/testcases/kernel/controllers/cpuset/cpuset_regression_test.sh b/testcases/kernel/controllers/cpuset/cpuset_regression_test.sh
index 4a104a3ad..96a57955c 100755
--- a/testcases/kernel/controllers/cpuset/cpuset_regression_test.sh
+++ b/testcases/kernel/controllers/cpuset/cpuset_regression_test.sh
@@ -34,6 +34,8 @@ setup()
 		tst_brkm TCONF "Test must be run with kernel 3.18.0 or newer"
 	fi
 
+	tst_check_cmds "getconf"
+
 	local cpu_num=$(getconf _NPROCESSORS_ONLN)
 	if [ $cpu_num -lt 2 ]; then
 		tst_brkm TCONF "We need 2 cpus at least to have test"
-- 
2.11.0


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

* [LTP] [RFC PATCH 1/9] testcases: su: Fix userdel use
  2018-04-23  9:46 ` [LTP] [RFC PATCH 1/9] testcases: su: Fix userdel use =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
@ 2018-04-23 10:13   ` Cyril Hrubis
  2018-04-23 12:51     ` Thomas Petazzoni
  0 siblings, 1 reply; 30+ messages in thread
From: Cyril Hrubis @ 2018-04-23 10:13 UTC (permalink / raw)
  To: ltp

Hi!
> In case "getent" command is not available in the system,
> the userdel command will never be executed and for the
> second use, the test will fail with:
>      useradd: user 'su_usr1' already exists
> 
> Fix that by moving "userdel" command in a new line.
> 
> Signed-off-by: Myl??ne Josserand <mylene.josserand@bootlin.com>
> ---
>  testcases/commands/su/su01 | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/testcases/commands/su/su01 b/testcases/commands/su/su01
> index 34386d937..1eedcb636 100755
> --- a/testcases/commands/su/su01
> +++ b/testcases/commands/su/su01
> @@ -86,7 +86,8 @@ rm -f $TEST_ENV_FILE > /dev/null 2>&1
>  #Create 1st test user
>      #erase user if he may exist , so we can have a clean en
>          rm -rf /home/$TEST_USER1
> -        getent passwd $TEST_USER1 > /dev/null 2>&1 && userdel $TEST_USER1
> +        getent passwd $TEST_USER1 > /dev/null 2>&1
> +	userdel $TEST_USER1

I'm pretty sure this was intended to be:

"delete user only if it exists already"

So the whole getent line is useless after this change.

Also I suppose we shouldn't delete users in the test setup anyways, but
the whole tests is a mess and should be cleaned up...

-- 
Cyril Hrubis
chrubis@suse.cz

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

* [LTP] [RFC PATCH 8/9] testcases: test.sh: Check if "getconf" is available
  2018-04-23  9:46 ` [LTP] [RFC PATCH 8/9] testcases: test.sh: Check if "getconf" is available =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
@ 2018-04-23 10:17   ` Cyril Hrubis
  2018-04-27  9:39     ` =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
  0 siblings, 1 reply; 30+ messages in thread
From: Cyril Hrubis @ 2018-04-23 10:17 UTC (permalink / raw)
  To: ltp

Hi!
> In case TST_NEEDS_CHECKPOINTS is set to 1, the "getconf"
> binary is used. This binary may not be installed in the system
> and it will return a FAIL. Instead, add a check on this binary
> to return "TCONF" in that case.
> 
> Signed-off-by: Myl??ne Josserand <mylene.josserand@bootlin.com>
> ---
>  testcases/lib/test.sh | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/testcases/lib/test.sh b/testcases/lib/test.sh
> index bce9893a9..b27dbf4ab 100644
> --- a/testcases/lib/test.sh
> +++ b/testcases/lib/test.sh
> @@ -421,6 +421,8 @@ fi
>  if [ "$TST_NEEDS_CHECKPOINTS" = "1" ]; then
>  	LTP_IPC_PATH="/dev/shm/ltp_${TCID}_$$"
>  
> +	tst_check_cmds "getconf"
> +
>  	LTP_IPC_SIZE=$(getconf PAGESIZE)
>  	if [ $? -ne 0 ]; then
>  		tst_brkm TBROK "getconf PAGESIZE failed"

This would be better fixed by creating a binary helper in testcases/lib/
same as we did for example for sub-second sleep with tst_sleep.c. We can
create tst_pagesize.c that would just print the result of getpagesize().

-- 
Cyril Hrubis
chrubis@suse.cz

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

* [LTP] [RFC PATCH 9/9] testcases: cpuset: Check if "getconf" is available
  2018-04-23  9:46 ` [LTP] [RFC PATCH 9/9] testcases: cpuset: " =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
@ 2018-04-23 10:19   ` Cyril Hrubis
  0 siblings, 0 replies; 30+ messages in thread
From: Cyril Hrubis @ 2018-04-23 10:19 UTC (permalink / raw)
  To: ltp

Hi!
> The "getconf" binary is used by cpuset_regression_test.sh
> and may not be installed in the system. The test will fail
> but it is a misconfiguration so let's use "tst_check_cmds"
> to check if this binary is available and return a TCONF error
> if not.
> 
> Signed-off-by: Myl??ne Josserand <mylene.josserand@bootlin.com>
> ---
>  testcases/kernel/controllers/cpuset/cpuset_regression_test.sh | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/testcases/kernel/controllers/cpuset/cpuset_regression_test.sh b/testcases/kernel/controllers/cpuset/cpuset_regression_test.sh
> index 4a104a3ad..96a57955c 100755
> --- a/testcases/kernel/controllers/cpuset/cpuset_regression_test.sh
> +++ b/testcases/kernel/controllers/cpuset/cpuset_regression_test.sh
> @@ -34,6 +34,8 @@ setup()
>  		tst_brkm TCONF "Test must be run with kernel 3.18.0 or newer"
>  	fi
>  
> +	tst_check_cmds "getconf"
> +
>  	local cpu_num=$(getconf _NPROCESSORS_ONLN)
>  	if [ $cpu_num -lt 2 ]; then
>  		tst_brkm TCONF "We need 2 cpus at least to have test"

Hmm, or we may put something as tst_getconf.c into the
testcases/lib/ directory and implement subset of variables needed for
the tests there.

-- 
Cyril Hrubis
chrubis@suse.cz

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

* [LTP] [RFC PATCH 7/9] testcases: df: Add "--printf" option as needed commands
  2018-04-23  9:46 ` [LTP] [RFC PATCH 7/9] testcases: df: Add "--printf" option as needed commands =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
@ 2018-04-23 10:22   ` Cyril Hrubis
  2018-04-23 13:27     ` Petr Vorel
  0 siblings, 1 reply; 30+ messages in thread
From: Cyril Hrubis @ 2018-04-23 10:22 UTC (permalink / raw)
  To: ltp

Hi!
> diff --git a/testcases/commands/df/df01.sh b/testcases/commands/df/df01.sh
> index fbf1e2f2a..147620020 100755
> --- a/testcases/commands/df/df01.sh
> +++ b/testcases/commands/df/df01.sh
> @@ -26,6 +26,8 @@ TST_PARSE_ARGS=parse_args
>  TST_NEEDS_ROOT=1
>  TST_NEEDS_TMPDIR=1
>  TST_NEEDS_DEVICE=1
> +TST_NEEDS_CMDS="stat --printf=%f"

Does this work? Because when I do something as:

$ command -v stat --nonexistent-option
/usr/bin/stat
$ echo $?
0

-- 
Cyril Hrubis
chrubis@suse.cz

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

* [LTP] [RFC PATCH 2/9] testcases: ar: Add TST_NEEDS_CMDS on "ar"
  2018-04-23  9:46 ` [LTP] [RFC PATCH 2/9] testcases: ar: Add TST_NEEDS_CMDS on "ar" =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
@ 2018-04-23 10:25   ` Cyril Hrubis
  2018-04-27 13:37     ` =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
  2018-05-16  9:27   ` Petr Vorel
  1 sibling, 1 reply; 30+ messages in thread
From: Cyril Hrubis @ 2018-04-23 10:25 UTC (permalink / raw)
  To: ltp

Hi!
And the rest of the patches I haven't commented on looks good to me.

-- 
Cyril Hrubis
chrubis@suse.cz

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

* [LTP] [RFC PATCH 1/9] testcases: su: Fix userdel use
  2018-04-23 10:13   ` Cyril Hrubis
@ 2018-04-23 12:51     ` Thomas Petazzoni
  0 siblings, 0 replies; 30+ messages in thread
From: Thomas Petazzoni @ 2018-04-23 12:51 UTC (permalink / raw)
  To: ltp

Hello,

On Mon, 23 Apr 2018 12:13:09 +0200, Cyril Hrubis wrote:

> > diff --git a/testcases/commands/su/su01 b/testcases/commands/su/su01
> > index 34386d937..1eedcb636 100755
> > --- a/testcases/commands/su/su01
> > +++ b/testcases/commands/su/su01
> > @@ -86,7 +86,8 @@ rm -f $TEST_ENV_FILE > /dev/null 2>&1
> >  #Create 1st test user
> >      #erase user if he may exist , so we can have a clean en
> >          rm -rf /home/$TEST_USER1
> > -        getent passwd $TEST_USER1 > /dev/null 2>&1 && userdel $TEST_USER1
> > +        getent passwd $TEST_USER1 > /dev/null 2>&1
> > +	userdel $TEST_USER1  
> 
> I'm pretty sure this was intended to be:
> 
> "delete user only if it exists already"
> 
> So the whole getent line is useless after this change.

Perhaps the getent line can be replaced with something like:

grep -q "^$TEST_USER1:" /etc/passwd && userdel $TEST_USER1

Best regards,

Thomas Petazzoni
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

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

* [LTP] [RFC PATCH 7/9] testcases: df: Add "--printf" option as needed commands
  2018-04-23 10:22   ` Cyril Hrubis
@ 2018-04-23 13:27     ` Petr Vorel
  2018-04-27  9:38       ` =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
  0 siblings, 1 reply; 30+ messages in thread
From: Petr Vorel @ 2018-04-23 13:27 UTC (permalink / raw)
  To: ltp

Hi,

> > diff --git a/testcases/commands/df/df01.sh b/testcases/commands/df/df01.sh
> > index fbf1e2f2a..147620020 100755
> > --- a/testcases/commands/df/df01.sh
> > +++ b/testcases/commands/df/df01.sh
> > @@ -26,6 +26,8 @@ TST_PARSE_ARGS=parse_args
> >  TST_NEEDS_ROOT=1
> >  TST_NEEDS_TMPDIR=1
> >  TST_NEEDS_DEVICE=1
> > +TST_NEEDS_CMDS="stat --printf=%f"

> Does this work? Because when I do something as:

> $ command -v stat --nonexistent-option
> /usr/bin/stat
> $ echo $?
> 0

Checking whole output (not just binary file / script) presence in $PATH is what
tst_verify_cmd in my patch [1] does.

[1] https://patchwork.ozlabs.org/patch/892779/


Kind regards,
Petr

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

* [LTP] [RFC PATCH 7/9] testcases: df: Add "--printf" option as needed commands
  2018-04-23 13:27     ` Petr Vorel
@ 2018-04-27  9:38       ` =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
  0 siblings, 0 replies; 30+ messages in thread
From: =?unknown-8bit?q?Myl=C3=A8ne?= Josserand @ 2018-04-27  9:38 UTC (permalink / raw)
  To: ltp

Hi,

On Mon, 23 Apr 2018 15:27:27 +0200
Petr Vorel <pvorel@suse.cz> wrote:

> Hi,
> 
> > > diff --git a/testcases/commands/df/df01.sh b/testcases/commands/df/df01.sh
> > > index fbf1e2f2a..147620020 100755
> > > --- a/testcases/commands/df/df01.sh
> > > +++ b/testcases/commands/df/df01.sh
> > > @@ -26,6 +26,8 @@ TST_PARSE_ARGS=parse_args
> > >  TST_NEEDS_ROOT=1
> > >  TST_NEEDS_TMPDIR=1
> > >  TST_NEEDS_DEVICE=1
> > > +TST_NEEDS_CMDS="stat --printf=%f"  
> 
> > Does this work? Because when I do something as:  
> 
> > $ command -v stat --nonexistent-option
> > /usr/bin/stat
> > $ echo $?
> > 0  
> 
> Checking whole output (not just binary file / script) presence in $PATH is what
> tst_verify_cmd in my patch [1] does.
> 
> [1] https://patchwork.ozlabs.org/patch/892779/
> 
> 
> Kind regards,
> Petr

Indeed, I saw your patch just after I sent my series :)

I will test your "tst_verify_cmd" but it seems to fit my needs. I will
keep you updated.

Best regards,

-- 
Mylène Josserand, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
http://bootlin.com

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

* [LTP] [RFC PATCH 8/9] testcases: test.sh: Check if "getconf" is available
  2018-04-23 10:17   ` Cyril Hrubis
@ 2018-04-27  9:39     ` =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
  0 siblings, 0 replies; 30+ messages in thread
From: =?unknown-8bit?q?Myl=C3=A8ne?= Josserand @ 2018-04-27  9:39 UTC (permalink / raw)
  To: ltp

Hello,

On Mon, 23 Apr 2018 12:17:53 +0200
Cyril Hrubis <chrubis@suse.cz> wrote:

> Hi!
> > In case TST_NEEDS_CHECKPOINTS is set to 1, the "getconf"
> > binary is used. This binary may not be installed in the system
> > and it will return a FAIL. Instead, add a check on this binary
> > to return "TCONF" in that case.
> > 
> > Signed-off-by: Myl??ne Josserand <mylene.josserand@bootlin.com>
> > ---
> >  testcases/lib/test.sh | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/testcases/lib/test.sh b/testcases/lib/test.sh
> > index bce9893a9..b27dbf4ab 100644
> > --- a/testcases/lib/test.sh
> > +++ b/testcases/lib/test.sh
> > @@ -421,6 +421,8 @@ fi
> >  if [ "$TST_NEEDS_CHECKPOINTS" = "1" ]; then
> >  	LTP_IPC_PATH="/dev/shm/ltp_${TCID}_$$"
> >  
> > +	tst_check_cmds "getconf"
> > +
> >  	LTP_IPC_SIZE=$(getconf PAGESIZE)
> >  	if [ $? -ne 0 ]; then
> >  		tst_brkm TBROK "getconf PAGESIZE failed"  
> 
> This would be better fixed by creating a binary helper in testcases/lib/
> same as we did for example for sub-second sleep with tst_sleep.c. We can
> create tst_pagesize.c that would just print the result of getpagesize().
> 

Okay, thank you for the hint. I will have a look.

Best regards,

-- 
Mylène Josserand, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
http://bootlin.com

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

* [LTP] [RFC PATCH 2/9] testcases: ar: Add TST_NEEDS_CMDS on "ar"
  2018-04-23 10:25   ` Cyril Hrubis
@ 2018-04-27 13:37     ` =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
  0 siblings, 0 replies; 30+ messages in thread
From: =?unknown-8bit?q?Myl=C3=A8ne?= Josserand @ 2018-04-27 13:37 UTC (permalink / raw)
  To: ltp

Hello,

On Mon, 23 Apr 2018 12:25:25 +0200
Cyril Hrubis <chrubis@suse.cz> wrote:

> Hi!
> And the rest of the patches I haven't commented on looks good to me.
> 

Okay, thank you for your reviews!

Best regards

-- 
Mylène Josserand, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
http://bootlin.com

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

* [LTP] [RFC PATCH 2/9] testcases: ar: Add TST_NEEDS_CMDS on "ar"
  2018-04-23  9:46 ` [LTP] [RFC PATCH 2/9] testcases: ar: Add TST_NEEDS_CMDS on "ar" =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
  2018-04-23 10:25   ` Cyril Hrubis
@ 2018-05-16  9:27   ` Petr Vorel
  1 sibling, 0 replies; 30+ messages in thread
From: Petr Vorel @ 2018-05-16  9:27 UTC (permalink / raw)
  To: ltp

Hi Mylène,

> In case "ar" binary is not available, the test will fail.
> It should return a TCONF as we just do not have the binary.

> This commit adds TST_NEEDS_CMDS macro on "ar". Thanks to that,
> it will return "TCONF" and not "FAIL" when "ar" is not available.

> Signed-off-by: Mylène Josserand <mylene.josserand@bootlin.com>
> ---
>  testcases/commands/ar/ar01 | 3 +++
>  1 file changed, 3 insertions(+)

> diff --git a/testcases/commands/ar/ar01 b/testcases/commands/ar/ar01
> index ddab2e0f0..edaa24657 100644
> --- a/testcases/commands/ar/ar01
> +++ b/testcases/commands/ar/ar01
> @@ -22,9 +22,12 @@

>  # This is a basic ar command test.

> +AR=${AR:=ar}
>  TST_CNT=17
>  TST_TESTFUNC=test
>  TST_NEEDS_TMPDIR=1
> +TST_NEEDS_CMDS="$AR"
> +
>  . tst_test.sh

>  test1()

Merged with minor change:
-AR=${AR:=ar}
+AR="${AR:=ar}"

Thanks for your contributions.

Kind regards,
Petr

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

* [LTP] [RFC PATCH 3/9] testcases: file: Add TST_NEEDS_CMDS on readelf
  2018-04-23  9:46 ` [LTP] [RFC PATCH 3/9] testcases: file: Add TST_NEEDS_CMDS on readelf =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
@ 2018-05-16  9:34   ` Petr Vorel
  0 siblings, 0 replies; 30+ messages in thread
From: Petr Vorel @ 2018-05-16  9:34 UTC (permalink / raw)
  To: ltp

Hi Mylène,

> This test is using "readelf" binary that can be
> unavailable on the system.
> Instead of failing, it should return a TCONF.

> This is what this commit is doing by adding "readelf"
> in TST_NEEDS_CMDS macro.

> Signed-off-by: Mylène Josserand <mylene.josserand@bootlin.com>
> ---
>  testcases/commands/file/file01.sh | 2 ++
>  1 file changed, 2 insertions(+)

> diff --git a/testcases/commands/file/file01.sh b/testcases/commands/file/file01.sh
> index e04b32e86..b72760e9f 100755
> --- a/testcases/commands/file/file01.sh
> +++ b/testcases/commands/file/file01.sh
> @@ -28,6 +28,8 @@ TST_CNT=20
>  TST_SETUP=setup
>  TST_TESTFUNC=do_test
>  TST_NEEDS_TMPDIR=1
> +TST_NEEDS_CMDS="readelf"
> +
>  . tst_test.sh

>  setup()

Pushed, thanks!


Kind regards,
Petr

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

* [LTP] [RFC PATCH 4/9] testcases: tar: Add TST_NEEDS_CMDS on gzip and bzip
  2018-04-23  9:46 ` [LTP] [RFC PATCH 4/9] testcases: tar: Add TST_NEEDS_CMDS on gzip and bzip =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
@ 2018-05-16  9:38   ` Petr Vorel
  0 siblings, 0 replies; 30+ messages in thread
From: Petr Vorel @ 2018-05-16  9:38 UTC (permalink / raw)
  To: ltp

Hi Mylène,

> Add TST_NEEDS_CMDS to return a TCONF in case "gzip"
> and "bzip2" binaries are not available on the system.

> Signed-off-by: Mylène Josserand <mylene.josserand@bootlin.com>
> ---
>  testcases/commands/tar/tar_tests.sh | 2 ++
>  1 file changed, 2 insertions(+)

> diff --git a/testcases/commands/tar/tar_tests.sh b/testcases/commands/tar/tar_tests.sh
> index 7ac18a4e5..946e9c7b1 100755
> --- a/testcases/commands/tar/tar_tests.sh
> +++ b/testcases/commands/tar/tar_tests.sh
> @@ -27,6 +27,8 @@
>  TST_CNT=6
>  TST_TESTFUNC=do_test
>  TST_NEEDS_TMPDIR=1
> +TST_NEEDS_CMDS="gzip bzip2"
> +
>  . tst_test.sh

>  TAR_FILES="file1 file2 file3"

Pushed, thanks!


Kind regards,
Petr

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

* [LTP] [RFC PATCH 5/9] testcases: logrotate: Check if "file" command exists
  2018-04-23  9:46 ` [LTP] [RFC PATCH 5/9] testcases: logrotate: Check if "file" command exists =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
@ 2018-05-16  9:45   ` Petr Vorel
  2018-05-16 10:20   ` Petr Vorel
  1 sibling, 0 replies; 30+ messages in thread
From: Petr Vorel @ 2018-05-16  9:45 UTC (permalink / raw)
  To: ltp

Hi Mylène,

> Add "file" binary in the list of commands to check if
> they exist or not.

> Signed-off-by: Mylène Josserand <mylene.josserand@bootlin.com>
> ---
>  testcases/commands/logrotate/logrotate_tests.sh | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

> diff --git a/testcases/commands/logrotate/logrotate_tests.sh b/testcases/commands/logrotate/logrotate_tests.sh
> index f5a22ddde..021972294 100755
> --- a/testcases/commands/logrotate/logrotate_tests.sh
> +++ b/testcases/commands/logrotate/logrotate_tests.sh
> @@ -97,10 +97,11 @@ init()
>  		 return $RC
>  	fi

> -	# check if commands tst_*, logrotate, awk exists.
> +	# check if commands tst_*, logrotate, awk and file exists.
>  	chk_ifexists INIT tst_resm  || return $RC
>  	chk_ifexists INIT logrotate || return $RC
>  	chk_ifexists INIT awk       || return $RC
> +	chk_ifexists INIT file      || return $RC

>  	return $RC
>  }

Pushed, thanks.


Kind regards,
Petr

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

* [LTP] [RFC PATCH 6/9] testcases: wc: Add "unrecognized option" as TCONF
  2018-04-23  9:46 ` [LTP] [RFC PATCH 6/9] testcases: wc: Add "unrecognized option" as TCONF =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
@ 2018-05-16 10:00   ` Petr Vorel
  2018-05-29 16:32     ` =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
  2018-06-04 15:33   ` Petr Vorel
  1 sibling, 1 reply; 30+ messages in thread
From: Petr Vorel @ 2018-05-16 10:00 UTC (permalink / raw)
  To: ltp

Hi Mylène,
> In case we are using Busybox, for example, some options
> may not available and leads to a test failure.
> This commit adds "unrecognized option" parsing to return the
> test as a TCONF and not FAIL anymore.

> Signed-off-by: Mylène Josserand <mylene.josserand@bootlin.com>
> ---
>  testcases/commands/wc/wc01.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

> diff --git a/testcases/commands/wc/wc01.sh b/testcases/commands/wc/wc01.sh
> index e72819c51..74d69e254 100755
> --- a/testcases/commands/wc/wc01.sh
> +++ b/testcases/commands/wc/wc01.sh
> @@ -40,7 +40,7 @@ wc_test()

>  	eval $wc_cmd > temp 2>&1
>  	if [ $? -ne 0 ]; then
> -		grep -q -E "unknown option|invalid option" temp
> +		grep -q -E "unknown option|invalid option|unrecognized option" temp
What exactly needs "unrecognized option".
I haven't found it in busybox sources neither in busybox git log.

>  		if [ $? -eq 0 ]; then
>  			tst_res TCONF "$wc_cmd not supported."
>  		else


Kind regards,
Petr

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

* [LTP] [RFC PATCH 5/9] testcases: logrotate: Check if "file" command exists
  2018-04-23  9:46 ` [LTP] [RFC PATCH 5/9] testcases: logrotate: Check if "file" command exists =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
  2018-05-16  9:45   ` Petr Vorel
@ 2018-05-16 10:20   ` Petr Vorel
  1 sibling, 0 replies; 30+ messages in thread
From: Petr Vorel @ 2018-05-16 10:20 UTC (permalink / raw)
  To: ltp

Hi Mylène,

> Add "file" binary in the list of commands to check if
> they exist or not.

> Signed-off-by: Mylène Josserand <mylene.josserand@bootlin.com>
> ---
>  testcases/commands/logrotate/logrotate_tests.sh | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

> diff --git a/testcases/commands/logrotate/logrotate_tests.sh b/testcases/commands/logrotate/logrotate_tests.sh
> index f5a22ddde..021972294 100755
> --- a/testcases/commands/logrotate/logrotate_tests.sh
> +++ b/testcases/commands/logrotate/logrotate_tests.sh
> @@ -97,10 +97,11 @@ init()
>  		 return $RC
>  	fi

> -	# check if commands tst_*, logrotate, awk exists.
> +	# check if commands tst_*, logrotate, awk and file exists.
>  	chk_ifexists INIT tst_resm  || return $RC
>  	chk_ifexists INIT logrotate || return $RC
>  	chk_ifexists INIT awk       || return $RC
> +	chk_ifexists INIT file      || return $RC

>  	return $RC
>  }

Pushed, thanks.


Kind regards,
Petr

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

* [LTP] [RFC PATCH 6/9] testcases: wc: Add "unrecognized option" as TCONF
  2018-05-16 10:00   ` Petr Vorel
@ 2018-05-29 16:32     ` =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
  2018-06-04 15:22       ` Petr Vorel
  0 siblings, 1 reply; 30+ messages in thread
From: =?unknown-8bit?q?Myl=C3=A8ne?= Josserand @ 2018-05-29 16:32 UTC (permalink / raw)
  To: ltp

Hello Petr,

On Wed, 16 May 2018 12:00:55 +0200
Petr Vorel <pvorel@suse.cz> wrote:

> Hi Mylène,
> > In case we are using Busybox, for example, some options
> > may not available and leads to a test failure.
> > This commit adds "unrecognized option" parsing to return the
> > test as a TCONF and not FAIL anymore.  
> 
> > Signed-off-by: Mylène Josserand <mylene.josserand@bootlin.com>
> > ---
> >  testcases/commands/wc/wc01.sh | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)  
> 
> > diff --git a/testcases/commands/wc/wc01.sh b/testcases/commands/wc/wc01.sh
> > index e72819c51..74d69e254 100755
> > --- a/testcases/commands/wc/wc01.sh
> > +++ b/testcases/commands/wc/wc01.sh
> > @@ -40,7 +40,7 @@ wc_test()  
> 
> >  	eval $wc_cmd > temp 2>&1
> >  	if [ $? -ne 0 ]; then
> > -		grep -q -E "unknown option|invalid option" temp
> > +		grep -q -E "unknown option|invalid option|unrecognized option" temp  
> What exactly needs "unrecognized option".
> I haven't found it in busybox sources neither in busybox git log.

Just in case, this is what I get with my busybox (v1.24.1):

# wc --max-line-length
wc: unrecognized option '--max-line-length'
BusyBox v1.24.1 (2018-02-10 17:35:25 CET) multi-call binary.

Usage: wc [-clwL] [FILE]...

I looked very quickly and it seems to be glibc with "getopt" function
that prints this error:
https://sourceware.org/git/?p=glibc.git;a=blob;f=posix/getopt.c#l309

> 
> >  		if [ $? -eq 0 ]; then
> >  			tst_res TCONF "$wc_cmd not supported."
> >  		else  
> 
> 
> Kind regards,
> Petr

Best regards,

-- 
Mylène Josserand, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
http://bootlin.com

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

* [LTP] [RFC PATCH 6/9] testcases: wc: Add "unrecognized option" as TCONF
  2018-05-29 16:32     ` =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
@ 2018-06-04 15:22       ` Petr Vorel
  2018-06-05  6:21         ` =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
  0 siblings, 1 reply; 30+ messages in thread
From: Petr Vorel @ 2018-06-04 15:22 UTC (permalink / raw)
  To: ltp

Hi Mylène,

> > I haven't found it in busybox sources neither in busybox git log.

> Just in case, this is what I get with my busybox (v1.24.1):

> # wc --max-line-length
> wc: unrecognized option '--max-line-length'
> BusyBox v1.24.1 (2018-02-10 17:35:25 CET) multi-call binary.

> Usage: wc [-clwL] [FILE]...

> I looked very quickly and it seems to be glibc with "getopt" function
> that prints this error:
> https://sourceware.org/git/?p=glibc.git;a=blob;f=posix/getopt.c#l309

Thanks for debugging. Indeed, it really uses getopts() from libc, thus
libc dependent - busybox with musl has it with comma:
wc: unrecognized option: max-line-length

But all libraries common libc libraries (glibc, musl, uclibc-ng) has string "unrecognized
option" => make sense to add the patch.

Acked-by: Petr Vorel <pvorel@suse.cz>


Kind regards,
Petr

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

* [LTP] [RFC PATCH 6/9] testcases: wc: Add "unrecognized option" as TCONF
  2018-04-23  9:46 ` [LTP] [RFC PATCH 6/9] testcases: wc: Add "unrecognized option" as TCONF =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
  2018-05-16 10:00   ` Petr Vorel
@ 2018-06-04 15:33   ` Petr Vorel
  1 sibling, 0 replies; 30+ messages in thread
From: Petr Vorel @ 2018-06-04 15:33 UTC (permalink / raw)
  To: ltp

Hi Mylène,

> In case we are using Busybox, for example, some options
> may not available and leads to a test failure.
> This commit adds "unrecognized option" parsing to return the
> test as a TCONF and not FAIL anymore.
...
>  testcases/commands/wc/wc01.sh | 2 +-
...
> -		grep -q -E "unknown option|invalid option" temp
> +		grep -q -E "unknown option|invalid option|unrecognized option" temp

Pushed, thanks!


Kind regards,
Petr

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

* [LTP] [RFC PATCH 6/9] testcases: wc: Add "unrecognized option" as TCONF
  2018-06-04 15:22       ` Petr Vorel
@ 2018-06-05  6:21         ` =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
  0 siblings, 0 replies; 30+ messages in thread
From: =?unknown-8bit?q?Myl=C3=A8ne?= Josserand @ 2018-06-05  6:21 UTC (permalink / raw)
  To: ltp

Hi Petr,

On Mon, 4 Jun 2018 17:22:21 +0200
Petr Vorel <pvorel@suse.cz> wrote:

> Hi Mylène,
> 
> > > I haven't found it in busybox sources neither in busybox git log.  
> 
> > Just in case, this is what I get with my busybox (v1.24.1):  
> 
> > # wc --max-line-length
> > wc: unrecognized option '--max-line-length'
> > BusyBox v1.24.1 (2018-02-10 17:35:25 CET) multi-call binary.  
> 
> > Usage: wc [-clwL] [FILE]...  
> 
> > I looked very quickly and it seems to be glibc with "getopt" function
> > that prints this error:
> > https://sourceware.org/git/?p=glibc.git;a=blob;f=posix/getopt.c#l309  
> 
> Thanks for debugging. Indeed, it really uses getopts() from libc, thus
> libc dependent - busybox with musl has it with comma:
> wc: unrecognized option: max-line-length
> 
> But all libraries common libc libraries (glibc, musl, uclibc-ng) has string "unrecognized
> option" => make sense to add the patch.

Oh yes, I did not check other C library, great to know that
"unrecognized option" is common.

Thanks for the review and for the pushed!

Best regards,

-- 
Mylène Josserand, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
http://bootlin.com

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

end of thread, other threads:[~2018-06-05  6:21 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-23  9:46 [LTP] [RFC PATCH 0/9] testcases: small improvements with TCONF =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
2018-04-23  9:46 ` [LTP] [RFC PATCH 1/9] testcases: su: Fix userdel use =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
2018-04-23 10:13   ` Cyril Hrubis
2018-04-23 12:51     ` Thomas Petazzoni
2018-04-23  9:46 ` [LTP] [RFC PATCH 2/9] testcases: ar: Add TST_NEEDS_CMDS on "ar" =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
2018-04-23 10:25   ` Cyril Hrubis
2018-04-27 13:37     ` =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
2018-05-16  9:27   ` Petr Vorel
2018-04-23  9:46 ` [LTP] [RFC PATCH 3/9] testcases: file: Add TST_NEEDS_CMDS on readelf =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
2018-05-16  9:34   ` Petr Vorel
2018-04-23  9:46 ` [LTP] [RFC PATCH 4/9] testcases: tar: Add TST_NEEDS_CMDS on gzip and bzip =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
2018-05-16  9:38   ` Petr Vorel
2018-04-23  9:46 ` [LTP] [RFC PATCH 5/9] testcases: logrotate: Check if "file" command exists =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
2018-05-16  9:45   ` Petr Vorel
2018-05-16 10:20   ` Petr Vorel
2018-04-23  9:46 ` [LTP] [RFC PATCH 6/9] testcases: wc: Add "unrecognized option" as TCONF =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
2018-05-16 10:00   ` Petr Vorel
2018-05-29 16:32     ` =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
2018-06-04 15:22       ` Petr Vorel
2018-06-05  6:21         ` =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
2018-06-04 15:33   ` Petr Vorel
2018-04-23  9:46 ` [LTP] [RFC PATCH 7/9] testcases: df: Add "--printf" option as needed commands =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
2018-04-23 10:22   ` Cyril Hrubis
2018-04-23 13:27     ` Petr Vorel
2018-04-27  9:38       ` =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
2018-04-23  9:46 ` [LTP] [RFC PATCH 8/9] testcases: test.sh: Check if "getconf" is available =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
2018-04-23 10:17   ` Cyril Hrubis
2018-04-27  9:39     ` =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
2018-04-23  9:46 ` [LTP] [RFC PATCH 9/9] testcases: cpuset: " =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
2018-04-23 10:19   ` 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.