Kselftest update for Linux 6.2-rc1
Subsystems (9)
Shuah Khan
maintainerHi Linus,
Please pull the following Kselftest update for Linux 6.2-rc1.
This Kselftest update for Linux 6.2-rc1 consists of several fixes and enhancements to existing tests and a few new tests:
- adds new amd-pstate and fixes and enhances existing ones
- adds new watchdog tests and enhances existing ones to improve coverage
- fixes to ftrace, splice_read, rtc, and efivars tests
- fixes to handle egrep obsolescence in the latest grep release
- miscellaneous spelling and SPDX fixes
Note: This change includes drivers/cpufreq/amd-pstate-ut.c update.
diff is attached.
thanks,
-- Shuah
----------------------------------------------------------------
The following changes since commit 9abf2313adc1ca1b6180c508c25f22f9395cc780:
Linux 6.1-rc1 (2022-10-16 15:36:24 -0700)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest tags/linux-kselftest-next-6.2-rc1
for you to fetch changes up to d5ba85d6d8be7da660d4ac25761a48c74ade958d:
selftests/ftrace: Use long for synthetic event probe test (2022-12-02 10:53:03 -0700)
----------------------------------------------------------------
linux-kselftest-next-6.2-rc1
This Kselftest update for Linux 6.2-rc1 consists of several fixes and enhancements to existing tests and a few new tests:
- adds new amd-pstate and fixes and enhances existing ones
- adds new watchdog tests and enhances existing ones to improve coverage
- fixes to ftrace, splice_read, rtc, and efivars tests
- fixes to handle egrep obsolescence in the latest grep release
- miscellaneous spelling and SPDX fixes
----------------------------------------------------------------
Alexandre Belloni (1):
selftests: rtc: skip when RTC is not present
Colin Ian King (1):
selftests/watchdog: Fix spelling mistake "Temeprature" -> "Temperature"
Guo Ren (1):
selftests/vDSO: Add riscv getcpu & gettimeofday test
Meng Li (6):
selftests: amd-pstate: Rename amd-pstate-ut.sh to basic.sh.
selftests: amd-pstate: Split basic.sh into run.sh and basic.sh.
selftests: amd-pstate: Trigger tbench benchmark and test cpus
selftests: amd-pstate: Trigger gitsource benchmark and test cpus
Documentation: amd-pstate: Add tbench and gitsource test introduction
cpufreq: amd-pstate: fix spdxcheck warnings for amd-pstate-ut.c
Mickaël Salaün (1):
selftests: Use optional USERCFLAGS and USERLDFLAGS
Naveen N. Rao (2):
selftests/ftrace: Add check for ping command for trigger tests selftests/ftrace: Convert tracer tests to use 'requires' to specify program dependency
Nícolas F. R. A. Prado (1):
selftests/tpm2: Split async tests call to separate shell script runner
Shuah Khan (4):
selftests/watchdog: change to print reset reason info. selftests/watchdog: add support for WDIOC_GETSTATUS selftests/watchdog: print watchdog_info option strings selftests/watchdog: add test for WDIOC_GETTEMP
Steven Rostedt (Google) (1):
selftests/ftrace: Use long for synthetic event probe test
Suzuki K Poulose (1):
selftests: splice_read: Fix sysfs read cases
Tiezhu Yang (3):
selftests: kselftest_deps: Use "grep -E" instead of "egrep"
selftests: gpio: Use "grep -E" instead of "egrep"
selftests: ftrace: Use "grep -E" instead of "egrep"
Yipeng Zou (1):
selftests/ftrace: event_triggers: wait longer for test_event_enable
Zhao Gongyi (1):
selftests/efivarfs: Add checking of the test return value
Documentation/admin-guide/pm/amd-pstate.rst | 194 +++++++++-- drivers/cpufreq/amd-pstate-ut.c | 2 +- tools/testing/selftests/amd-pstate/Makefile | 11 +- .../testing/selftests/amd-pstate/amd-pstate-ut.sh | 56 --- tools/testing/selftests/amd-pstate/basic.sh | 38 ++ tools/testing/selftests/amd-pstate/gitsource.sh | 354 +++++++++++++++++++ tools/testing/selftests/amd-pstate/run.sh | 387 +++++++++++++++++++++ tools/testing/selftests/amd-pstate/tbench.sh | 339 ++++++++++++++++++ tools/testing/selftests/efivarfs/efivarfs.sh | 5 + .../ftrace/test.d/ftrace/func_event_triggers.tc | 15 +- tools/testing/selftests/ftrace/test.d/functions | 8 +- .../ftrace/test.d/preemptirq/irqsoff_tracer.tc | 8 +- .../selftests/ftrace/test.d/tracer/wakeup.tc | 7 +- .../selftests/ftrace/test.d/tracer/wakeup_rt.tc | 7 +- .../inter-event/trigger-field-variable-support.tc | 2 +- .../trigger-inter-event-combined-hist.tc | 2 +- .../inter-event/trigger-onchange-action-hist.tc | 2 +- .../inter-event/trigger-onmatch-action-hist.tc | 2 +- .../trigger-onmatch-onmax-action-hist.tc | 2 +- .../inter-event/trigger-onmax-action-hist.tc | 2 +- .../inter-event/trigger-snapshot-action-hist.tc | 2 +- .../inter-event/trigger-synthetic-eprobe.tc | 2 +- .../trigger-synthetic-event-dynstring.tc | 2 +- .../inter-event/trigger-trace-action-hist.tc | 2 +- tools/testing/selftests/gpio/gpio-sim.sh | 2 +- tools/testing/selftests/kselftest_deps.sh | 2 +- tools/testing/selftests/lib.mk | 5 + tools/testing/selftests/rtc/rtctest.c | 33 +- .../testing/selftests/splice/short_splice_read.sh | 4 +- tools/testing/selftests/tpm2/Makefile | 2 +-
tools/testing/selftests/tpm2/test_async.sh | 10 +
tools/testing/selftests/tpm2/test_smoke.sh | 1 - tools/testing/selftests/vDSO/vdso_test_getcpu.c | 4 + .../selftests/vDSO/vdso_test_gettimeofday.c | 3 + tools/testing/selftests/watchdog/watchdog-test.c | 106 +++++- 35 files changed, 1502 insertions(+), 121 deletions(-) delete mode 100755 tools/testing/selftests/amd-pstate/amd-pstate-ut.sh create mode 100755 tools/testing/selftests/amd-pstate/basic.sh create mode 100755 tools/testing/selftests/amd-pstate/gitsource.sh create mode 100755 tools/testing/selftests/amd-pstate/run.sh create mode 100755 tools/testing/selftests/amd-pstate/tbench.sh create mode 100755 tools/testing/selftests/tpm2/test_async.sh
----------------------------------------------------------------
Documentation/admin-guide/pm/amd-pstate.rst +174 -20
@@ -409,37 +409,55 @@ Unit Tests for amd-pstate 1. Test case decriptions + 1). Basic tests + + Test prerequisite and basic functions for the ``amd-pstate`` driver. + +---------+--------------------------------+------------------------------------------------------------------------------------+ | Index | Functions | Description | +=========+================================+====================================================================================+ - | 0 | amd_pstate_ut_acpi_cpc_valid || Check whether the _CPC object is present in SBIOS. | + | 1 | amd_pstate_ut_acpi_cpc_valid || Check whether the _CPC object is present in SBIOS. | | | || | | | || The detail refer to `Processor Support <processor_support_>`_. | +---------+--------------------------------+------------------------------------------------------------------------------------+ - | 1 | amd_pstate_ut_check_enabled || Check whether AMD P-State is enabled. | + | 2 | amd_pstate_ut_check_enabled || Check whether AMD P-State is enabled. | | | || | | | || AMD P-States and ACPI hardware P-States always can be supported in one processor. | | | | But AMD P-States has the higher priority and if it is enabled with | | | | :c:macro:`MSR_AMD_CPPC_ENABLE` or ``cppc_set_enable``, it will respond to the | | | | request from AMD P-States. | +---------+--------------------------------+------------------------------------------------------------------------------------+ - | 2 | amd_pstate_ut_check_perf || Check if the each performance values are reasonable. | + | 3 | amd_pstate_ut_check_perf || Check if the each performance values are reasonable. | | | || highest_perf >= nominal_perf > lowest_nonlinear_perf > lowest_perf > 0. | +---------+--------------------------------+------------------------------------------------------------------------------------+ - | 3 | amd_pstate_ut_check_freq || Check if the each frequency values and max freq when set support boost mode | + | 4 | amd_pstate_ut_check_freq || Check if the each frequency values and max freq when set support boost mode | | | | are reasonable. | | | || max_freq >= nominal_freq > lowest_nonlinear_freq > min_freq > 0 | | | || If boost is not active but supported, this maximum frequency will be larger than | | | | the one in ``cpuinfo``. | +---------+--------------------------------+------------------------------------------------------------------------------------+ + 2). Tbench test + + Test and monitor the cpu changes when running tbench benchmark under the specified governor. + These changes include desire performance, frequency, load, performance, energy etc. + The specified governor is ondemand or schedutil. + Tbench can also be tested on the ``acpi-cpufreq`` kernel driver for comparison. + + 3). Gitsource test + + Test and monitor the cpu changes when running gitsource benchmark under the specified governor. + These changes include desire performance, frequency, load, time, energy etc. + The specified governor is ondemand or schedutil. + Gitsource can also be tested on the ``acpi-cpufreq`` kernel driver for comparison. + #. How to execute the tests We use test module in the kselftest frameworks to implement it. - We create amd-pstate-ut module and tie it into kselftest.(for + We create ``amd-pstate-ut`` module and tie it into kselftest.(for details refer to Linux Kernel Selftests [4]_). - 1. Build + 1). Build + open the :c:macro:`CONFIG_X86_AMD_PSTATE` configuration option. + set the :c:macro:`CONFIG_X86_AMD_PSTATE_UT` configuration option to M.
@@ -449,23 +467,159 @@ Unit Tests for amd-pstate $ cd linux $ make -C tools/testing/selftests - #. Installation & Steps :: + + make perf :: + + $ cd tools/perf/ + $ make + + + 2). Installation & Steps :: $ make -C tools/testing/selftests install INSTALL_PATH=~/kselftest + $ cp tools/perf/perf /usr/bin/perf $ sudo ./kselftest/run_kselftest.sh -c amd-pstate - TAP version 13 - 1..1 - # selftests: amd-pstate: amd-pstate-ut.sh - # amd-pstate-ut: ok - ok 1 selftests: amd-pstate: amd-pstate-ut.sh - - #. Results :: - - $ dmesg | grep "amd_pstate_ut" | tee log.txt - [12977.570663] amd_pstate_ut: 1 amd_pstate_ut_acpi_cpc_valid success! - [12977.570673] amd_pstate_ut: 2 amd_pstate_ut_check_enabled success! - [12977.571207] amd_pstate_ut: 3 amd_pstate_ut_check_perf success! - [12977.571212] amd_pstate_ut: 4 amd_pstate_ut_check_freq success! + + 3). Specified test case :: + + $ cd ~/kselftest/amd-pstate + $ sudo ./run.sh -t basic + $ sudo ./run.sh -t tbench + $ sudo ./run.sh -t tbench -m acpi-cpufreq + $ sudo ./run.sh -t gitsource + $ sudo ./run.sh -t gitsource -m acpi-cpufreq + $ ./run.sh --help + ./run.sh: illegal option -- - + Usage: ./run.sh [OPTION...] + [-h <help>] + [-o <output-file-for-dump>] + [-c <all: All testing, + basic: Basic testing, + tbench: Tbench testing, + gitsource: Gitsource testing.>] + [-t <tbench time limit>] + [-p <tbench process number>] + [-l <loop times for tbench>] + [-i <amd tracer interval>] + [-m <comparative test: acpi-cpufreq>] + + + 4). Results + + + basic + + When you finish test, you will get the following log info :: + + $ dmesg | grep "amd_pstate_ut" | tee log.txt + [12977.570663] amd_pstate_ut: 1 amd_pstate_ut_acpi_cpc_valid success! + [12977.570673] amd_pstate_ut: 2 amd_pstate_ut_check_enabled success! + [12977.571207] amd_pstate_ut: 3 amd_pstate_ut_check_perf success! + [12977.571212] amd_pstate_ut: 4 amd_pstate_ut_check_freq success! + + + tbench + + When you finish test, you will get selftest.tbench.csv and png images. + The selftest.tbench.csv file contains the raw data and the drop of the comparative test. + The png images shows the performance, energy and performan per watt of each test. + Open selftest.tbench.csv : + + +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+ + + Governor | Round | Des-perf | Freq | Load | Performance | Energy | Performance Per Watt | + +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+ + + Unit | | | GHz | | MB/s | J | MB/J | + +=================================================+==============+==========+=========+==========+=============+=========+======================+ + + amd-pstate-ondemand | 1 | | | | 2504.05 | 1563.67 | 158.5378 | + +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+ + + amd-pstate-ondemand | 2 | | | | 2243.64 | 1430.32 | 155.2941 | + +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+ + + amd-pstate-ondemand | 3 | | | | 2183.88 | 1401.32 | 154.2860 | + +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+ + + amd-pstate-ondemand | Average | | | | 2310.52 | 1465.1 | 156.1268 | + +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+ + + amd-pstate-schedutil | 1 | 165.329 | 1.62257 | 99.798 | 2136.54 | 1395.26 | 151.5971 | + +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+ + + amd-pstate-schedutil | 2 | 166 | 1.49761 | 99.9993 | 2100.56 | 1380.5 | 150.6377 | + +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+ + + amd-pstate-schedutil | 3 | 166 | 1.47806 | 99.9993 | 2084.12 | 1375.76 | 149.9737 | + +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+ + + amd-pstate-schedutil | Average | 165.776 | 1.53275 | 99.9322 | 2107.07 | 1383.84 | 150.7399 | + +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+ + + acpi-cpufreq-ondemand | 1 | | | | 2529.9 | 1564.4 | 160.0997 | + +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+ + + acpi-cpufreq-ondemand | 2 | | | | 2249.76 | 1432.97 | 155.4297 | + +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+ + + acpi-cpufreq-ondemand | 3 | | | | 2181.46 | 1406.88 | 153.5060 | + +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+ + + acpi-cpufreq-ondemand | Average | | | | 2320.37 | 1468.08 | 156.4741 | + +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+ + + acpi-cpufreq-schedutil | 1 | | | | 2137.64 | 1385.24 | 152.7723 | + +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+ + + acpi-cpufreq-schedutil | 2 | | | | 2107.05 | 1372.23 | 152.0138 | + +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+ + + acpi-cpufreq-schedutil | 3 | | | | 2085.86 | 1365.35 | 151.2433 | + +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+ + + acpi-cpufreq-schedutil | Average | | | | 2110.18 | 1374.27 | 152.0136 | + +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+ + + acpi-cpufreq-ondemand VS acpi-cpufreq-schedutil | Comprison(%) | | | | -9.0584 | -6.3899 | -2.8506 | + +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+ + + amd-pstate-ondemand VS amd-pstate-schedutil | Comprison(%) | | | | 8.8053 | -5.5463 | -3.4503 | + +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+ + + acpi-cpufreq-ondemand VS amd-pstate-ondemand | Comprison(%) | | | | -0.4245 | -0.2029 | -0.2219 | + +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+ + + acpi-cpufreq-schedutil VS amd-pstate-schedutil | Comprison(%) | | | | -0.1473 | 0.6963 | -0.8378 | + +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+ + + + gitsource + + When you finish test, you will get selftest.gitsource.csv and png images. + The selftest.gitsource.csv file contains the raw data and the drop of the comparative test. + The png images shows the performance, energy and performan per watt of each test. + Open selftest.gitsource.csv : + + +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+ + + Governor | Round | Des-perf | Freq | Load | Time | Energy | Performance Per Watt | + +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+ + + Unit | | | GHz | | s | J | 1/J | + +=================================================+==============+==========+==========+==========+=============+=========+======================+ + + amd-pstate-ondemand | 1 | 50.119 | 2.10509 | 23.3076 | 475.69 | 865.78 | 0.001155027 | + +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+ + + amd-pstate-ondemand | 2 | 94.8006 | 1.98771 | 56.6533 | 467.1 | 839.67 | 0.001190944 | + +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+ + + amd-pstate-ondemand | 3 | 76.6091 | 2.53251 | 43.7791 | 467.69 | 855.85 | 0.001168429 | + +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+ + + amd-pstate-ondemand | Average | 73.8429 | 2.20844 | 41.2467 | 470.16 | 853.767 | 0.001171279 | + +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+ + + amd-pstate-schedutil | 1 | 165.919 | 1.62319 | 98.3868 | 464.17 | 866.8 | 0.001153668 | + +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+ + + amd-pstate-schedutil | 2 | 165.97 | 1.31309 | 99.5712 | 480.15 | 880.4 | 0.001135847 | + +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+ + + amd-pstate-schedutil | 3 | 165.973 | 1.28448 | 99.9252 | 481.79 | 867.02 | 0.001153375 | + +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+ + + amd-pstate-schedutil | Average | 165.954 | 1.40692 | 99.2944 | 475.37 | 871.407 | 0.001147569 | + +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+ + + acpi-cpufreq-ondemand | 1 | | | | 2379.62 | 742.96 | 0.001345967 | + +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+ + + acpi-cpufreq-ondemand | 2 | | | | 441.74 | 817.49 | 0.001223256 | + +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+ + + acpi-cpufreq-ondemand | 3 | | | | 455.48 | 820.01 | 0.001219497 | + +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+ + + acpi-cpufreq-ondemand | Average | | | | 425.613 | 793.487 | 0.001260260 | + +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+ + + acpi-cpufreq-schedutil | 1 | | | | 459.69 | 838.54 | 0.001192548 | + +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+ + + acpi-cpufreq-schedutil | 2 | | | | 466.55 | 830.89 | 0.001203528 | + +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+ + + acpi-cpufreq-schedutil | 3 | | | | 470.38 | 837.32 | 0.001194286 | + +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+ + + acpi-cpufreq-schedutil | Average | | | | 465.54 | 835.583 | 0.001196769 | + +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+ + + acpi-cpufreq-ondemand VS acpi-cpufreq-schedutil | Comprison(%) | | | | 9.3810 | 5.3051 | -5.0379 | + +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+ + + amd-pstate-ondemand VS amd-pstate-schedutil | Comprison(%) | 124.7392 | -36.2934 | 140.7329 | 1.1081 | 2.0661 | -2.0242 | + +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+ + + acpi-cpufreq-ondemand VS amd-pstate-ondemand | Comprison(%) | | | | 10.4665 | 7.5968 | -7.0605 | + +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+ + + acpi-cpufreq-schedutil VS amd-pstate-schedutil | Comprison(%) | | | | 2.1115 | 4.2873 | -4.1110 | + +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+ Reference ===========
drivers/cpufreq/amd-pstate-ut.c +1 -1
@@ -1,4 +1,4 @@ -// SPDX-License-Identifier: GPL-1.0-or-later +// SPDX-License-Identifier: GPL-2.0-or-later /* * AMD Processor P-state Frequency Driver Unit Test *
tools/testing/selftests/amd-pstate/Makefile +10 -1
@@ -4,6 +4,15 @@ # No binaries, but make sure arg-less "make" doesn't trigger "run_tests" all: -TEST_PROGS := amd-pstate-ut.sh +uname_M := $(shell uname -m 2>/dev/null || echo not) +ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/) + +ifeq (x86,$(ARCH)) +TEST_GEN_FILES += ../../../power/x86/amd_pstate_tracer/amd_pstate_trace.py +TEST_GEN_FILES += ../../../power/x86/intel_pstate_tracer/intel_pstate_tracer.py +endif + +TEST_PROGS := run.sh +TEST_FILES := basic.sh tbench.sh gitsource.sh include ../lib.mk
tools/testing/selftests/amd-pstate/amd-pstate-ut.sh deleted +0 -56
56 lines not on this page · raw message
tools/testing/selftests/amd-pstate/basic.sh new file +38 -0
@@ -0,0 +1,38 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 + +# amd-pstate-ut is a test module for testing the amd-pstate driver. +# It can only run on x86 architectures and current cpufreq driver +# must be amd-pstate. +# (1) It can help all users to verify their processor support +# (SBIOS/Firmware or Hardware). +# (2) Kernel can have a basic function test to avoid the kernel +# regression during the update. +# (3) We can introduce more functional or performance tests to align +# the result together, it will benefit power and performance scale optimization. + +# protect against multiple inclusion +if [ $FILE_BASIC ]; then + return 0 +else + FILE_BASIC=DONE +fi + +amd_pstate_basic() +{ + printf "\n---------------------------------------------\n" + printf "*** Running AMD P-state ut ***" + printf "\n---------------------------------------------\n" + + if ! /sbin/modprobe -q -n amd-pstate-ut; then + echo "amd-pstate-ut: module amd-pstate-ut is not found [SKIP]" + exit $ksft_skip + fi + if /sbin/modprobe -q amd-pstate-ut; then + /sbin/modprobe -q -r amd-pstate-ut + echo "amd-pstate-basic: ok" + else + echo "amd-pstate-basic: [FAIL]" + exit 1 + fi +}
tools/testing/selftests/amd-pstate/gitsource.sh new file +354 -0
354 lines not on this page · raw message
tools/testing/selftests/amd-pstate/run.sh new file +387 -0
387 lines not on this page · raw message
tools/testing/selftests/amd-pstate/tbench.sh new file +339 -0
339 lines not on this page · raw message
tools/testing/selftests/efivarfs/efivarfs.sh +5 -0
@@ -87,6 +87,11 @@ test_create_read() { local file=$efivarfs_mount/$FUNCNAME-$test_guid ./create-read $file + if [ $? -ne 0 ]; then + echo "create and read $file failed" + file_cleanup $file + exit 1 + fi file_cleanup $file }
tools/testing/selftests/ftrace/test.d/ftrace/func_event_triggers.tc +11 -4
@@ -38,11 +38,18 @@ cnt_trace() { test_event_enabled() { val=$1 + check_times=10 # wait for 10 * SLEEP_TIME at most - e=`cat $EVENT_ENABLE` - if [ "$e" != $val ]; then - fail "Expected $val but found $e" - fi + while [ $check_times -ne 0 ]; do + e=`cat $EVENT_ENABLE` + if [ "$e" == $val ]; then + return 0 + fi + sleep $SLEEP_TIME + check_times=$((check_times - 1)) + done + + fail "Expected $val but found $e" } run_enable_disable() {
tools/testing/selftests/ftrace/test.d/functions +7 -1
@@ -142,9 +142,15 @@ finish_ftrace() { check_requires() { # Check required files and tracers for i in "$@" ; do + p=${i%:program} r=${i%:README} t=${i%:tracer} - if [ $t != $i ]; then + if [ $p != $i ]; then + if ! which $p ; then + echo "Required program $p is not found." + exit_unresolved + fi + elif [ $t != $i ]; then if ! grep -wq $t available_tracers ; then echo "Required tracer $t is not configured." exit_unsupported
tools/testing/selftests/ftrace/test.d/preemptirq/irqsoff_tracer.tc +4 -4
@@ -46,10 +46,10 @@ cat trace grep -q "tracer: preemptoff" trace || fail # Check the end of the section -egrep -q "5.....us : <stack trace>" trace || fail +grep -E -q "5.....us : <stack trace>" trace || fail # Check for 500ms of latency -egrep -q "latency: 5..... us" trace || fail +grep -E -q "latency: 5..... us" trace || fail reset_tracer
@@ -69,10 +69,10 @@ cat trace grep -q "tracer: irqsoff" trace || fail # Check the end of the section -egrep -q "5.....us : <stack trace>" trace || fail +grep -E -q "5.....us : <stack trace>" trace || fail # Check for 500ms of latency -egrep -q "latency: 5..... us" trace || fail +grep -E -q "latency: 5..... us" trace || fail reset_tracer exit 0
tools/testing/selftests/ftrace/test.d/tracer/wakeup.tc +1 -6
@@ -1,12 +1,7 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0 # description: Test wakeup tracer -# requires: wakeup:tracer - -if ! which chrt ; then - echo "chrt is not found. This test requires nice command." - exit_unresolved -fi +# requires: wakeup:tracer chrt:program echo wakeup > current_tracer echo 1 > tracing_on
tools/testing/selftests/ftrace/test.d/tracer/wakeup_rt.tc +1 -6
@@ -1,12 +1,7 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0 # description: Test wakeup RT tracer -# requires: wakeup_rt:tracer - -if ! which chrt ; then - echo "chrt is not found. This test requires chrt command." - exit_unresolved -fi +# requires: wakeup_rt:tracer chrt:program echo wakeup_rt > current_tracer echo 1 > tracing_on
tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-field-variable-support.tc +1 -1
@@ -1,7 +1,7 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0 # description: event trigger - test field variable support -# requires: set_event synthetic_events events/sched/sched_process_fork/hist +# requires: set_event synthetic_events events/sched/sched_process_fork/hist ping:program fail() { #msg echo $1
tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-inter-event-combined-hist.tc +1 -1
@@ -1,7 +1,7 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0 # description: event trigger - test inter-event combined histogram trigger -# requires: set_event synthetic_events events/sched/sched_process_fork/hist +# requires: set_event synthetic_events events/sched/sched_process_fork/hist ping:program fail() { #msg echo $1
tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-onchange-action-hist.tc +1 -1
@@ -1,7 +1,7 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0 # description: event trigger - test inter-event histogram trigger onchange action -# requires: set_event "onchange(var)":README +# requires: set_event "onchange(var)":README ping:program fail() { #msg echo $1
tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-onmatch-action-hist.tc +1 -1
@@ -1,7 +1,7 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0 # description: event trigger - test inter-event histogram trigger onmatch action -# requires: set_event synthetic_events events/sched/sched_process_fork/hist +# requires: set_event synthetic_events events/sched/sched_process_fork/hist ping:program fail() { #msg echo $1
tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-onmatch-onmax-action-hist.tc +1 -1
@@ -1,7 +1,7 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0 # description: event trigger - test inter-event histogram trigger onmatch-onmax action -# requires: set_event synthetic_events events/sched/sched_process_fork/hist +# requires: set_event synthetic_events events/sched/sched_process_fork/hist ping:program fail() { #msg echo $1
tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-onmax-action-hist.tc +1 -1
@@ -1,7 +1,7 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0 # description: event trigger - test inter-event histogram trigger onmax action -# requires: set_event synthetic_events events/sched/sched_process_fork/hist +# requires: set_event synthetic_events events/sched/sched_process_fork/hist ping:program fail() { #msg echo $1
tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-snapshot-action-hist.tc +1 -1
@@ -1,7 +1,7 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0 # description: event trigger - test inter-event histogram trigger snapshot action -# requires: set_event snapshot events/sched/sched_process_fork/hist "onchange(var)":README "snapshot()":README +# requires: set_event snapshot events/sched/sched_process_fork/hist "onchange(var)":README "snapshot()":README ping:program fail() { #msg echo $1
tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-eprobe.tc +1 -1
@@ -14,7 +14,7 @@ FIELD="filename" SYNTH="synth_open" EPROBE="eprobe_open" -echo "$SYNTH u64 filename; s64 ret;" > synthetic_events +echo "$SYNTH unsigned long filename; long ret;" > synthetic_events echo "hist:keys=common_pid:__arg__1=$FIELD" > events/$SYSTEM/$START/trigger echo "hist:keys=common_pid:filename=\$__arg__1,ret=ret:onmatch($SYSTEM.$START).trace($SYNTH,\$filename,\$ret)" > events/$SYSTEM/$END/trigger
tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-dynstring.tc +1 -1
@@ -1,7 +1,7 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0 # description: event trigger - test inter-event histogram trigger trace action with dynamic string param -# requires: set_event synthetic_events events/sched/sched_process_exec/hist "char name[]' >> synthetic_events":README +# requires: set_event synthetic_events events/sched/sched_process_exec/hist "char name[]' >> synthetic_events":README ping:program fail() { #msg echo $1
tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-trace-action-hist.tc +1 -1
@@ -1,7 +1,7 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0 # description: event trigger - test inter-event histogram trigger trace action -# requires: set_event synthetic_events events/sched/sched_process_fork/hist "trace(<synthetic_event>":README +# requires: set_event synthetic_events events/sched/sched_process_fork/hist "trace(<synthetic_event>":README ping:program fail() { #msg echo $1
tools/testing/selftests/gpio/gpio-sim.sh +1 -1
@@ -27,7 +27,7 @@ remove_chip() { continue fi - LINES=`ls $CONFIGFS_DIR/$CHIP/$BANK/ | egrep ^line` + LINES=`ls $CONFIGFS_DIR/$CHIP/$BANK/ | grep -E ^line` if [ "$?" = 0 ]; then for LINE in $LINES; do if [ -e $CONFIGFS_DIR/$CHIP/$BANK/$LINE/hog ]; then
tools/testing/selftests/kselftest_deps.sh +1 -1
@@ -90,7 +90,7 @@ pass_libs=() pass_cnt=0 # Get all TARGETS from selftests Makefile -targets=$(egrep "^TARGETS +|^TARGETS =" Makefile | cut -d "=" -f2) +targets=$(grep -E "^TARGETS +|^TARGETS =" Makefile | cut -d "=" -f2) # Single test case if [ $# -eq 2 ]
tools/testing/selftests/lib.mk +5 -0
@@ -123,6 +123,11 @@ endef clean: $(CLEAN) +# Enables to extend CFLAGS and LDFLAGS from command line, e.g. +# make USERCFLAGS=-Werror USERLDFLAGS=-static +CFLAGS += $(USERCFLAGS) +LDFLAGS += $(USERLDFLAGS) + # When make O= with kselftest target from main level # the following aren't defined. #
tools/testing/selftests/rtc/rtctest.c +32 -1
@@ -31,7 +31,6 @@ FIXTURE(rtc) {FIXTURE_SETUP (rtc) { self->fd =open (rtc_file,O_RDONLY ); -ASSERT_NE (-1 , self->fd); }FIXTURE_TEARDOWN (rtc) {
@@ -42,6 +41,10 @@ TEST_F(rtc, date_read) {int rc;struct rtc_time rtc_tm; +if (self->fd ==-1 && errno ==ENOENT ) +SKIP (return,"Skipping test since %s does not exist" , rtc_file); +ASSERT_NE (-1 , self->fd); +/* Read the RTC time/date */ rc =ioctl (self->fd,RTC_RD_TIME , &rtc_tm);ASSERT_NE (-1 , rc);
@@ -85,6 +88,10 @@ TEST_F_TIMEOUT(rtc, date_read_loop, READ_LOOP_DURATION_SEC + 2) {struct rtc_time rtc_tm;time_t start_rtc_read, prev_rtc_read; +if (self->fd ==-1 && errno ==ENOENT ) +SKIP (return,"Skipping test since %s does not exist" , rtc_file); +ASSERT_NE (-1 , self->fd); +TH_LOG ("Continuously reading RTC time for %ds (with %dms breaks after every read)." ,READ_LOOP_DURATION_SEC ,READ_LOOP_SLEEP_MS );
@@ -119,6 +126,10 @@ TEST_F_TIMEOUT(rtc, uie_read, NUM_UIE + 2) {int i, rc, irq =0 ;unsigned long data; +if (self->fd ==-1 && errno ==ENOENT ) +SKIP (return,"Skipping test since %s does not exist" , rtc_file); +ASSERT_NE (-1 , self->fd); +/* Turn on update interrupts */ rc =ioctl (self->fd,RTC_UIE_ON ,0 );if (rc ==-1 ) {
@@ -144,6 +155,10 @@ TEST_F(rtc, uie_select) {int i, rc, irq =0 ;unsigned long data; +if (self->fd ==-1 && errno ==ENOENT ) +SKIP (return,"Skipping test since %s does not exist" , rtc_file); +ASSERT_NE (-1 , self->fd); +/* Turn on update interrupts */ rc =ioctl (self->fd,RTC_UIE_ON ,0 );if (rc ==-1 ) {
@@ -183,6 +198,10 @@ TEST_F(rtc, alarm_alm_set) {time_t secs, new;int rc; +if (self->fd ==-1 && errno ==ENOENT ) +SKIP (return,"Skipping test since %s does not exist" , rtc_file); +ASSERT_NE (-1 , self->fd); + rc =ioctl (self->fd,RTC_RD_TIME , &tm);ASSERT_NE (-1 , rc);
@@ -237,6 +256,10 @@ TEST_F(rtc, alarm_wkalm_set) {time_t secs, new;int rc; +if (self->fd ==-1 && errno ==ENOENT ) +SKIP (return,"Skipping test since %s does not exist" , rtc_file); +ASSERT_NE (-1 , self->fd); + rc =ioctl (self->fd,RTC_RD_TIME , &alarm.time);ASSERT_NE (-1 , rc);
@@ -285,6 +308,10 @@ TEST_F_TIMEOUT(rtc, alarm_alm_set_minute, 65) {time_t secs, new;int rc; +if (self->fd ==-1 && errno ==ENOENT ) +SKIP (return,"Skipping test since %s does not exist" , rtc_file); +ASSERT_NE (-1 , self->fd); + rc =ioctl (self->fd,RTC_RD_TIME , &tm);ASSERT_NE (-1 , rc);
@@ -339,6 +366,10 @@ TEST_F_TIMEOUT(rtc, alarm_wkalm_set_minute, 65) {time_t secs, new;int rc; +if (self->fd ==-1 && errno ==ENOENT ) +SKIP (return,"Skipping test since %s does not exist" , rtc_file); +ASSERT_NE (-1 , self->fd); + rc =ioctl (self->fd,RTC_RD_TIME , &alarm.time);ASSERT_NE (-1 , rc);
tools/testing/selftests/splice/short_splice_read.sh +2 -2
@@ -127,7 +127,7 @@ expect_success "proc_handler: special read splice" test_splice /proc/sys/kernel/ if ! [ -d /sys/module/test_module/sections ] ; then expect_success "test_module kernel module load" modprobe test_module fi -expect_failure "kernfs attr splice" test_splice /sys/module/test_module/coresize -expect_failure "kernfs binattr splice" test_splice /sys/module/test_module/sections/.init.text +expect_success "kernfs attr splice" test_splice /sys/module/test_module/coresize +expect_success "kernfs binattr splice" test_splice /sys/module/test_module/sections/.init.text exit $ret
tools/testing/selftests/tpm2/Makefile +1 -1
@@ -1,5 +1,5 @@ # SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) include ../lib.mk -TEST_PROGS := test_smoke.sh test_space.sh +TEST_PROGS := test_smoke.sh test_space.sh test_async.sh TEST_PROGS_EXTENDED := tpm2.py tpm2_tests.py
tools/testing/selftests/tpm2/test_async.sh new file +10 -0
@@ -0,0 +1,10 @@ +#!/bin/sh +# SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) + +# Kselftest framework requirement - SKIP code is 4. +ksft_skip=4 + +[ -e /dev/tpm0 ] || exit $ksft_skip +[ -e /dev/tpmrm0 ] || exit $ksft_skip + +python3 -m unittest -v tpm2_tests.AsyncTest
tools/testing/selftests/tpm2/test_smoke.sh +0 -1
@@ -7,4 +7,3 @@ ksft_skip=4 [ -e /dev/tpm0 ] || exit $ksft_skip python3 -m unittest -v tpm2_tests.SmokeTest -python3 -m unittest -v tpm2_tests.AsyncTest
tools/testing/selftests/vDSO/vdso_test_getcpu.c +4 -0
@@ -14,7 +14,11 @@#include "../kselftest.h" #include "parse_vdso.h" +#if defined(__riscv) +const char *version ="LINUX_4.15" ; +#else const char *version ="LINUX_2.6" ; +#endif const char *name ="__vdso_getcpu" ;struct getcpu_cache ;
tools/testing/selftests/vDSO/vdso_test_gettimeofday.c +3 -0
@@ -27,6 +27,9 @@#if defined(__aarch64__)const char *version ="LINUX_2.6.39" ;const char *name ="__kernel_gettimeofday" ; +#elif defined(__riscv) +const char *version ="LINUX_4.15" ; +const char *name ="__vdso_gettimeofday" ;#else const char *version ="LINUX_2.6" ;const char *name ="__vdso_gettimeofday" ;
tools/testing/selftests/watchdog/watchdog-test.c +101 -5
165 lines not on this page · raw message
The pull request you sent on Mon, 12 Dec 2022 12:59:15 -0700:
The pull request you sent on Mon, 12 Dec 2022 12:59:15 -0700:
Quoted 1 line
git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftesttags/linux-kselftest-next-6.2-rc1
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/23a68d14def8247735b66a14b370b42d8fcedb47
Thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/prtracker.html