Skip to contentSkip to conversation

selftests/mount: output WARN messages when mount test skipped

PATCH In review Zhang Zhen 2 participants 2 messages Apr 3, 2015 – May 6, 2015 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Zhang Zhen

author
#1 lore raw

PATCH v2 1/1 selftests/mount: output WARN messages when mount test skipped

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

After applied this patch, the case will prompt why it skipped.
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'
if [ -f /proc/self/uid_map ] ; then ./unprivileged-remount-test ; else echo "WARN: No /proc/self/uid_map exist, test skipped." ; fi
WARN: No /proc/self/uid_map exist, test skipped.
make[1]: Leaving directory `/opt/kernel/tools/testing/selftests/mount'
make: Leaving directory `/opt/kernel/tools/testing/selftests'

Change v1 -> v2:
- fix syntax error when run kselftest_install.sh

---
 tools/testing/selftests/mount/Makefile | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
tools/testing/selftests/mount/Makefile +6 -1
index a5b367f..038c777 100644
@@ -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 "WARN: No /proc/self/uid_map exist, test skipped." ; \
+		      fi
 override EMIT_TESTS := echo "$(RUN_TESTS)"
 
 clean:
Signature · 4 lines
1.8.5.5


.
#2 lore raw
Quoted 22 lines · Zhang Zhen

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

After applied this patch, the case will prompt why it skipped.
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'
if [ -f /proc/self/uid_map ] ; then ./unprivileged-remount-test ; else echo "WARN: No /proc/self/uid_map exist, test skipped." ; fi
WARN: No /proc/self/uid_map exist, test skipped.
make[1]: Leaving directory `/opt/kernel/tools/testing/selftests/mount'
make: Leaving directory `/opt/kernel/tools/testing/selftests'

Quoted 5 lines

Change v1 -> v2:
- fix syntax error when run kselftest_install.sh

---

Thanks for fixing this. Applied it to linux-kselftest next for 4.2 - I ended up making changes the commit log to fix checkpatch warnings before applying the patch.

thanks,
-- Shuah

Signature · 5 lines
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
[email protected] | (970) 217-8978