| 83ef26f9 | 17-Apr-2026 |
Mark Brown <broonie@kernel.org> |
selftests: Fix duplicated test number reporting
Commit 2964f6b816c2 ("selftests: Use ktap helpers for runner.sh") converted the prints in runner.sh to use the relevant helpers from ktap_helpers.sh,
selftests: Fix duplicated test number reporting
Commit 2964f6b816c2 ("selftests: Use ktap helpers for runner.sh") converted the prints in runner.sh to use the relevant helpers from ktap_helpers.sh, not modifying any of the strings printed in the process. This included converting all the result reports to use the relevant ktap_test_ function. Since the output was originally KTAP compliant the strings reported for test names now include test numbers:
ok 59 59 selftests: arm64: syscall-abi
instead of the expected format:
ok 59 selftests: arm64: syscall-abi
which causes result parsers to interpret the second number as part of the test name.
Given the use of the helpers the tracking of test numbers by runner.sh is now redundant, remove it entirely to restore the expected output format.
Link: https://lore.kernel.org/r/20260417-selftests-fix-double-number-v1-1-1be5d7c36b94@kernel.org Fixes: 2964f6b816c2 ("selftests: Use ktap helpers for runner.sh") Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
show more ...
|
| df410ad4 | 16-Apr-2026 |
Mark Brown <broonie@kernel.org> |
selftests: Fix runner.sh for non-bash shells
Commit 2964f6b816c2 ("selftests: Use ktap helpers for runner.sh") added a number of bashisms and updated the interpreter specified for the script to be /
selftests: Fix runner.sh for non-bash shells
Commit 2964f6b816c2 ("selftests: Use ktap helpers for runner.sh") added a number of bashisms and updated the interpreter specified for the script to be /bin/bash to reflect this. Unfortunately this does not actually achieve anything in production since the main way runner.sh is invoked is from the top level run_kselftest.sh which sources it rather than running it as a separate script and specifies the shell as /bin/sh. This means that on systems where /bin/sh is not bash (such as Debian where /bin/sh defaults to being dash) we see failures:
./run_kselftest.sh: 195: ./kselftest/runner.sh: Syntax error: "(" unexpected (expecting "}")
These bashisms come from this part of the change:
4. In runner.sh run_one(), get the return value and use ktap helpers for all pass/fail reporting. This allows counting pass/fail numbers in the main process.
which uses a bash array to track all the subtests being run. Convert this to use a simple flat variable instead.
Link: https://lore.kernel.org/r/20260416-selftest-fix-readlink-e-v1-2-94e4cabbdec4@kernel.org Fixes: 2964f6b816c2 ("selftests: Use ktap helpers for runner.sh") Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
show more ...
|
| 93edbf17 | 16-Apr-2026 |
Mark Brown <broonie@kernel.org> |
selftests: Fix runner.sh busybox support
Commit 2964f6b816c2 ("selftests: Use ktap helpers for runner.sh") added an import of ktap_helper.sh to runner.sh in order to standardise on these for output
selftests: Fix runner.sh busybox support
Commit 2964f6b816c2 ("selftests: Use ktap helpers for runner.sh") added an import of ktap_helper.sh to runner.sh in order to standardise on these for output formatting. Rather than build on the existing requirement for the user to supply BASE_DIR to find the helpers it uses some magic which features a use of "readlink -e". Unfortunately the -e option is a GNU extension and is not available in at least busybox, meaning that runner.sh starts failing:
./run_kselftest.sh: 5: ./kselftest/runner.sh: Bad substitution ./run_kselftest.sh: 5: .: cannot open ./ktap_helpers.sh: No such file
Fix this by using the already required BASE_DIR to locate the helper library.
Link: https://lore.kernel.org/r/20260416-selftest-fix-readlink-e-v1-1-94e4cabbdec4@kernel.org Fixes: 2964f6b816c2 ("selftests: Use ktap helpers for runner.sh") Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
show more ...
|
| d6ea9f40 | 20-Mar-2026 |
Ricardo B. Marlière <rbm@suse.com> |
selftests/run_kselftest.sh: Allow choosing per-test log directory
The --per-test-log option currently hard-codes /tmp. However, the system under test will most likely have tmpfs mounted there. Since
selftests/run_kselftest.sh: Allow choosing per-test log directory
The --per-test-log option currently hard-codes /tmp. However, the system under test will most likely have tmpfs mounted there. Since it's not clear which filenames the log files will have, the user should be able to specify a persistent directory to store the logs. Keeping those logs are important because the run_kselftest.sh runner will only yield KTAP output, trimming information that is otherwise available through running individual tests directly.
Allow --per-test-log to take an optional directory argument. Keep the existing behaviour when the option is passed without an argument, but if a directory is provided, create it if needed, reject non-directory paths and non-writable directories, canonicalize it, and have runner.sh write per-test logs there instead of /tmp.
This also makes relative paths safe by resolving them before the runner changes into a collection directory.
Signed-off-by: Ricardo B. Marlière <rbm@suse.com> Link: https://lore.kernel.org/r/20260320-selftests-fixes-v1-4-79144f76be01@suse.com Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
show more ...
|
| 2dd0b5a8 | 31-Jan-2024 |
Nícolas F. R. A. Prado <nfraprado@collabora.com> |
selftests: ktap_helpers: Add a helper to finish the test
Similar to the C counterpart, keep track of the number of test cases in the test plan and add a helper function to be called at the end of th
selftests: ktap_helpers: Add a helper to finish the test
Similar to the C counterpart, keep track of the number of test cases in the test plan and add a helper function to be called at the end of the test to print the results and exit with the corresponding exit code.
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
show more ...
|
| d63fde98 | 31-Jan-2024 |
Nícolas F. R. A. Prado <nfraprado@collabora.com> |
selftests: ktap_helpers: Add a helper to abort the test
Similar to the C counterpart, add a helper function to abort the remainder of the test.
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@coll
selftests: ktap_helpers: Add a helper to abort the test
Similar to the C counterpart, add a helper function to abort the remainder of the test.
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
show more ...
|
| d90b7c70 | 31-Jan-2024 |
Nícolas F. R. A. Prado <nfraprado@collabora.com> |
selftests: ktap_helpers: Add helper to pass/fail test based on exit code
Similar to the C counterpart, add a helper function that runs a command and passes or fails the test based on the result.
Si
selftests: ktap_helpers: Add helper to pass/fail test based on exit code
Similar to the C counterpart, add a helper function that runs a command and passes or fails the test based on the result.
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
show more ...
|
| 6934eea2 | 31-Jan-2024 |
Nícolas F. R. A. Prado <nfraprado@collabora.com> |
selftests: ktap_helpers: Add helper to print diagnostic messages
Similar to the C counterpart, add a helper to print a diagnostic message.
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora
selftests: ktap_helpers: Add helper to print diagnostic messages
Similar to the C counterpart, add a helper to print a diagnostic message.
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
show more ...
|