linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests/mount: output error messages when mount test fail
       [not found] <1427957214-40367-1-git-send-email-zhenzhang.zhang@huawei.com>
@ 2015-04-02  6:52 ` Zhang Zhen
  2015-04-02 14:21   ` Shuah Khan
                     ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Zhang Zhen @ 2015-04-02  6:52 UTC (permalink / raw)
  To: linux-api, Linux Kernel Mailing List; +Cc: shuahkh, mpe, ebiederm

Without this patch, if /proc/self/uid_map is not exist,
the mount test case will fail and no any prompting.

After applied this patch, the case will prompt why it fail.
Just as follows:
root@kernel-host:/opt/kernel> make -C tools/testing/selftests TARGETS=mount run_tests
make: Entering directory `/opt/kernel/tools/testing/selftests'
for TARGET in mount; do \
                make -C $TARGET; \
        done;
make[1]: Entering directory `/opt/kernel/tools/testing/selftests/mount'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/opt/kernel/tools/testing/selftests/mount'
for TARGET in mount; do \
                make -C $TARGET run_tests; \
        done;
make[1]: Entering directory `/opt/kernel/tools/testing/selftests/mount'
ERROR: No /proc/self/uid_map exist
make[1]: Leaving directory `/opt/kernel/tools/testing/selftests/mount'
make: Leaving directory `/opt/kernel/tools/testing/selftests'

Signed-off-by: Zhang Zhen <zhenzhang.zhang@huawei.com>
---
 tools/testing/selftests/mount/Makefile | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/mount/Makefile b/tools/testing/selftests/mount/Makefile
index a5b367f..b3266db 100644
--- a/tools/testing/selftests/mount/Makefile
+++ b/tools/testing/selftests/mount/Makefile
@@ -8,7 +8,12 @@ unprivileged-remount-test: unprivileged-remount-test.c
 include ../lib.mk

 TEST_PROGS := unprivileged-remount-test
-override RUN_TESTS := if [ -f /proc/self/uid_map ] ; then ./unprivileged-remount-test ; fi
+override RUN_TESTS :=  @if [ -f /proc/self/uid_map ] ; \
+			then	\
+				./unprivileged-remount-test ; \
+			else	\
+				echo "ERROR: No /proc/self/uid_map exist" ; \
+			fi
 override EMIT_TESTS := echo "$(RUN_TESTS)"

 clean:
-- 
1.8.5.5


.





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

* Re: [PATCH] selftests/mount: output error messages when mount test fail
  2015-04-02  6:52 ` [PATCH] selftests/mount: output error messages when mount test fail Zhang Zhen
@ 2015-04-02 14:21   ` Shuah Khan
  2015-04-02 18:03   ` Shuah Khan
  2015-04-02 18:56   ` Eric W. Biederman
  2 siblings, 0 replies; 5+ messages in thread
From: Shuah Khan @ 2015-04-02 14:21 UTC (permalink / raw)
  To: Zhang Zhen, linux-api, Linux Kernel Mailing List
  Cc: mpe, ebiederm, Shuah Khan

On 04/02/2015 12:52 AM, Zhang Zhen wrote:
> Without this patch, if /proc/self/uid_map is not exist,
> the mount test case will fail and no any prompting.
> 
> After applied this patch, the case will prompt why it fail.
> Just as follows:
> root@kernel-host:/opt/kernel> make -C tools/testing/selftests TARGETS=mount run_tests
> make: Entering directory `/opt/kernel/tools/testing/selftests'
> for TARGET in mount; do \
>                 make -C $TARGET; \
>         done;
> make[1]: Entering directory `/opt/kernel/tools/testing/selftests/mount'
> make[1]: Nothing to be done for `all'.
> make[1]: Leaving directory `/opt/kernel/tools/testing/selftests/mount'
> for TARGET in mount; do \
>                 make -C $TARGET run_tests; \
>         done;
> make[1]: Entering directory `/opt/kernel/tools/testing/selftests/mount'
> ERROR: No /proc/self/uid_map exist
> make[1]: Leaving directory `/opt/kernel/tools/testing/selftests/mount'
> make: Leaving directory `/opt/kernel/tools/testing/selftests'
> 
> Signed-off-by: Zhang Zhen <zhenzhang.zhang@huawei.com>

Thanks for fixing this. It will get into 4.1-rc2.

thanks,
-- Shuah

-- 
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
shuahkh@osg.samsung.com | (970) 217-8978

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

* Re: [PATCH] selftests/mount: output error messages when mount test fail
  2015-04-02  6:52 ` [PATCH] selftests/mount: output error messages when mount test fail Zhang Zhen
  2015-04-02 14:21   ` Shuah Khan
@ 2015-04-02 18:03   ` Shuah Khan
  2015-04-02 18:56   ` Eric W. Biederman
  2 siblings, 0 replies; 5+ messages in thread
From: Shuah Khan @ 2015-04-02 18:03 UTC (permalink / raw)
  To: Zhang Zhen, linux-api, Linux Kernel Mailing List
  Cc: mpe, ebiederm, Shuah Khan

On 04/02/2015 12:52 AM, Zhang Zhen wrote:
> Without this patch, if /proc/self/uid_map is not exist,
> the mount test case will fail and no any prompting.
> 
> After applied this patch, the case will prompt why it fail.
> Just as follows:
> root@kernel-host:/opt/kernel> make -C tools/testing/selftests TARGETS=mount run_tests
> make: Entering directory `/opt/kernel/tools/testing/selftests'
> for TARGET in mount; do \
>                 make -C $TARGET; \
>         done;
> make[1]: Entering directory `/opt/kernel/tools/testing/selftests/mount'
> make[1]: Nothing to be done for `all'.
> make[1]: Leaving directory `/opt/kernel/tools/testing/selftests/mount'
> for TARGET in mount; do \
>                 make -C $TARGET run_tests; \
>         done;
> make[1]: Entering directory `/opt/kernel/tools/testing/selftests/mount'
> ERROR: No /proc/self/uid_map exist
> make[1]: Leaving directory `/opt/kernel/tools/testing/selftests/mount'
> make: Leaving directory `/opt/kernel/tools/testing/selftests'
> 
> Signed-off-by: Zhang Zhen <zhenzhang.zhang@huawei.com>
> ---
>  tools/testing/selftests/mount/Makefile | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/mount/Makefile b/tools/testing/selftests/mount/Makefile
> index a5b367f..b3266db 100644
> --- a/tools/testing/selftests/mount/Makefile
> +++ b/tools/testing/selftests/mount/Makefile
> @@ -8,7 +8,12 @@ unprivileged-remount-test: unprivileged-remount-test.c
>  include ../lib.mk
> 
>  TEST_PROGS := unprivileged-remount-test
> -override RUN_TESTS := if [ -f /proc/self/uid_map ] ; then ./unprivileged-remount-test ; fi
> +override RUN_TESTS :=  @if [ -f /proc/self/uid_map ] ; \
> +			then	\
> +				./unprivileged-remount-test ; \
> +			else	\
> +				echo "ERROR: No /proc/self/uid_map exist" ; \
> +			fi
>  override EMIT_TESTS := echo "$(RUN_TESTS)"
> 
>  clean:
> 

This patch introduces syntax error:

Running tests in mount
========================================
./run_kselftest.sh: line 53: syntax error near unexpected token `then'
./run_kselftest.sh: line 53: `@if [ -f /proc/self/uid_map ] ; then
./unprivileged-remount-test ; else echo ERROR: No /proc/self/uid_map
exist ; fi'

You will see it if you run kselftest_install.sh from
tools/testing/selftests and then attempt to run the tests using the
generated
run_kselftest.sh script.

Could you please fix this and re-send the patch.

thanks,
-- Shuah


-- 
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
shuahkh@osg.samsung.com | (970) 217-8978

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

* Re: [PATCH] selftests/mount: output error messages when mount test fail
  2015-04-02  6:52 ` [PATCH] selftests/mount: output error messages when mount test fail Zhang Zhen
  2015-04-02 14:21   ` Shuah Khan
  2015-04-02 18:03   ` Shuah Khan
@ 2015-04-02 18:56   ` Eric W. Biederman
  2015-04-03  1:17     ` Zhang Zhen
  2 siblings, 1 reply; 5+ messages in thread
From: Eric W. Biederman @ 2015-04-02 18:56 UTC (permalink / raw)
  To: Zhang Zhen; +Cc: linux-api, Linux Kernel Mailing List, shuahkh, mpe

Zhang Zhen <zhenzhang.zhang@huawei.com> writes:

> Without this patch, if /proc/self/uid_map is not exist,
> the mount test case will fail and no any prompting.

The intent was not to fail if /proc/self/uid_map is missing but to skip
the test because it is not applicable.

Making this an error seems wrong.  Even if I did mess up the shell
script error propagation and made it an error by accident.

> After applied this patch, the case will prompt why it fail.
> Just as follows:
> root@kernel-host:/opt/kernel> make -C tools/testing/selftests TARGETS=mount run_tests
> make: Entering directory `/opt/kernel/tools/testing/selftests'
> for TARGET in mount; do \
>                 make -C $TARGET; \
>         done;
> make[1]: Entering directory `/opt/kernel/tools/testing/selftests/mount'
> make[1]: Nothing to be done for `all'.
> make[1]: Leaving directory `/opt/kernel/tools/testing/selftests/mount'
> for TARGET in mount; do \
>                 make -C $TARGET run_tests; \
>         done;
> make[1]: Entering directory `/opt/kernel/tools/testing/selftests/mount'
> ERROR: No /proc/self/uid_map exist
> make[1]: Leaving directory `/opt/kernel/tools/testing/selftests/mount'
> make: Leaving directory `/opt/kernel/tools/testing/selftests'
>
> Signed-off-by: Zhang Zhen <zhenzhang.zhang@huawei.com>
> ---
>  tools/testing/selftests/mount/Makefile | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/mount/Makefile b/tools/testing/selftests/mount/Makefile
> index a5b367f..b3266db 100644
> --- a/tools/testing/selftests/mount/Makefile
> +++ b/tools/testing/selftests/mount/Makefile
> @@ -8,7 +8,12 @@ unprivileged-remount-test: unprivileged-remount-test.c
>  include ../lib.mk
>
>  TEST_PROGS := unprivileged-remount-test
> -override RUN_TESTS := if [ -f /proc/self/uid_map ] ; then ./unprivileged-remount-test ; fi
> +override RUN_TESTS :=  @if [ -f /proc/self/uid_map ] ; \
> +			then	\
> +				./unprivileged-remount-test ; \
> +			else	\
> +				echo "ERROR: No /proc/self/uid_map exist" ; \
> +			fi
>  override EMIT_TESTS := echo "$(RUN_TESTS)"
>
>  clean:

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

* Re: [PATCH] selftests/mount: output error messages when mount test fail
  2015-04-02 18:56   ` Eric W. Biederman
@ 2015-04-03  1:17     ` Zhang Zhen
  0 siblings, 0 replies; 5+ messages in thread
From: Zhang Zhen @ 2015-04-03  1:17 UTC (permalink / raw)
  To: Eric W. Biederman; +Cc: linux-api, Linux Kernel Mailing List, shuahkh, mpe

On 2015/4/3 2:56, Eric W. Biederman wrote:
> Zhang Zhen <zhenzhang.zhang@huawei.com> writes:
> 
>> Without this patch, if /proc/self/uid_map is not exist,
>> the mount test case will fail and no any prompting.
> 
> The intent was not to fail if /proc/self/uid_map is missing but to skip
> the test because it is not applicable.
> 
> Making this an error seems wrong.  Even if I did mess up the shell
> script error propagation and made it an error by accident.
> 
Ok, modify the output messages as follows:
WARN: No /proc/self/uid_map exist, test skipped.

Do you think this modification right?

Best regards!
>> After applied this patch, the case will prompt why it fail.
>> Just as follows:
>> root@kernel-host:/opt/kernel> make -C tools/testing/selftests TARGETS=mount run_tests
>> make: Entering directory `/opt/kernel/tools/testing/selftests'
>> for TARGET in mount; do \
>>                 make -C $TARGET; \
>>         done;
>> make[1]: Entering directory `/opt/kernel/tools/testing/selftests/mount'
>> make[1]: Nothing to be done for `all'.
>> make[1]: Leaving directory `/opt/kernel/tools/testing/selftests/mount'
>> for TARGET in mount; do \
>>                 make -C $TARGET run_tests; \
>>         done;
>> make[1]: Entering directory `/opt/kernel/tools/testing/selftests/mount'
>> ERROR: No /proc/self/uid_map exist
>> make[1]: Leaving directory `/opt/kernel/tools/testing/selftests/mount'
>> make: Leaving directory `/opt/kernel/tools/testing/selftests'
>>
>> Signed-off-by: Zhang Zhen <zhenzhang.zhang@huawei.com>
>> ---
>>  tools/testing/selftests/mount/Makefile | 7 ++++++-
>>  1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/testing/selftests/mount/Makefile b/tools/testing/selftests/mount/Makefile
>> index a5b367f..b3266db 100644
>> --- a/tools/testing/selftests/mount/Makefile
>> +++ b/tools/testing/selftests/mount/Makefile
>> @@ -8,7 +8,12 @@ unprivileged-remount-test: unprivileged-remount-test.c
>>  include ../lib.mk
>>
>>  TEST_PROGS := unprivileged-remount-test
>> -override RUN_TESTS := if [ -f /proc/self/uid_map ] ; then ./unprivileged-remount-test ; fi
>> +override RUN_TESTS :=  @if [ -f /proc/self/uid_map ] ; \
>> +			then	\
>> +				./unprivileged-remount-test ; \
>> +			else	\
>> +				echo "ERROR: No /proc/self/uid_map exist" ; \
>> +			fi
>>  override EMIT_TESTS := echo "$(RUN_TESTS)"
>>
>>  clean:
> 
> 



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

end of thread, other threads:[~2015-04-03  1:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1427957214-40367-1-git-send-email-zhenzhang.zhang@huawei.com>
2015-04-02  6:52 ` [PATCH] selftests/mount: output error messages when mount test fail Zhang Zhen
2015-04-02 14:21   ` Shuah Khan
2015-04-02 18:03   ` Shuah Khan
2015-04-02 18:56   ` Eric W. Biederman
2015-04-03  1:17     ` Zhang Zhen

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).