Skip to content

Commit 1216ad2

Browse files
committed
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git
# Conflicts: # tools/testing/selftests/clone3/clone3.c
2 parents 2349541 + 5247e6d commit 1216ad2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+696
-563
lines changed

Documentation/dev-tools/kselftest.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ You can specify multiple tests to skip::
112112
You can also specify a restricted list of tests to run together with a
113113
dedicated skiplist::
114114

115-
$ make TARGETS="bpf breakpoints size timers" SKIP_TARGETS=bpf kselftest
115+
$ make TARGETS="breakpoints size timers" SKIP_TARGETS=size kselftest
116116

117117
See the top-level tools/testing/selftests/Makefile for the list of all
118118
possible targets.
@@ -165,7 +165,7 @@ To see the list of available tests, the `-l` option can be used::
165165
The `-c` option can be used to run all the tests from a test collection, or
166166
the `-t` option for specific single tests. Either can be used multiple times::
167167

168-
$ ./run_kselftest.sh -c bpf -c seccomp -t timers:posix_timers -t timer:nanosleep
168+
$ ./run_kselftest.sh -c size -c seccomp -t timers:posix_timers -t timer:nanosleep
169169

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

@@ -210,7 +210,7 @@ option is supported, such as::
210210
tests by using variables specified in `Running a subset of selftests`_
211211
section::
212212

213-
$ make -C tools/testing/selftests gen_tar TARGETS="bpf" FORMAT=.xz
213+
$ make -C tools/testing/selftests gen_tar TARGETS="size" FORMAT=.xz
214214

215215
.. _tar's auto-compress: https://www.gnu.org/software/tar/manual/html_node/gzip.html#auto_002dcompress
216216

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1366,8 +1366,8 @@ kselftest-%: headers FORCE
13661366
PHONY += kselftest-merge
13671367
kselftest-merge:
13681368
$(if $(wildcard $(objtree)/.config),, $(error No .config exists, config your kernel first!))
1369-
$(Q)find $(srctree)/tools/testing/selftests -name config | \
1370-
xargs $(srctree)/scripts/kconfig/merge_config.sh -m $(objtree)/.config
1369+
$(Q)find $(srctree)/tools/testing/selftests -name config -o -name config.$(UTS_MACHINE) | \
1370+
xargs $(srctree)/scripts/kconfig/merge_config.sh -y -m $(objtree)/.config
13711371
$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
13721372

13731373
# ---------------------------------------------------------------------------

tools/power/x86/amd_pstate_tracer/amd_pstate_trace.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@
3030
import Gnuplot
3131
from numpy import *
3232
from decimal import *
33-
sys.path.append('../intel_pstate_tracer')
34-
#import intel_pstate_tracer
33+
sys.path.append(os.path.join(os.path.dirname(__file__), "..", "intel_pstate_tracer"))
3534
import intel_pstate_tracer as ipt
3635

3736
__license__ = "GPL version 2"

tools/testing/selftests/amd-pstate/gitsource.sh

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
#!/bin/bash
22
# SPDX-License-Identifier: GPL-2.0
33

44
# Testing and monitor the cpu desire performance, frequency, load,
@@ -66,25 +66,30 @@ post_clear_gitsource()
6666

6767
install_gitsource()
6868
{
69-
if [ ! -d $git_name ]; then
69+
if [ ! -d $SCRIPTDIR/$git_name ]; then
70+
pushd $(pwd) > /dev/null 2>&1
71+
cd $SCRIPTDIR
7072
printf "Download gitsource, please wait a moment ...\n\n"
7173
wget -O $git_tar $gitsource_url > /dev/null 2>&1
7274

7375
printf "Tar gitsource ...\n\n"
7476
tar -xzf $git_tar
77+
popd > /dev/null 2>&1
7578
fi
7679
}
7780

7881
# $1: governor, $2: loop
7982
run_gitsource()
8083
{
8184
echo "Launching amd pstate tracer for $1 #$2 tracer_interval: $TRACER_INTERVAL"
82-
./amd_pstate_trace.py -n tracer-gitsource-$1-$2 -i $TRACER_INTERVAL > /dev/null 2>&1 &
85+
$TRACER -n tracer-gitsource-$1-$2 -i $TRACER_INTERVAL > /dev/null 2>&1 &
8386

8487
printf "Make and test gitsource for $1 #$2 make_cpus: $MAKE_CPUS\n"
85-
cd $git_name
86-
perf stat -a --per-socket -I 1000 -e power/energy-pkg/ /usr/bin/time -o ../$OUTFILE_GIT.time-gitsource-$1-$2.log make test -j$MAKE_CPUS > ../$OUTFILE_GIT-perf-$1-$2.log 2>&1
87-
cd ..
88+
BACKUP_DIR=$(pwd)
89+
pushd $BACKUP_DIR > /dev/null 2>&1
90+
cd $SCRIPTDIR/$git_name
91+
$PERF stat -a --per-socket -I 1000 -e power/energy-pkg/ /usr/bin/time -o $BACKUP_DIR/$OUTFILE_GIT.time-gitsource-$1-$2.log make test -j$MAKE_CPUS > $BACKUP_DIR/$OUTFILE_GIT-perf-$1-$2.log 2>&1
92+
popd > /dev/null 2>&1
8893

8994
for job in `jobs -p`
9095
do

tools/testing/selftests/amd-pstate/run.sh

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ else
88
FILE_MAIN=DONE
99
fi
1010

11-
source basic.sh
12-
source tbench.sh
13-
source gitsource.sh
11+
SCRIPTDIR=`dirname "$0"`
12+
TRACER=$SCRIPTDIR/../../../power/x86/amd_pstate_tracer/amd_pstate_trace.py
13+
14+
source $SCRIPTDIR/basic.sh
15+
source $SCRIPTDIR/tbench.sh
16+
source $SCRIPTDIR/gitsource.sh
1417

1518
# amd-pstate-ut only run on x86/x86_64 AMD systems.
1619
ARCH=$(uname -m 2>/dev/null | sed -e 's/i.86/x86/' -e 's/x86_64/x86/')
@@ -22,6 +25,7 @@ OUTFILE=selftest
2225
OUTFILE_TBENCH="$OUTFILE.tbench"
2326
OUTFILE_GIT="$OUTFILE.gitsource"
2427

28+
PERF=/usr/bin/perf
2529
SYSFS=
2630
CPUROOT=
2731
CPUFREQROOT=
@@ -151,14 +155,15 @@ help()
151155
[-p <tbench process number>]
152156
[-l <loop times for tbench>]
153157
[-i <amd tracer interval>]
158+
[-b <perf binary>]
154159
[-m <comparative test: acpi-cpufreq>]
155160
\n"
156161
exit 2
157162
}
158163

159164
parse_arguments()
160165
{
161-
while getopts ho:c:t:p:l:i:m: arg
166+
while getopts ho:c:t:p:l:i:b:m: arg
162167
do
163168
case $arg in
164169
h) # --help
@@ -189,6 +194,10 @@ parse_arguments()
189194
TRACER_INTERVAL=$OPTARG
190195
;;
191196

197+
b) # --perf-binary
198+
PERF=`realpath $OPTARG`
199+
;;
200+
192201
m) # --comparative-test
193202
COMPARATIVE_TEST=$OPTARG
194203
;;
@@ -202,8 +211,8 @@ parse_arguments()
202211

203212
command_perf()
204213
{
205-
if ! command -v perf > /dev/null; then
206-
echo $msg please install perf. >&2
214+
if ! $PERF -v; then
215+
echo $msg please install perf or provide perf binary path as argument >&2
207216
exit $ksft_skip
208217
fi
209218
}

tools/testing/selftests/amd-pstate/tbench.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ post_clear_tbench()
6464
run_tbench()
6565
{
6666
echo "Launching amd pstate tracer for $1 #$2 tracer_interval: $TRACER_INTERVAL"
67-
./amd_pstate_trace.py -n tracer-tbench-$1-$2 -i $TRACER_INTERVAL > /dev/null 2>&1 &
67+
$TRACER -n tracer-tbench-$1-$2 -i $TRACER_INTERVAL > /dev/null 2>&1 &
6868

6969
printf "Test tbench for $1 #$2 time_limit: $TIME_LIMIT procs_num: $PROCESS_NUM\n"
7070
tbench_srv > /dev/null 2>&1 &
71-
perf stat -a --per-socket -I 1000 -e power/energy-pkg/ tbench -t $TIME_LIMIT $PROCESS_NUM > $OUTFILE_TBENCH-perf-$1-$2.log 2>&1
71+
$PERF stat -a --per-socket -I 1000 -e power/energy-pkg/ tbench -t $TIME_LIMIT $PROCESS_NUM > $OUTFILE_TBENCH-perf-$1-$2.log 2>&1
7272

7373
pid=`pidof tbench_srv`
7474
kill $pid

tools/testing/selftests/cachestat/test_cachestat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ static const char * const dev_files[] = {
2727
void print_cachestat(struct cachestat *cs)
2828
{
2929
ksft_print_msg(
30-
"Using cachestat: Cached: %lu, Dirty: %lu, Writeback: %lu, Evicted: %lu, Recently Evicted: %lu\n",
30+
"Using cachestat: Cached: %llu, Dirty: %llu, Writeback: %llu, Evicted: %llu, Recently Evicted: %llu\n",
3131
cs->nr_cache, cs->nr_dirty, cs->nr_writeback,
3232
cs->nr_evicted, cs->nr_recently_evicted);
3333
}

tools/testing/selftests/capabilities/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
TEST_GEN_FILES := validate_cap
33
TEST_GEN_PROGS := test_execve
44

5-
CFLAGS += -O2 -g -std=gnu99 -Wall
5+
CFLAGS += -O2 -g -std=gnu99 -Wall $(KHDR_INCLUDES)
66
LDLIBS += -lcap-ng -lrt -ldl
77

88
include ../lib.mk

tools/testing/selftests/capabilities/test_execve.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,6 @@
2020

2121
#include "../kselftest.h"
2222

23-
#ifndef PR_CAP_AMBIENT
24-
#define PR_CAP_AMBIENT 47
25-
# define PR_CAP_AMBIENT_IS_SET 1
26-
# define PR_CAP_AMBIENT_RAISE 2
27-
# define PR_CAP_AMBIENT_LOWER 3
28-
# define PR_CAP_AMBIENT_CLEAR_ALL 4
29-
#endif
30-
3123
static int nerrs;
3224
static pid_t mpid; /* main() pid is used to avoid duplicate test counts */
3325

tools/testing/selftests/capabilities/validate_cap.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,6 @@
99

1010
#include "../kselftest.h"
1111

12-
#ifndef PR_CAP_AMBIENT
13-
#define PR_CAP_AMBIENT 47
14-
# define PR_CAP_AMBIENT_IS_SET 1
15-
# define PR_CAP_AMBIENT_RAISE 2
16-
# define PR_CAP_AMBIENT_LOWER 3
17-
# define PR_CAP_AMBIENT_CLEAR_ALL 4
18-
#endif
19-
2012
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 19)
2113
# define HAVE_GETAUXVAL
2214
#endif

0 commit comments

Comments
 (0)