Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests: filesystems: return Kselftest Skip code for skipped tests

When devpts_pts test is skipped because of unmet dependencies and/or
unsupported configuration, it exits with error which is treated as
a fail by the Kselftest framework. This leads to false negative
result even when the test could not be run.

In another case, it returns pass for a skipped test reporting a false
postive.

Change it to return kselftest skip code when a test gets skipped to
clearly report that the test could not be run.

Change it to use ksft_exit_skip() when test is skipped.

Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>

+7 -4
+7 -4
tools/testing/selftests/filesystems/devpts_pts.c
··· 11 11 #include <asm/ioctls.h> 12 12 #include <sys/mount.h> 13 13 #include <sys/wait.h> 14 + #include "../kselftest.h" 14 15 15 16 static bool terminal_dup2(int duplicate, int original) 16 17 { ··· 126 125 if (errno == EINVAL) { 127 126 fprintf(stderr, "TIOCGPTPEER is not supported. " 128 127 "Skipping test.\n"); 129 - fret = EXIT_SUCCESS; 128 + fret = KSFT_SKIP; 129 + } else { 130 + fprintf(stderr, 131 + "Failed to perform TIOCGPTPEER ioctl\n"); 132 + fret = EXIT_FAILURE; 130 133 } 131 - 132 - fprintf(stderr, "Failed to perform TIOCGPTPEER ioctl\n"); 133 134 goto do_cleanup; 134 135 } 135 136 ··· 284 281 if (!isatty(STDIN_FILENO)) { 285 282 fprintf(stderr, "Standard input file descriptor is not attached " 286 283 "to a terminal. Skipping test\n"); 287 - exit(EXIT_FAILURE); 284 + exit(KSFT_SKIP); 288 285 } 289 286 290 287 ret = unshare(CLONE_NEWNS);