Skip to content

Commit 2868b25

Browse files
committed
Merge tag 'linux-kselftest-4.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
Pull kselftest updates from Shuah Khan: "This update consists of: - important fixes for build failures and clean target related warnings to address regressions introduced in commit 88baa78 ("selftests: remove duplicated all and clean target") - several minor spelling fixes in and log messages and comment blocks. - Enabling configs for better test coverage in ftrace, vm, and cpufreq tests. - .gitignore changes" * tag 'linux-kselftest-4.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: (26 commits) selftests: x86: add missing executables to .gitignore selftests: watchdog: accept multiple params on command line selftests: create cpufreq kconfig fragments selftests: x86: override clean in lib.mk to fix warnings selftests: sync: override clean in lib.mk to fix warnings selftests: splice: override clean in lib.mk to fix warnings selftests: gpio: fix clean target to remove all generated files and dirs selftests: add gpio generated files to .gitignore selftests: powerpc: override clean in lib.mk to fix warnings selftests: gpio: override clean in lib.mk to fix warnings selftests: futex: override clean in lib.mk to fix warnings selftests: lib.mk: define CLEAN macro to allow Makefiles to override clean selftests: splice: fix clean target to not remove default_file_splice_read.sh selftests: gpio: add config fragment for gpio-mockup selftests: breakpoints: allow to cross-compile for aarch64/arm64 selftests/Makefile: Add missed PHONY targets selftests/vm/run_vmtests: Fix wrong comment selftests/Makefile: Add missed closing `"` in comment selftests/vm/run_vmtests: Polish output text selftests/timers: fix spelling mistake: "Asynchronous" ...
2 parents 00d9593 + 945f8f5 commit 2868b25

File tree

24 files changed

+124
-68
lines changed

24 files changed

+124
-68
lines changed

tools/testing/selftests/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
11
kselftest
2+
gpiogpio-event-mon
3+
gpiogpio-hammer
4+
gpioinclude/
5+
gpiolsgpio

tools/testing/selftests/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ TARGETS += x86
3939
TARGETS += zram
4040
#Please keep the TARGETS list alphabetically sorted
4141
# Run "make quicktest=1 run_tests" or
42-
# "make quicktest=1 kselftest from top level Makefile
42+
# "make quicktest=1 kselftest" from top level Makefile
4343

4444
TARGETS_HOTPLUG = cpu-hotplug
4545
TARGETS_HOTPLUG += memory-hotplug
@@ -133,4 +133,4 @@ clean:
133133
make OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\
134134
done;
135135

136-
.PHONY: install
136+
.PHONY: all run_tests hotplug run_hotplug clean_hotplug run_pstore_crash install clean

tools/testing/selftests/breakpoints/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
55
ifeq ($(ARCH),x86)
66
TEST_GEN_PROGS := breakpoint_test
77
endif
8-
ifeq ($(ARCH),aarch64)
8+
ifneq (,$(filter $(ARCH),aarch64 arm64))
99
TEST_GEN_PROGS := breakpoint_test_arm64
1010
endif
1111

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
CONFIG_CPU_FREQ=y
2+
CONFIG_CPU_FREQ_STAT=y
3+
CONFIG_CPU_FREQ_GOV_POWERSAVE=y
4+
CONFIG_CPU_FREQ_GOV_USERSPACE=y
5+
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
6+
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
7+
CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y
8+
CONFIG_DEBUG_RT_MUTEXES=y
9+
CONFIG_DEBUG_PI_LIST=y
10+
CONFIG_DEBUG_SPINLOCK=y
11+
CONFIG_DEBUG_MUTEXES=y
12+
CONFIG_DEBUG_LOCK_ALLOC=y
13+
CONFIG_PROVE_LOCKING=y
14+
CONFIG_LOCKDEP=y
15+
CONFIG_DEBUG_ATOMIC_SLEEP=y

tools/testing/selftests/ftrace/config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
CONFIG_KPROBES=y
12
CONFIG_FTRACE=y

tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ check_types() {
2626
test $X2 = $X3
2727
test 0x$X3 = $3
2828

29-
B4=`printf "%x" $4`
29+
B4=`printf "%02x" $4`
3030
B3=`echo -n $X3 | tail -c 3 | head -c 2`
3131
test $B3 = $B4
3232
}

tools/testing/selftests/futex/Makefile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ include ../lib.mk
88

99
all:
1010
for DIR in $(SUBDIRS); do \
11-
BUILD_TARGET=$$OUTPUT/$$DIR; \
11+
BUILD_TARGET=$(OUTPUT)/$$DIR; \
1212
mkdir $$BUILD_TARGET -p; \
1313
make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\
1414
done
@@ -22,7 +22,7 @@ override define INSTALL_RULE
2222
install -t $(INSTALL_PATH) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES)
2323

2424
@for SUBDIR in $(SUBDIRS); do \
25-
BUILD_TARGET=$$OUTPUT/$$SUBDIR; \
25+
BUILD_TARGET=$(OUTPUT)/$$SUBDIR; \
2626
mkdir $$BUILD_TARGET -p; \
2727
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$SUBDIR INSTALL_PATH=$(INSTALL_PATH)/$$SUBDIR install; \
2828
done;
@@ -32,9 +32,10 @@ override define EMIT_TESTS
3232
echo "./run.sh"
3333
endef
3434

35-
clean:
35+
override define CLEAN
3636
for DIR in $(SUBDIRS); do \
37-
BUILD_TARGET=$$OUTPUT/$$DIR; \
37+
BUILD_TARGET=$(OUTPUT)/$$DIR; \
3838
mkdir $$BUILD_TARGET -p; \
3939
make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\
4040
done
41+
endef

tools/testing/selftests/gpio/Makefile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,20 @@
22
TEST_PROGS := gpio-mockup.sh
33
TEST_FILES := gpio-mockup-sysfs.sh $(BINARIES)
44
BINARIES := gpio-mockup-chardev
5+
EXTRA_PROGS := ../gpiogpio-event-mon ../gpiogpio-hammer ../gpiolsgpio
6+
EXTRA_DIRS := ../gpioinclude/
7+
EXTRA_OBJS := ../gpiogpio-event-mon-in.o ../gpiogpio-event-mon.o
8+
EXTRA_OBJS += ../gpiogpio-hammer-in.o ../gpiogpio-utils.o ../gpiolsgpio-in.o
9+
EXTRA_OBJS += ../gpiolsgpio.o
510

611
include ../lib.mk
712

813
all: $(BINARIES)
914

10-
clean:
11-
$(RM) $(BINARIES)
15+
override define CLEAN
16+
$(RM) $(BINARIES) $(EXTRA_PROGS) $(EXTRA_OBJS)
17+
$(RM) -r $(EXTRA_DIRS)
18+
endef
1219

1320
CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/
1421
LDLIBS += -lmount -I/usr/include/libmount

tools/testing/selftests/gpio/config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CONFIG_GPIOLIB=y
2+
CONFIG_GPIO_MOCKUP=m

tools/testing/selftests/lib.mk

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,12 @@ endef
5151
emit_tests:
5252
$(EMIT_TESTS)
5353

54-
clean:
54+
define CLEAN
5555
$(RM) -r $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) $(EXTRA_CLEAN)
56+
endef
57+
58+
clean:
59+
$(CLEAN)
5660

5761
$(OUTPUT)/%:%.c
5862
$(LINK.c) $^ $(LDLIBS) -o $@

tools/testing/selftests/lib/config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
CONFIG_TEST_PRINTF=m
2+
CONFIG_TEST_BITMAP=m
3+
CONFIG_PRIME_NUMBERS=m

tools/testing/selftests/powerpc/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,13 @@ override define EMIT_TESTS
6060
done;
6161
endef
6262

63-
clean:
63+
override define CLEAN
6464
@for TARGET in $(SUB_DIRS); do \
6565
BUILD_TARGET=$(OUTPUT)/$$TARGET; \
6666
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean; \
6767
done;
6868
rm -f tags
69+
endef
6970

7071
tags:
7172
find . -name '*.c' -o -name '*.h' | xargs ctags

tools/testing/selftests/splice/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@ all: $(TEST_PROGS) $(EXTRA)
44

55
include ../lib.mk
66

7-
clean:
8-
rm -fr $(TEST_PROGS) $(EXTRA)
7+
EXTRA_CLEAN := $(EXTRA)

tools/testing/selftests/sync/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,4 @@ TESTS += sync_stress_merge.o
2020

2121
sync_test: $(OBJS) $(TESTS)
2222

23-
clean:
24-
$(RM) sync_test $(OBJS) $(TESTS)
23+
EXTRA_CLEAN := sync_test $(OBJS) $(TESTS)

tools/testing/selftests/timers/clocksource-switch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ int main(int argv, char **argc)
159159
}
160160

161161

162-
printf("Running Asyncrhonous Switching Tests...\n");
162+
printf("Running Asynchronous Switching Tests...\n");
163163
pid = fork();
164164
if (!pid)
165165
return run_tests(60);

tools/testing/selftests/vm/config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
CONFIG_SYSVIPC=y
12
CONFIG_USERFAULTFD=y

tools/testing/selftests/vm/map_hugetlb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ int main(void)
6262
void *addr;
6363
int ret;
6464

65-
addr = mmap(ADDR, LENGTH, PROTECTION, FLAGS, 0, 0);
65+
addr = mmap(ADDR, LENGTH, PROTECTION, FLAGS, -1, 0);
6666
if (addr == MAP_FAILED) {
6767
perror("mmap");
6868
exit(1);

tools/testing/selftests/vm/mlock2-tests.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ static int test_mlock_lock()
293293
unsigned long page_size = getpagesize();
294294

295295
map = mmap(NULL, 2 * page_size, PROT_READ | PROT_WRITE,
296-
MAP_ANONYMOUS | MAP_PRIVATE, 0, 0);
296+
MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
297297
if (map == MAP_FAILED) {
298298
perror("test_mlock_locked mmap");
299299
goto out;
@@ -402,7 +402,7 @@ static int test_mlock_onfault()
402402
unsigned long page_size = getpagesize();
403403

404404
map = mmap(NULL, 2 * page_size, PROT_READ | PROT_WRITE,
405-
MAP_ANONYMOUS | MAP_PRIVATE, 0, 0);
405+
MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
406406
if (map == MAP_FAILED) {
407407
perror("test_mlock_locked mmap");
408408
goto out;
@@ -445,7 +445,7 @@ static int test_lock_onfault_of_present()
445445
uint64_t page1_flags, page2_flags;
446446

447447
map = mmap(NULL, 2 * page_size, PROT_READ | PROT_WRITE,
448-
MAP_ANONYMOUS | MAP_PRIVATE, 0, 0);
448+
MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
449449
if (map == MAP_FAILED) {
450450
perror("test_mlock_locked mmap");
451451
goto out;
@@ -492,7 +492,7 @@ static int test_munlockall()
492492
unsigned long page_size = getpagesize();
493493

494494
map = mmap(NULL, 2 * page_size, PROT_READ | PROT_WRITE,
495-
MAP_ANONYMOUS | MAP_PRIVATE, 0, 0);
495+
MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
496496

497497
if (map == MAP_FAILED) {
498498
perror("test_munlockall mmap");
@@ -518,7 +518,7 @@ static int test_munlockall()
518518
munmap(map, 2 * page_size);
519519

520520
map = mmap(NULL, 2 * page_size, PROT_READ | PROT_WRITE,
521-
MAP_ANONYMOUS | MAP_PRIVATE, 0, 0);
521+
MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
522522

523523
if (map == MAP_FAILED) {
524524
perror("test_munlockall second mmap");
@@ -573,7 +573,7 @@ static int test_vma_management(bool call_mlock)
573573
struct vm_boundaries page3;
574574

575575
map = mmap(NULL, 3 * page_size, PROT_READ | PROT_WRITE,
576-
MAP_ANONYMOUS | MAP_PRIVATE, 0, 0);
576+
MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
577577
if (map == MAP_FAILED) {
578578
perror("mmap()");
579579
return ret;

tools/testing/selftests/vm/on-fault-limit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ static int test_limit(void)
2626
}
2727

2828
map = mmap(NULL, 2 * lims.rlim_max, PROT_READ | PROT_WRITE,
29-
MAP_PRIVATE | MAP_ANONYMOUS | MAP_POPULATE, 0, 0);
29+
MAP_PRIVATE | MAP_ANONYMOUS | MAP_POPULATE, -1, 0);
3030
if (map != MAP_FAILED)
3131
printf("mmap should have failed, but didn't\n");
3232
else {

tools/testing/selftests/vm/run_vmtests

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ fi
4949
mkdir $mnt
5050
mount -t hugetlbfs none $mnt
5151

52-
echo "--------------------"
52+
echo "---------------------"
5353
echo "running hugepage-mmap"
54-
echo "--------------------"
54+
echo "---------------------"
5555
./hugepage-mmap
5656
if [ $? -ne 0 ]; then
5757
echo "[FAIL]"
@@ -77,9 +77,9 @@ fi
7777
echo $shmmax > /proc/sys/kernel/shmmax
7878
echo $shmall > /proc/sys/kernel/shmall
7979

80-
echo "--------------------"
80+
echo "-------------------"
8181
echo "running map_hugetlb"
82-
echo "--------------------"
82+
echo "-------------------"
8383
./map_hugetlb
8484
if [ $? -ne 0 ]; then
8585
echo "[FAIL]"
@@ -92,9 +92,9 @@ echo "NOTE: The above hugetlb tests provide minimal coverage. Use"
9292
echo " https://github.com/libhugetlbfs/libhugetlbfs.git for"
9393
echo " hugetlb regression testing."
9494

95-
echo "--------------------"
95+
echo "-------------------"
9696
echo "running userfaultfd"
97-
echo "--------------------"
97+
echo "-------------------"
9898
./userfaultfd anon 128 32
9999
if [ $? -ne 0 ]; then
100100
echo "[FAIL]"
@@ -103,10 +103,10 @@ else
103103
echo "[PASS]"
104104
fi
105105

106-
echo "----------------------------"
106+
echo "---------------------------"
107107
echo "running userfaultfd_hugetlb"
108-
echo "----------------------------"
109-
# 258MB total huge pages == 128MB src and 128MB dst
108+
echo "---------------------------"
109+
# 256MB total huge pages == 128MB src and 128MB dst
110110
./userfaultfd hugetlb 128 32 $mnt/ufd_test_file
111111
if [ $? -ne 0 ]; then
112112
echo "[FAIL]"
@@ -116,9 +116,9 @@ else
116116
fi
117117
rm -f $mnt/ufd_test_file
118118

119-
echo "----------------------------"
119+
echo "-------------------------"
120120
echo "running userfaultfd_shmem"
121-
echo "----------------------------"
121+
echo "-------------------------"
122122
./userfaultfd shmem 128 32
123123
if [ $? -ne 0 ]; then
124124
echo "[FAIL]"
@@ -143,9 +143,9 @@ else
143143
echo "[PASS]"
144144
fi
145145

146-
echo "--------------------"
146+
echo "----------------------"
147147
echo "running on-fault-limit"
148-
echo "--------------------"
148+
echo "----------------------"
149149
sudo -u nobody ./on-fault-limit
150150
if [ $? -ne 0 ]; then
151151
echo "[FAIL]"

tools/testing/selftests/vm/thuge-gen.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ void test_mmap(unsigned long size, unsigned flags)
146146

147147
before = read_free(size);
148148
map = mmap(NULL, size*NUM_PAGES, PROT_READ|PROT_WRITE,
149-
MAP_PRIVATE|MAP_ANONYMOUS|MAP_HUGETLB|flags, 0, 0);
149+
MAP_PRIVATE|MAP_ANONYMOUS|MAP_HUGETLB|flags, -1, 0);
150150

151151
if (map == (char *)-1) err("mmap");
152152
memset(map, 0xff, size*NUM_PAGES);

0 commit comments

Comments
 (0)