Skip to content

Commit

Permalink
Merge tag 'linux-kselftest-4.12-rc1' of git://git.kernel.org/pub/scm/…
Browse files Browse the repository at this point in the history
…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"
  ...
  • Loading branch information
torvalds committed May 9, 2017
2 parents 00d9593 + 945f8f5 commit 2868b25
Show file tree
Hide file tree
Showing 24 changed files with 124 additions and 68 deletions.
4 changes: 4 additions & 0 deletions tools/testing/selftests/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
kselftest
gpiogpio-event-mon
gpiogpio-hammer
gpioinclude/
gpiolsgpio
4 changes: 2 additions & 2 deletions tools/testing/selftests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ TARGETS += x86
TARGETS += zram
#Please keep the TARGETS list alphabetically sorted
# Run "make quicktest=1 run_tests" or
# "make quicktest=1 kselftest from top level Makefile
# "make quicktest=1 kselftest" from top level Makefile

TARGETS_HOTPLUG = cpu-hotplug
TARGETS_HOTPLUG += memory-hotplug
Expand Down Expand Up @@ -133,4 +133,4 @@ clean:
make OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\
done;

.PHONY: install
.PHONY: all run_tests hotplug run_hotplug clean_hotplug run_pstore_crash install clean
2 changes: 1 addition & 1 deletion tools/testing/selftests/breakpoints/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
ifeq ($(ARCH),x86)
TEST_GEN_PROGS := breakpoint_test
endif
ifeq ($(ARCH),aarch64)
ifneq (,$(filter $(ARCH),aarch64 arm64))
TEST_GEN_PROGS := breakpoint_test_arm64
endif

Expand Down
15 changes: 15 additions & 0 deletions tools/testing/selftests/cpufreq/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_STAT=y
CONFIG_CPU_FREQ_GOV_POWERSAVE=y
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_PI_LIST=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 change: 1 addition & 0 deletions tools/testing/selftests/ftrace/config
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
CONFIG_KPROBES=y
CONFIG_FTRACE=y
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ check_types() {
test $X2 = $X3
test 0x$X3 = $3

B4=`printf "%x" $4`
B4=`printf "%02x" $4`
B3=`echo -n $X3 | tail -c 3 | head -c 2`
test $B3 = $B4
}
Expand Down
9 changes: 5 additions & 4 deletions tools/testing/selftests/futex/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ include ../lib.mk

all:
for DIR in $(SUBDIRS); do \
BUILD_TARGET=$$OUTPUT/$$DIR; \
BUILD_TARGET=$(OUTPUT)/$$DIR; \
mkdir $$BUILD_TARGET -p; \
make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\
done
Expand All @@ -22,7 +22,7 @@ override define INSTALL_RULE
install -t $(INSTALL_PATH) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES)

@for SUBDIR in $(SUBDIRS); do \
BUILD_TARGET=$$OUTPUT/$$SUBDIR; \
BUILD_TARGET=$(OUTPUT)/$$SUBDIR; \
mkdir $$BUILD_TARGET -p; \
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$SUBDIR INSTALL_PATH=$(INSTALL_PATH)/$$SUBDIR install; \
done;
Expand All @@ -32,9 +32,10 @@ override define EMIT_TESTS
echo "./run.sh"
endef

clean:
override define CLEAN
for DIR in $(SUBDIRS); do \
BUILD_TARGET=$$OUTPUT/$$DIR; \
BUILD_TARGET=$(OUTPUT)/$$DIR; \
mkdir $$BUILD_TARGET -p; \
make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\
done
endef
11 changes: 9 additions & 2 deletions tools/testing/selftests/gpio/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@
TEST_PROGS := gpio-mockup.sh
TEST_FILES := gpio-mockup-sysfs.sh $(BINARIES)
BINARIES := gpio-mockup-chardev
EXTRA_PROGS := ../gpiogpio-event-mon ../gpiogpio-hammer ../gpiolsgpio
EXTRA_DIRS := ../gpioinclude/
EXTRA_OBJS := ../gpiogpio-event-mon-in.o ../gpiogpio-event-mon.o
EXTRA_OBJS += ../gpiogpio-hammer-in.o ../gpiogpio-utils.o ../gpiolsgpio-in.o
EXTRA_OBJS += ../gpiolsgpio.o

include ../lib.mk

all: $(BINARIES)

clean:
$(RM) $(BINARIES)
override define CLEAN
$(RM) $(BINARIES) $(EXTRA_PROGS) $(EXTRA_OBJS)
$(RM) -r $(EXTRA_DIRS)
endef

CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/
LDLIBS += -lmount -I/usr/include/libmount
Expand Down
2 changes: 2 additions & 0 deletions tools/testing/selftests/gpio/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CONFIG_GPIOLIB=y
CONFIG_GPIO_MOCKUP=m
6 changes: 5 additions & 1 deletion tools/testing/selftests/lib.mk
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,12 @@ endef
emit_tests:
$(EMIT_TESTS)

clean:
define CLEAN
$(RM) -r $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) $(EXTRA_CLEAN)
endef

clean:
$(CLEAN)

$(OUTPUT)/%:%.c
$(LINK.c) $^ $(LDLIBS) -o $@
Expand Down
3 changes: 3 additions & 0 deletions tools/testing/selftests/lib/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CONFIG_TEST_PRINTF=m
CONFIG_TEST_BITMAP=m
CONFIG_PRIME_NUMBERS=m
3 changes: 2 additions & 1 deletion tools/testing/selftests/powerpc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,13 @@ override define EMIT_TESTS
done;
endef

clean:
override define CLEAN
@for TARGET in $(SUB_DIRS); do \
BUILD_TARGET=$(OUTPUT)/$$TARGET; \
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean; \
done;
rm -f tags
endef

tags:
find . -name '*.c' -o -name '*.h' | xargs ctags
Expand Down
3 changes: 1 addition & 2 deletions tools/testing/selftests/splice/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ all: $(TEST_PROGS) $(EXTRA)

include ../lib.mk

clean:
rm -fr $(TEST_PROGS) $(EXTRA)
EXTRA_CLEAN := $(EXTRA)
3 changes: 1 addition & 2 deletions tools/testing/selftests/sync/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ TESTS += sync_stress_merge.o

sync_test: $(OBJS) $(TESTS)

clean:
$(RM) sync_test $(OBJS) $(TESTS)
EXTRA_CLEAN := sync_test $(OBJS) $(TESTS)
2 changes: 1 addition & 1 deletion tools/testing/selftests/timers/clocksource-switch.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ int main(int argv, char **argc)
}


printf("Running Asyncrhonous Switching Tests...\n");
printf("Running Asynchronous Switching Tests...\n");
pid = fork();
if (!pid)
return run_tests(60);
Expand Down
1 change: 1 addition & 0 deletions tools/testing/selftests/vm/config
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
CONFIG_SYSVIPC=y
CONFIG_USERFAULTFD=y
2 changes: 1 addition & 1 deletion tools/testing/selftests/vm/map_hugetlb.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ int main(void)
void *addr;
int ret;

addr = mmap(ADDR, LENGTH, PROTECTION, FLAGS, 0, 0);
addr = mmap(ADDR, LENGTH, PROTECTION, FLAGS, -1, 0);
if (addr == MAP_FAILED) {
perror("mmap");
exit(1);
Expand Down
12 changes: 6 additions & 6 deletions tools/testing/selftests/vm/mlock2-tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ static int test_mlock_lock()
unsigned long page_size = getpagesize();

map = mmap(NULL, 2 * page_size, PROT_READ | PROT_WRITE,
MAP_ANONYMOUS | MAP_PRIVATE, 0, 0);
MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
if (map == MAP_FAILED) {
perror("test_mlock_locked mmap");
goto out;
Expand Down Expand Up @@ -402,7 +402,7 @@ static int test_mlock_onfault()
unsigned long page_size = getpagesize();

map = mmap(NULL, 2 * page_size, PROT_READ | PROT_WRITE,
MAP_ANONYMOUS | MAP_PRIVATE, 0, 0);
MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
if (map == MAP_FAILED) {
perror("test_mlock_locked mmap");
goto out;
Expand Down Expand Up @@ -445,7 +445,7 @@ static int test_lock_onfault_of_present()
uint64_t page1_flags, page2_flags;

map = mmap(NULL, 2 * page_size, PROT_READ | PROT_WRITE,
MAP_ANONYMOUS | MAP_PRIVATE, 0, 0);
MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
if (map == MAP_FAILED) {
perror("test_mlock_locked mmap");
goto out;
Expand Down Expand Up @@ -492,7 +492,7 @@ static int test_munlockall()
unsigned long page_size = getpagesize();

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

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

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

if (map == MAP_FAILED) {
perror("test_munlockall second mmap");
Expand Down Expand Up @@ -573,7 +573,7 @@ static int test_vma_management(bool call_mlock)
struct vm_boundaries page3;

map = mmap(NULL, 3 * page_size, PROT_READ | PROT_WRITE,
MAP_ANONYMOUS | MAP_PRIVATE, 0, 0);
MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
if (map == MAP_FAILED) {
perror("mmap()");
return ret;
Expand Down
2 changes: 1 addition & 1 deletion tools/testing/selftests/vm/on-fault-limit.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static int test_limit(void)
}

map = mmap(NULL, 2 * lims.rlim_max, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS | MAP_POPULATE, 0, 0);
MAP_PRIVATE | MAP_ANONYMOUS | MAP_POPULATE, -1, 0);
if (map != MAP_FAILED)
printf("mmap should have failed, but didn't\n");
else {
Expand Down
26 changes: 13 additions & 13 deletions tools/testing/selftests/vm/run_vmtests
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ fi
mkdir $mnt
mount -t hugetlbfs none $mnt

echo "--------------------"
echo "---------------------"
echo "running hugepage-mmap"
echo "--------------------"
echo "---------------------"
./hugepage-mmap
if [ $? -ne 0 ]; then
echo "[FAIL]"
Expand All @@ -77,9 +77,9 @@ fi
echo $shmmax > /proc/sys/kernel/shmmax
echo $shmall > /proc/sys/kernel/shmall

echo "--------------------"
echo "-------------------"
echo "running map_hugetlb"
echo "--------------------"
echo "-------------------"
./map_hugetlb
if [ $? -ne 0 ]; then
echo "[FAIL]"
Expand All @@ -92,9 +92,9 @@ echo "NOTE: The above hugetlb tests provide minimal coverage. Use"
echo " https://github.com/libhugetlbfs/libhugetlbfs.git for"
echo " hugetlb regression testing."

echo "--------------------"
echo "-------------------"
echo "running userfaultfd"
echo "--------------------"
echo "-------------------"
./userfaultfd anon 128 32
if [ $? -ne 0 ]; then
echo "[FAIL]"
Expand All @@ -103,10 +103,10 @@ else
echo "[PASS]"
fi

echo "----------------------------"
echo "---------------------------"
echo "running userfaultfd_hugetlb"
echo "----------------------------"
# 258MB total huge pages == 128MB src and 128MB dst
echo "---------------------------"
# 256MB total huge pages == 128MB src and 128MB dst
./userfaultfd hugetlb 128 32 $mnt/ufd_test_file
if [ $? -ne 0 ]; then
echo "[FAIL]"
Expand All @@ -116,9 +116,9 @@ else
fi
rm -f $mnt/ufd_test_file

echo "----------------------------"
echo "-------------------------"
echo "running userfaultfd_shmem"
echo "----------------------------"
echo "-------------------------"
./userfaultfd shmem 128 32
if [ $? -ne 0 ]; then
echo "[FAIL]"
Expand All @@ -143,9 +143,9 @@ else
echo "[PASS]"
fi

echo "--------------------"
echo "----------------------"
echo "running on-fault-limit"
echo "--------------------"
echo "----------------------"
sudo -u nobody ./on-fault-limit
if [ $? -ne 0 ]; then
echo "[FAIL]"
Expand Down
2 changes: 1 addition & 1 deletion tools/testing/selftests/vm/thuge-gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ void test_mmap(unsigned long size, unsigned flags)

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

if (map == (char *)-1) err("mmap");
memset(map, 0xff, size*NUM_PAGES);
Expand Down
Loading

0 comments on commit 2868b25

Please sign in to comment.