Skip to content

Commit 2d2435e

Browse files
committed
Merge tag 'linux_kselftest-next-6.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
Pull Kselftest updates from Shuah Khan: "Fixes: - cpufreq test to not double suspend in rtcwake case - compile error in pid_namespace test - run_kselftest.sh to use readlink if realpath is not available - cpufreq basic read and update testcases - ftrace to add poll to a gen_file so test can find it at run-time - spelling errors in perf_events test" * tag 'linux_kselftest-next-6.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: selftests/run_kselftest.sh: Use readlink if realpath is not available selftests/timens: timerfd: Use correct clockid type in tclock_gettime() selftests/timens: Make run_tests() functions static selftests/timens: Print TAP headers selftests: pid_namespace: add missing sys/mount.h include in pid_max.c kselftest: cpufreq: Get rid of double suspend in rtcwake case selftests/cpufreq: Fix cpufreq basic read and update testcases selftests/ftrace: Convert poll to a gen_file selftests/perf_events: Fix spelling mistake "sycnhronize" -> "synchronize"
2 parents 0704695 + 1107dc4 commit 2d2435e

File tree

14 files changed

+46
-12
lines changed

14 files changed

+46
-12
lines changed

tools/testing/selftests/cpufreq/cpufreq.sh

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,14 @@ read_cpufreq_files_in_dir()
5252
for file in $files; do
5353
if [ -f $1/$file ]; then
5454
printf "$file:"
55-
cat $1/$file
55+
#file is readable ?
56+
local rfile=$(ls -l $1/$file | awk '$1 ~ /^.*r.*/ { print $NF; }')
57+
58+
if [ ! -z $rfile ]; then
59+
cat $1/$file
60+
else
61+
printf "$file is not readable\n"
62+
fi
5663
else
5764
printf "\n"
5865
read_cpufreq_files_in_dir "$1/$file"
@@ -83,10 +90,10 @@ update_cpufreq_files_in_dir()
8390

8491
for file in $files; do
8592
if [ -f $1/$file ]; then
86-
# file is writable ?
87-
local wfile=$(ls -l $1/$file | awk '$1 ~ /^.*w.*/ { print $NF; }')
93+
# file is readable and writable ?
94+
local rwfile=$(ls -l $1/$file | awk '$1 ~ /^.*rw.*/ { print $NF; }')
8895

89-
if [ ! -z $wfile ]; then
96+
if [ ! -z $rwfile ]; then
9097
# scaling_setspeed is a special file and we
9198
# should skip updating it
9299
if [ $file != "scaling_setspeed" ]; then
@@ -244,9 +251,10 @@ do_suspend()
244251
printf "Failed to suspend using RTC wake alarm\n"
245252
return 1
246253
fi
254+
else
255+
echo $filename > $SYSFS/power/state
247256
fi
248257

249-
echo $filename > $SYSFS/power/state
250258
printf "Came out of $1\n"
251259

252260
printf "Do basic tests after finishing $1 to verify cpufreq state\n\n"

tools/testing/selftests/ftrace/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ TEST_PROGS := ftracetest-ktap
66
TEST_FILES := test.d settings
77
EXTRA_CLEAN := $(OUTPUT)/logs/*
88

9-
TEST_GEN_PROGS = poll
9+
TEST_GEN_FILES := poll
1010

1111
include ../lib.mk

tools/testing/selftests/perf_events/watermark_signal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ TEST(watermark_signal)
7575
if (waitpid(child, &child_status, WSTOPPED) != child ||
7676
!(WIFSTOPPED(child_status) && WSTOPSIG(child_status) == SIGSTOP)) {
7777
fprintf(stderr,
78-
"failed to sycnhronize with child errno=%d status=%x\n",
78+
"failed to synchronize with child errno=%d status=%x\n",
7979
errno,
8080
child_status);
8181
goto cleanup;

tools/testing/selftests/pid_namespace/pid_max.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <stdlib.h>
1111
#include <string.h>
1212
#include <syscall.h>
13+
#include <sys/mount.h>
1314
#include <sys/wait.h>
1415

1516
#include "../kselftest_harness.h"

tools/testing/selftests/run_kselftest.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@
33
#
44
# Run installed kselftest tests.
55
#
6-
BASE_DIR=$(realpath $(dirname $0))
6+
7+
# Fallback to readlink if realpath is not available
8+
if which realpath > /dev/null; then
9+
BASE_DIR=$(realpath $(dirname $0))
10+
else
11+
BASE_DIR=$(readlink -f $(dirname $0))
12+
fi
13+
714
cd $BASE_DIR
815
TESTS="$BASE_DIR"/kselftest-list.txt
916
if [ ! -r "$TESTS" ] ; then

tools/testing/selftests/timens/clock_nanosleep.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void *call_nanosleep(void *_args)
3838
return NULL;
3939
}
4040

41-
int run_test(int clockid, int abs)
41+
static int run_test(int clockid, int abs)
4242
{
4343
struct timespec now = {}, rem;
4444
struct thread_args args = { .now = &now, .rem = &rem, .clockid = clockid};
@@ -115,6 +115,8 @@ int main(int argc, char *argv[])
115115
{
116116
int ret, nsfd;
117117

118+
ksft_print_header();
119+
118120
nscheck();
119121

120122
ksft_set_plan(4);

tools/testing/selftests/timens/exec.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ int main(int argc, char *argv[])
3636
return 0;
3737
}
3838

39+
ksft_print_header();
40+
3941
nscheck();
4042

4143
ksft_set_plan(1);

tools/testing/selftests/timens/futex.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ int main(int argc, char *argv[])
6666
pid_t pid;
6767
struct timespec mtime_now;
6868

69+
ksft_print_header();
70+
6971
nscheck();
7072

7173
ksft_set_plan(2);

tools/testing/selftests/timens/gettime_perf.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ int main(int argc, char *argv[])
6767
time_t offset = 10;
6868
int nsfd;
6969

70+
ksft_print_header();
71+
7072
ksft_set_plan(8);
7173

7274
fill_function_pointers();

tools/testing/selftests/timens/procfs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ int main(int argc, char *argv[])
180180
{
181181
int ret = 0;
182182

183+
ksft_print_header();
184+
183185
nscheck();
184186

185187
ksft_set_plan(2);

0 commit comments

Comments
 (0)