Skip to content

Commit addee42

Browse files
author
Shuah Khan (Samsung OSG)
committed
selftests: mount: delete RUN_TESTS and EMIT_TESTS overrides
Delete RUN_TESTS and EMIT_TESTS overrides and use common defines in lib.mk. Add new run_tests.sh to do the dependency checks the custom RUN_TESTS did. Common defines work with the run_tests.sh set as the TEST_PROGS and defining unprivileged-remount-test in TEST_GEN_FILES. Kselftest framework builds and installs TEST_GEN_FILES and doesn't run them via RUN_TESTS and include it in EMIT_TESTS. With this change the new run_tests.sh runs the test after checking dependencies. This change also adds Skip handling to return kselftest skip code when test is skipped to clearly identify when the test is skipped instead of reporting it as failed. Output with this change: TAP version 13 selftests: mount: run_tests.sh ======================================== WARN: No /proc/self/uid_map exist, test skipped. not ok 1..1 selftests: mount: run_tests.sh [SKIP] Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org> Reviewed-by: Anders Roxell <anders.roxell@linaro.org> Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
1 parent 99a5d09 commit addee42

2 files changed

Lines changed: 14 additions & 10 deletions

File tree

‎tools/testing/selftests/mount/Makefile‎

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,7 @@
33
CFLAGS = -Wall \
44
-O2
55

6-
TEST_GEN_PROGS := unprivileged-remount-test
6+
TEST_PROGS := run_tests.sh
7+
TEST_GEN_FILES := unprivileged-remount-test
78

89
include ../lib.mk
9-
10-
override RUN_TESTS := if [ -f /proc/self/uid_map ] ; \
11-
then \
12-
./unprivileged-remount-test ; \
13-
else \
14-
echo "WARN: No /proc/self/uid_map exist, test skipped." ; \
15-
fi
16-
override EMIT_TESTS := echo "$(RUN_TESTS)"
17-
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
# SPDX-License-Identifier: GPL-2.0
3+
# Kselftest framework requirement - SKIP code is 4.
4+
ksft_skip=4
5+
6+
# Run mount selftests
7+
if [ -f /proc/self/uid_map ] ; then
8+
./unprivileged-remount-test ;
9+
else
10+
echo "WARN: No /proc/self/uid_map exist, test skipped." ;
11+
exit $ksft_skip
12+
fi

0 commit comments

Comments
 (0)