Commit dedbf31a authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'linux-kselftest-next-6.5-rc1' of...

Merge tag 'linux-kselftest-next-6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest

Pull kselftest updates from Shuah Khan:

 - allow runners to override the timeout

   This change is made to avoid future increases of long timeouts

 - several other spelling and cleanups

 - a new subtest to video_device_test

 - enhancements to test coverage in clone3 test

 - other fixes to ftrace and cpufreq tests

* tag 'linux-kselftest-next-6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
  selftests/ftace: Fix KTAP output ordering
  selftests/cpufreq: Don't enable generic lock debugging options
  kselftests: Sort the collections list to avoid duplicate tests
  selftest: pidfd: Omit long and repeating outputs
  selftests: allow runners to override the timeout
  selftests/ftrace: Add new test case which checks for optimized probes
  selftests/clone3: test clone3 with exit signal in flags
  kselftest: vDSO: Fix accumulation of uninitialized ret when CLOCK_REALTIME is undefined
  selftests: prctl: Fix spelling mistake "anonynous" -> "anonymous"
  selftests: media_tests: Add new subtest to video_device_test
parents 9ba92dc1 8cd0d863
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -168,6 +168,28 @@ the `-t` option for specific single tests. Either can be used multiple times::

For other features see the script usage output, seen with the `-h` option.

Timeout for selftests
=====================

Selftests are designed to be quick and so a default timeout is used of 45
seconds for each test. Tests can override the default timeout by adding
a settings file in their directory and set a timeout variable there to the
configured a desired upper timeout for the test. Only a few tests override
the timeout with a value higher than 45 seconds, selftests strives to keep
it that way. Timeouts in selftests are not considered fatal because the
system under which a test runs may change and this can also modify the
expected time it takes to run a test. If you have control over the systems
which will run the tests you can configure a test runner on those systems to
use a greater or lower timeout on the command line as with the `-o` or
the `--override-timeout` argument. For example to use 165 seconds instead
one would use:

   $ ./run_kselftest.sh --override-timeout 165

You can look at the TAP output to see if you ran into the timeout. Test
runners which know a test must run under a specific time can then optionally
treat these timeouts then as fatal.

Packaging selftests
===================

+4 −1
Original line number Diff line number Diff line
@@ -129,7 +129,7 @@ int main(int argc, char *argv[])
	uid_t uid = getuid();

	ksft_print_header();
	ksft_set_plan(18);
	ksft_set_plan(19);
	test_clone3_supported();

	/* Just a simple clone3() should return 0.*/
@@ -198,5 +198,8 @@ int main(int argc, char *argv[])
	/* Do a clone3() in a new time namespace */
	test_clone3(CLONE_NEWTIME, 0, 0, CLONE3_ARGS_NO_TEST);

	/* Do a clone3() with exit signal (SIGCHLD) in flags */
	test_clone3(SIGCHLD, 0, -EINVAL, CLONE3_ARGS_NO_TEST);

	ksft_finished();
}
+0 −8
Original line number Diff line number Diff line
@@ -5,11 +5,3 @@ CONFIG_CPU_FREQ_GOV_USERSPACE=y
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y
CONFIG_DEBUG_RT_MUTEXES=y
CONFIG_DEBUG_PLIST=y
CONFIG_DEBUG_SPINLOCK=y
CONFIG_DEBUG_MUTEXES=y
CONFIG_DEBUG_LOCK_ALLOC=y
CONFIG_PROVE_LOCKING=y
CONFIG_LOCKDEP=y
CONFIG_DEBUG_ATOMIC_SLEEP=y
+1 −1
Original line number Diff line number Diff line
@@ -301,7 +301,7 @@ ktaptest() { # result comment
    comment="# $comment"
  fi

  echo $CASENO $result $INSTANCE$CASENAME $comment
  echo $result $CASENO $INSTANCE$CASENAME $comment
}

eval_result() { # sigval
+34 −0
Original line number Diff line number Diff line
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2023 Akanksha J N, IBM corporation
# description: Register/unregister optimized probe
# requires: kprobe_events

case `uname -m` in
x86_64)
;;
arm*)
;;
ppc*)
;;
*)
  echo "Please implement other architecture here"
  exit_unsupported
esac

DEFAULT=$(cat /proc/sys/debug/kprobes-optimization)
echo 1 > /proc/sys/debug/kprobes-optimization
for i in `seq 0 255`; do
        echo  "p:testprobe $FUNCTION_FORK+${i}" > kprobe_events || continue
        echo 1 > events/kprobes/enable || continue
        (echo "forked")
	PROBE=$(grep $FUNCTION_FORK /sys/kernel/debug/kprobes/list)
        echo 0 > events/kprobes/enable
        echo > kprobe_events
	if echo $PROBE | grep -q OPTIMIZED; then
                echo "$DEFAULT" >  /proc/sys/debug/kprobes-optimization
                exit_pass
        fi
done
echo "$DEFAULT" >  /proc/sys/debug/kprobes-optimization
exit_unresolved
Loading