Skip to content

Commit

Permalink
Merge tag 'linux-kselftest-4.2-rc1' of git://git.kernel.org/pub/scm/l…
Browse files Browse the repository at this point in the history
…inux/kernel/git/shuah/linux-kselftest

Pull kselftest update from Shuah Khan:
 "This update adds two new test suites: futex and seccomp.

  In addition, it includes fixes for bugs in timers, other tests, and
  compile framework.  It introduces new quicktest feature to enable
  users to choose to run tests that complete in a short time"

* tag 'linux-kselftest-4.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
  selftests: add quicktest support
  selftests: add seccomp suite
  selftest, x86: fix incorrect comment
  tools selftests: Fix 'clean' target with make 3.81
  selftests/futex: Add .gitignore
  kselftest: Add exit code defines
  selftests: Add futex tests to the top-level Makefile
  selftests/futex: Increment ksft pass and fail counters
  selftests/futex: Update Makefile to use lib.mk
  selftests: Add futex functional tests
  kselftests: timers: Check _ALARM clockids are supported before suspending
  kselftests: timers: Ease alarmtimer-suspend unreasonable latency value
  kselftests: timers: Increase delay between suspends in alarmtimer-suspend
  selftests/exec: do not install subdir as it is already created
  selftests/ftrace: install test.d
  selftests: copy TEST_DIRS to INSTALL_PATH
  Test compaction of mlocked memory
  selftests/mount: output WARN messages when mount test skipped
  selftests/timers: Make git ignore all binaries in timers test suite
  • Loading branch information
torvalds committed Jun 29, 2015
2 parents c63f887 + 2278e5e commit d93a74a
Show file tree
Hide file tree
Showing 33 changed files with 4,875 additions and 13 deletions.
1 change: 1 addition & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -8986,6 +8986,7 @@ S: Supported
F: kernel/seccomp.c
F: include/uapi/linux/seccomp.h
F: include/linux/seccomp.h
F: tools/testing/selftests/seccomp/*
K: \bsecure_computing
K: \bTIF_SECCOMP\b

Expand Down
8 changes: 7 additions & 1 deletion tools/testing/selftests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ TARGETS += efivarfs
TARGETS += exec
TARGETS += firmware
TARGETS += ftrace
TARGETS += futex
TARGETS += kcmp
TARGETS += memfd
TARGETS += memory-hotplug
Expand All @@ -12,13 +13,18 @@ TARGETS += mqueue
TARGETS += net
TARGETS += powerpc
TARGETS += ptrace
TARGETS += seccomp
TARGETS += size
TARGETS += sysctl
ifneq (1, $(quicktest))
TARGETS += timers
endif
TARGETS += user
TARGETS += vm
TARGETS += x86
#Please keep the TARGETS list alphabetically sorted
# Run "make quicktest=1 run_tests" or
# "make quicktest=1 kselftest from top level Makefile

TARGETS_HOTPLUG = cpu-hotplug
TARGETS_HOTPLUG += memory-hotplug
Expand All @@ -27,7 +33,7 @@ TARGETS_HOTPLUG += memory-hotplug
# Makefile to avoid test build failures when test
# Makefile doesn't have explicit build rules.
ifeq (1,$(MAKELEVEL))
undefine LDFLAGS
override LDFLAGS =
override MAKEFLAGS =
endif

Expand Down
2 changes: 1 addition & 1 deletion tools/testing/selftests/exec/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CFLAGS = -Wall
BINARIES = execveat
DEPS = execveat.symlink execveat.denatured script subdir
DEPS = execveat.symlink execveat.denatured script
all: $(BINARIES) $(DEPS)

subdir:
Expand Down
1 change: 1 addition & 0 deletions tools/testing/selftests/ftrace/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
all:

TEST_PROGS := ftracetest
TEST_DIRS := test.d/

include ../lib.mk

Expand Down
29 changes: 29 additions & 0 deletions tools/testing/selftests/futex/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
SUBDIRS := functional

TEST_PROGS := run.sh

.PHONY: all clean
all:
for DIR in $(SUBDIRS); do $(MAKE) -C $$DIR $@ ; done

include ../lib.mk

override define RUN_TESTS
./run.sh
endef

override define INSTALL_RULE
mkdir -p $(INSTALL_PATH)
install -t $(INSTALL_PATH) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES)

@for SUBDIR in $(SUBDIRS); do \
$(MAKE) -C $$SUBDIR INSTALL_PATH=$(INSTALL_PATH)/$$SUBDIR install; \
done;
endef

override define EMIT_TESTS
echo "./run.sh"
endef

clean:
for DIR in $(SUBDIRS); do $(MAKE) -C $$DIR $@ ; done
62 changes: 62 additions & 0 deletions tools/testing/selftests/futex/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
Futex Test
==========
Futex Test is intended to thoroughly test the Linux kernel futex system call
API.

Functional tests shall test the documented behavior of the futex operation
code under test. This includes checking for proper behavior under normal use,
odd corner cases, regression tests, and abject abuse and misuse.

Futextest will also provide example implementation of mutual exclusion
primitives. These can be used as is in user applications or can serve as
examples for system libraries. These will likely be added to either a new lib/
directory or purely as header files under include/, I'm leaning toward the
latter.

Quick Start
-----------
# make
# ./run.sh

Design and Implementation Goals
-------------------------------
o Tests should be as self contained as is practical so as to facilitate sharing
the individual tests on mailing list discussions and bug reports.
o The build system shall remain as simple as possible, avoiding any archive or
shared object building and linking.
o Where possible, any helper functions or other package-wide code shall be
implemented in header files, avoiding the need to compile intermediate object
files.
o External dependendencies shall remain as minimal as possible. Currently gcc
and glibc are the only dependencies.
o Tests return 0 for success and < 0 for failure.

Output Formatting
-----------------
Test output shall be easily parsable by both human and machine. Title and
results are printed to stdout, while intermediate ERROR or FAIL messages are
sent to stderr. Tests shall support the -c option to print PASS, FAIL, and
ERROR strings in color for easy visual parsing. Output shall conform to the
following format:

test_name: Description of the test
Arguments: arg1=val1 #units specified for clarity where appropriate
ERROR: Description of unexpected error
FAIL: Reason for test failure
# FIXME: Perhaps an " INFO: informational message" option would be
# useful here. Using -v to toggle it them on and off, as with -c.
# there may be multiple ERROR or FAIL messages
Result: (PASS|FAIL|ERROR)

Naming
------
o FIXME: decide on a sane test naming scheme. Currently the tests are named
based on the primary futex operation they test. Eventually this will become a
problem as we intend to write multiple tests which collide in this namespace.
Perhaps something like "wait-wake-1" "wait-wake-2" is adequate, leaving the
detailed description in the test source and the output.

Coding Style
------------
o The Futex Test project adheres to the coding standards set forth by Linux
kernel as defined in the Linux source Documentation/CodingStyle.
7 changes: 7 additions & 0 deletions tools/testing/selftests/futex/functional/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
futex_requeue_pi
futex_requeue_pi_mismatched_ops
futex_requeue_pi_signal_restart
futex_wait_private_mapped_file
futex_wait_timeout
futex_wait_uninitialized_heap
futex_wait_wouldblock
25 changes: 25 additions & 0 deletions tools/testing/selftests/futex/functional/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
INCLUDES := -I../include -I../../
CFLAGS := $(CFLAGS) -g -O2 -Wall -D_GNU_SOURCE -pthread $(INCLUDES)
LDFLAGS := $(LDFLAGS) -pthread -lrt

HEADERS := ../include/futextest.h
TARGETS := \
futex_wait_timeout \
futex_wait_wouldblock \
futex_requeue_pi \
futex_requeue_pi_signal_restart \
futex_requeue_pi_mismatched_ops \
futex_wait_uninitialized_heap \
futex_wait_private_mapped_file

TEST_PROGS := $(TARGETS) run.sh

.PHONY: all clean
all: $(TARGETS)

$(TARGETS): $(HEADERS)

include ../../lib.mk

clean:
rm -f $(TARGETS)
Loading

0 comments on commit d93a74a

Please sign in to comment.