Skip to content

Commit 9ecc4d7

Browse files
committed
Merge tag 'linux-kselftest-5.7-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
Pull kselftest fixes from Shuah Khan: "ftrace test fixes and a fix to kvm Makefile for relocatable native/cross builds and installs" * tag 'linux-kselftest-5.7-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: selftests: fix kvm relocatable native/cross builds and installs selftests/ftrace: Make XFAIL green color ftrace/selftest: make unresolved cases cause failure if --fail-unresolved set ftrace/selftests: workaround cgroup RT scheduling issues
2 parents 6e7f2ea + 66d69e0 commit 9ecc4d7

File tree

2 files changed

+58
-3
lines changed

2 files changed

+58
-3
lines changed

tools/testing/selftests/ftrace/ftracetest

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ echo " -v|--verbose Increase verbosity of test messages"
1717
echo " -vv Alias of -v -v (Show all results in stdout)"
1818
echo " -vvv Alias of -v -v -v (Show all commands immediately)"
1919
echo " --fail-unsupported Treat UNSUPPORTED as a failure"
20+
echo " --fail-unresolved Treat UNRESOLVED as a failure"
2021
echo " -d|--debug Debug mode (trace all shell commands)"
2122
echo " -l|--logdir <dir> Save logs on the <dir>"
2223
echo " If <dir> is -, all logs output in console only"
@@ -29,8 +30,25 @@ err_ret=1
2930
# kselftest skip code is 4
3031
err_skip=4
3132

33+
# cgroup RT scheduling prevents chrt commands from succeeding, which
34+
# induces failures in test wakeup tests. Disable for the duration of
35+
# the tests.
36+
37+
readonly sched_rt_runtime=/proc/sys/kernel/sched_rt_runtime_us
38+
39+
sched_rt_runtime_orig=$(cat $sched_rt_runtime)
40+
41+
setup() {
42+
echo -1 > $sched_rt_runtime
43+
}
44+
45+
cleanup() {
46+
echo $sched_rt_runtime_orig > $sched_rt_runtime
47+
}
48+
3249
errexit() { # message
3350
echo "Error: $1" 1>&2
51+
cleanup
3452
exit $err_ret
3553
}
3654

@@ -39,6 +57,8 @@ if [ `id -u` -ne 0 ]; then
3957
errexit "this must be run by root user"
4058
fi
4159

60+
setup
61+
4262
# Utilities
4363
absdir() { # file_path
4464
(cd `dirname $1`; pwd)
@@ -93,6 +113,10 @@ parse_opts() { # opts
93113
UNSUPPORTED_RESULT=1
94114
shift 1
95115
;;
116+
--fail-unresolved)
117+
UNRESOLVED_RESULT=1
118+
shift 1
119+
;;
96120
--logdir|-l)
97121
LOG_DIR=$2
98122
shift 2
@@ -157,6 +181,7 @@ KEEP_LOG=0
157181
DEBUG=0
158182
VERBOSE=0
159183
UNSUPPORTED_RESULT=0
184+
UNRESOLVED_RESULT=0
160185
STOP_FAILURE=0
161186
# Parse command-line options
162187
parse_opts $*
@@ -235,6 +260,7 @@ TOTAL_RESULT=0
235260

236261
INSTANCE=
237262
CASENO=0
263+
238264
testcase() { # testfile
239265
CASENO=$((CASENO+1))
240266
desc=`grep "^#[ \t]*description:" $1 | cut -f2 -d:`
@@ -260,7 +286,7 @@ eval_result() { # sigval
260286
$UNRESOLVED)
261287
prlog " [${color_blue}UNRESOLVED${color_reset}]"
262288
UNRESOLVED_CASES="$UNRESOLVED_CASES $CASENO"
263-
return 1 # this is a kind of bug.. something happened.
289+
return $UNRESOLVED_RESULT # depends on use case
264290
;;
265291
$UNTESTED)
266292
prlog " [${color_blue}UNTESTED${color_reset}]"
@@ -273,7 +299,7 @@ eval_result() { # sigval
273299
return $UNSUPPORTED_RESULT # depends on use case
274300
;;
275301
$XFAIL)
276-
prlog " [${color_red}XFAIL${color_reset}]"
302+
prlog " [${color_green}XFAIL${color_reset}]"
277303
XFAILED_CASES="$XFAILED_CASES $CASENO"
278304
return 0
279305
;;
@@ -406,5 +432,7 @@ prlog "# of unsupported: " `echo $UNSUPPORTED_CASES | wc -w`
406432
prlog "# of xfailed: " `echo $XFAILED_CASES | wc -w`
407433
prlog "# of undefined(test bug): " `echo $UNDEFINED_CASES | wc -w`
408434

435+
cleanup
436+
409437
# if no error, return 0
410438
exit $TOTAL_RESULT

tools/testing/selftests/kvm/Makefile

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,34 @@ all:
55

66
top_srcdir = ../../../..
77
KSFT_KHDR_INSTALL := 1
8+
9+
# For cross-builds to work, UNAME_M has to map to ARCH and arch specific
10+
# directories and targets in this Makefile. "uname -m" doesn't map to
11+
# arch specific sub-directory names.
12+
#
13+
# UNAME_M variable to used to run the compiles pointing to the right arch
14+
# directories and build the right targets for these supported architectures.
15+
#
16+
# TEST_GEN_PROGS and LIBKVM are set using UNAME_M variable.
17+
# LINUX_TOOL_ARCH_INCLUDE is set using ARCH variable.
18+
#
19+
# x86_64 targets are named to include x86_64 as a suffix and directories
20+
# for includes are in x86_64 sub-directory. s390x and aarch64 follow the
21+
# same convention. "uname -m" doesn't result in the correct mapping for
22+
# s390x and aarch64.
23+
#
24+
# No change necessary for x86_64
825
UNAME_M := $(shell uname -m)
926

27+
# Set UNAME_M for arm64 compile/install to work
28+
ifeq ($(ARCH),arm64)
29+
UNAME_M := aarch64
30+
endif
31+
# Set UNAME_M s390x compile/install to work
32+
ifeq ($(ARCH),s390)
33+
UNAME_M := s390x
34+
endif
35+
1036
LIBKVM = lib/assert.c lib/elf.c lib/io.c lib/kvm_util.c lib/sparsebit.c lib/test_util.c
1137
LIBKVM_x86_64 = lib/x86_64/processor.c lib/x86_64/vmx.c lib/x86_64/svm.c lib/x86_64/ucall.c
1238
LIBKVM_aarch64 = lib/aarch64/processor.c lib/aarch64/ucall.c
@@ -53,7 +79,7 @@ LIBKVM += $(LIBKVM_$(UNAME_M))
5379
INSTALL_HDR_PATH = $(top_srcdir)/usr
5480
LINUX_HDR_PATH = $(INSTALL_HDR_PATH)/include/
5581
LINUX_TOOL_INCLUDE = $(top_srcdir)/tools/include
56-
LINUX_TOOL_ARCH_INCLUDE = $(top_srcdir)/tools/arch/x86/include
82+
LINUX_TOOL_ARCH_INCLUDE = $(top_srcdir)/tools/arch/$(ARCH)/include
5783
CFLAGS += -Wall -Wstrict-prototypes -Wuninitialized -O2 -g -std=gnu99 \
5884
-fno-stack-protector -fno-PIE -I$(LINUX_TOOL_INCLUDE) \
5985
-I$(LINUX_TOOL_ARCH_INCLUDE) -I$(LINUX_HDR_PATH) -Iinclude \
@@ -84,6 +110,7 @@ $(LIBKVM_OBJ): $(OUTPUT)/%.o: %.c
84110
$(OUTPUT)/libkvm.a: $(LIBKVM_OBJ)
85111
$(AR) crs $@ $^
86112

113+
x := $(shell mkdir -p $(sort $(dir $(TEST_GEN_PROGS))))
87114
all: $(STATIC_LIBS)
88115
$(TEST_GEN_PROGS): $(STATIC_LIBS)
89116

0 commit comments

Comments
 (0)