kernel-ark/tools/testing/selftests
Daniel Borkmann 23a9544206 selftests: net: add PF_PACKET TPACKET v1/v2/v3 selftests
This patch adds a simple test case that probes the packet socket's
TPACKET_V1, TPACKET_V2 and TPACKET_V3 behavior regarding mmap(2)'ed
I/O for a small burst of 100 packets. The test currently runs for ...

  TPACKET_V1: RX_RING, TX_RING
  TPACKET_V2: RX_RING, TX_RING
  TPACKET_V3: RX_RING

... and will output on success:

  test: TPACKET_V1 with PACKET_RX_RING .................... 100 pkts (9600 bytes)
  test: TPACKET_V1 with PACKET_TX_RING .................... 100 pkts (9600 bytes)
  test: TPACKET_V2 with PACKET_RX_RING .................... 100 pkts (9600 bytes)
  test: TPACKET_V2 with PACKET_TX_RING .................... 100 pkts (9600 bytes)
  test: TPACKET_V3 with PACKET_RX_RING .................... 100 pkts (9600 bytes)
  OK. All tests passed

Reusable parts of psock_fanout.c have been put into a psock_lib.h
file for common usage. Test case successfully tested on x86_64.

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2013-04-07 17:02:24 -04:00
..
breakpoints breakpoint selftests: print failure status instead of cause make error 2012-12-17 17:15:27 -08:00
cpu-hotplug cpu-hotplug selftests: print failure status instead of cause make error 2012-12-17 17:15:27 -08:00
efivarfs efivars: efivarfs_valid_name() should handle pstore syntax 2013-03-06 14:46:04 +00:00
ipc selftests: IPC message queue copy feature test 2013-01-04 16:11:45 -08:00
kcmp tools/testing/selftests/kcmp/kcmp_test.c: print reason for failure in kcmp_test 2012-12-17 17:15:27 -08:00
memory-hotplug mem-hotplug selftests: print failure status instead of cause make error 2012-12-17 17:15:27 -08:00
mqueue mqueue selftests: print failure status instead of cause make error 2012-12-17 17:15:26 -08:00
net selftests: net: add PF_PACKET TPACKET v1/v2/v3 selftests 2013-04-07 17:02:24 -04:00
vm vm selftests: print failure status instead of cause make error 2012-12-17 17:15:26 -08:00
Makefile net: Move selftests to common net/ subdirectory. 2013-03-20 15:07:56 -04:00
README.txt selftests: add a simple doc 2013-02-27 19:10:24 -08:00

Linux Kernel Selftests

The kernel contains a set of "self tests" under the tools/testing/selftests/
directory. These are intended to be small unit tests to exercise individual
code paths in the kernel.

Running the selftests
=====================

To build the tests:

  $ make -C tools/testing/selftests


To run the tests:

  $ make -C tools/testing/selftests run_tests

- note that some tests will require root privileges.


To run only tests targetted for a single subsystem:

  $  make -C tools/testing/selftests TARGETS=cpu-hotplug run_tests

See the top-level tools/testing/selftests/Makefile for the list of all possible
targets.


Contributing new tests
======================

In general, the rules for for selftests are

 * Do as much as you can if you're not root;

 * Don't take too long;

 * Don't break the build on any architecture, and

 * Don't cause the top-level "make run_tests" to fail if your feature is
   unconfigured.