One of the nice things about network namespaces is that they allow one
to easily create and test complex environments.
Unfortunately, these namespaces can not be used with actual switching
ASICs, as their ports can not be migrated to other network namespaces
(NETIF_F_NETNS_LOCAL) and most of them probably do not support the
L1-separation provided by namespaces.
However, a similar kind of flexibility can be achieved by using VRFs and
by looping the switch ports together. For example:
br0
+
vrf-h1 | vrf-h2
+ +---+----+ +
| | | |
192.0.2.1/24 + + + + 192.0.2.2/24
swp1 swp2 swp3 swp4
+ + + +
| | | |
+--------+ +--------+
The VRFs act as lightweight namespaces representing hosts connected to
the switch.
This approach for testing switch ASICs has several advantages over the
traditional method that requires multiple physical machines, to name a
few:
1. Only the device under test (DUT) is being tested without noise from
other system.
2. Ability to easily provision complex topologies. Testing bridging
between 4-ports LAGs or 8-way ECMP requires many physical links that are
not always available. With the VRF-based approach one merely needs to
loopback more ports.
These tests are written with switch ASICs in mind, but they can be run
on any Linux box using veth pairs to emulate physical loopbacks.
Changes since RFC:
* Change location to net/forwarding instead of forwarding/
* Add ability to pause on failure
* Add ability to pause on cleanup
* Make configuration file optional
* Make ping/ping6/mz configurable
* Add more tc tests
Ido Schimmel (7):
selftests: forwarding: Add initial testing framework
selftests: forwarding: Add a test for FDB learning
selftests: forwarding: Add a test for flooded traffic
selftests: forwarding: Add a test for basic IPv4 and IPv6 routing
selftests: forwarding: Create test topology for multipath routing
selftests: forwarding: Test IPv4 weighted nexthops
selftests: forwarding: Test IPv6 weighted nexthops
Jiri Pirko (7):
selftests: forwarding: Add tc offload check helper
selftests: forwarding: Add MAC get helper
selftests: forwarding: Allow to get netdev interfaces names from
commandline
selftests: forwarding: Introduce tc flower matching tests
selftests: forwarding: Introduce tc actions tests
selftests: forwarding: Introduce basic tc chains tests
selftests: forwarding: Introduce basic shared blocks tests
tools/testing/selftests/net/forwarding/.gitignore | 1 +
tools/testing/selftests/net/forwarding/README | 56 +++
.../selftests/net/forwarding/bridge_vlan_aware.sh | 87 ++++
tools/testing/selftests/net/forwarding/config | 12 +
.../net/forwarding/forwarding.config.sample | 31 ++
tools/testing/selftests/net/forwarding/lib.sh | 533 +++++++++++++++++++++
tools/testing/selftests/net/forwarding/router.sh | 125 +++++
.../selftests/net/forwarding/router_multipath.sh | 317 ++++++++++++
.../testing/selftests/net/forwarding/tc_actions.sh | 195 ++++++++
.../testing/selftests/net/forwarding/tc_chains.sh | 122 +++++
.../testing/selftests/net/forwarding/tc_common.sh | 23 +
.../testing/selftests/net/forwarding/tc_flower.sh | 196 ++++++++
.../selftests/net/forwarding/tc_shblocks.sh | 122 +++++
13 files changed, 1820 insertions(+)
create mode 100644 tools/testing/selftests/net/forwarding/.gitignore
create mode 100644 tools/testing/selftests/net/forwarding/README
create mode 100755 tools/testing/selftests/net/forwarding/bridge_vlan_aware.sh
create mode 100644 tools/testing/selftests/net/forwarding/config
create mode 100644 tools/testing/selftests/net/forwarding/forwarding.config.sample
create mode 100644 tools/testing/selftests/net/forwarding/lib.sh
create mode 100755 tools/testing/selftests/net/forwarding/router.sh
create mode 100755 tools/testing/selftests/net/forwarding/router_multipath.sh
create mode 100755 tools/testing/selftests/net/forwarding/tc_actions.sh
create mode 100755 tools/testing/selftests/net/forwarding/tc_chains.sh
create mode 100644 tools/testing/selftests/net/forwarding/tc_common.sh
create mode 100755 tools/testing/selftests/net/forwarding/tc_flower.sh
create mode 100755 tools/testing/selftests/net/forwarding/tc_shblocks.sh
--
2.14.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Li Zhijian <zhijianx.li(a)intel.com>
test_maps contains a series of stress tests, and previously it will break the
rest tests when it failed to alloc memory.
-----------------------
Failed to create hashmap key=8 value=262144 'Cannot allocate memory'
Failed to create hashmap key=16 value=262144 'Cannot allocate memory'
Failed to create hashmap key=8 value=262144 'Cannot allocate memory'
Failed to create hashmap key=8 value=262144 'Cannot allocate memory'
test_maps: test_maps.c:955: run_parallel: Assertion `status == 0' failed.
Aborted
not ok 1..3 selftests: test_maps [FAIL]
-----------------------
after this patch, the rest tests will be continue when it occurs an ENOMEM failure
CC: Alexei Starovoitov <alexei.starovoitov(a)gmail.com>
CC: Philip Li <philip.li(a)intel.com>
Suggested-by: Daniel Borkmann <daniel(a)iogearbox.net>
Signed-off-by: Li Zhijian <zhijianx.li(a)intel.com>
---
tools/testing/selftests/bpf/test_maps.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/testing/selftests/bpf/test_maps.c b/tools/testing/selftests/bpf/test_maps.c
index 436c4c7..9e03a4c 100644
--- a/tools/testing/selftests/bpf/test_maps.c
+++ b/tools/testing/selftests/bpf/test_maps.c
@@ -126,6 +126,8 @@ static void test_hashmap_sizes(int task, void *data)
fd = bpf_create_map(BPF_MAP_TYPE_HASH, i, j,
2, map_flags);
if (fd < 0) {
+ if (errno == ENOMEM)
+ return;
printf("Failed to create hashmap key=%d value=%d '%s'\n",
i, j, strerror(errno));
exit(1);
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Simply use the first argument to specify the subset of selftests.
Use comma notation to separate multiple tests.
(e.g. ./run_kselftest.sh size,timers,...)
Default behaviour is running all selftests.
Each selftest be defined as function that we can run one of selftests.
The function name has underline as prefix to avoid confilct with
built-in command of shell.
(e.g. The exec is built-in command of shell)
The hyhpen of function name be replace to the underline because
not all shells can use hyphen in function name, like sh, ash and so on.
Signed-off-by: Zong Li <zong(a)andestech.com>
Cc: Greentime Hu <greentime(a)andestech.com>
Cc: Shuah Khan <shuah(a)kernel.org>
---
tools/testing/selftests/Makefile | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index 7442dfb73b7f..08e2a855f187 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -128,13 +128,22 @@ ifdef INSTALL_PATH
for TARGET in $(TARGETS); do \
BUILD_TARGET=$$BUILD/$$TARGET; \
+ echo "_$${TARGET//-/_}()" >> $(ALL_SCRIPT); \
+ echo "{" >> $(ALL_SCRIPT); \
echo "echo ; echo Running tests in $$TARGET" >> $(ALL_SCRIPT); \
echo "echo ========================================" >> $(ALL_SCRIPT); \
echo "cd $$TARGET" >> $(ALL_SCRIPT); \
make -s --no-print-directory OUTPUT=$$BUILD_TARGET -C $$TARGET emit_tests >> $(ALL_SCRIPT); \
echo "cd \$$ROOT" >> $(ALL_SCRIPT); \
+ echo "}" >> $(ALL_SCRIPT); \
+ echo "" >> $(ALL_SCRIPT); \
done;
+ echo "TARGETS=\$${1:-\`ls -d */ | sed 's#/##' \`}" >> $(ALL_SCRIPT);
+ echo "for TARGET in \$${TARGETS//,/ }; do" >> $(ALL_SCRIPT);
+ echo " _\$${TARGET//-/_}" >> $(ALL_SCRIPT);
+ echo "done" >> $(ALL_SCRIPT);
+
chmod u+x $(ALL_SCRIPT)
else
$(error Error: set INSTALL_PATH to use install)
--
2.16.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
bpf builds a test program for loading BPF ELF files. Add the executable
to the .gitignore list.
Signed-off-by: Anders Roxell <anders.roxell(a)linaro.org>
---
tools/testing/selftests/bpf/.gitignore | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/testing/selftests/bpf/.gitignore b/tools/testing/selftests/bpf/.gitignore
index cc15af2e54fe..9cf83f895d98 100644
--- a/tools/testing/selftests/bpf/.gitignore
+++ b/tools/testing/selftests/bpf/.gitignore
@@ -11,3 +11,4 @@ test_progs
test_tcpbpf_user
test_verifier_log
feature
+test_libbpf_open
--
2.11.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Both glibc and the kernel have in6_* macros definitions. Build fails
because it picks up wrong in6_* macro from the kernel header and not the
header from glibc.
Fixes build error below:
clang -I. -I./include/uapi -I../../../include/uapi
-Wno-compare-distinct-pointer-types \
-O2 -target bpf -emit-llvm -c test_tcpbpf_kern.c -o - | \
llc -march=bpf -mcpu=generic -filetype=obj
-o .../tools/testing/selftests/bpf/test_tcpbpf_kern.o
In file included from test_tcpbpf_kern.c:12:
.../netinet/in.h:101:5: error: expected identifier
IPPROTO_HOPOPTS = 0, /* IPv6 Hop-by-Hop options. */
^
.../linux/in6.h:131:26: note: expanded from macro 'IPPROTO_HOPOPTS'
^
In file included from test_tcpbpf_kern.c:12:
/usr/include/netinet/in.h:103:5: error: expected identifier
IPPROTO_ROUTING = 43, /* IPv6 routing header. */
^
.../linux/in6.h:132:26: note: expanded from macro 'IPPROTO_ROUTING'
^
In file included from test_tcpbpf_kern.c:12:
.../netinet/in.h:105:5: error: expected identifier
IPPROTO_FRAGMENT = 44, /* IPv6 fragmentation header. */
^
Since both glibc and the kernel have in6_* macros definitions, use the
one from glibc. Kernel headers will check for previous libc definitions
by including include/linux/libc-compat.h.
Reported-by: Daniel Díaz <daniel.diaz(a)linaro.org>
Signed-off-by: Anders Roxell <anders.roxell(a)linaro.org>
---
tools/testing/selftests/bpf/test_tcpbpf_kern.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/test_tcpbpf_kern.c b/tools/testing/selftests/bpf/test_tcpbpf_kern.c
index 57119ad57a3f..3e645ee41ed5 100644
--- a/tools/testing/selftests/bpf/test_tcpbpf_kern.c
+++ b/tools/testing/selftests/bpf/test_tcpbpf_kern.c
@@ -5,7 +5,6 @@
#include <linux/if_ether.h>
#include <linux/if_packet.h>
#include <linux/ip.h>
-#include <linux/in6.h>
#include <linux/types.h>
#include <linux/socket.h>
#include <linux/tcp.h>
--
2.11.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi,
This is v2 of the series to add a unit test to Ion with VGEM. From v1:
Ion hasn't had much in the way of unit tests and fixing that is
something that needs to happen before it can move out of staging. The
difficult part of testing parts of Ion is that it relies on having a
kernel driver to actually make some of the dma_buf calls. The vgem
DRM driver exists mostly for testing and works great for this case.
Changes since v1:
- Dropped RFC
- Feedback/review from Daniel Vetter about DRM ioctls
Thanks,
Laura
Laura Abbott (2):
selftests: ion: Remove some prints
selftests: ion: Add simple test with the vgem driver
tools/testing/selftests/android/ion/Makefile | 3 +-
tools/testing/selftests/android/ion/config | 1 +
tools/testing/selftests/android/ion/ionmap_test.c | 149 ++++++++++++++++++++++
tools/testing/selftests/android/ion/ionutils.c | 6 -
4 files changed, 152 insertions(+), 7 deletions(-)
create mode 100644 tools/testing/selftests/android/ion/ionmap_test.c
--
2.14.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Ensure that ARCH is defined and that this only builds for
x86 architectures.
It is possible to build from the root of the Linux tree, which
will define ARCH, or to run make from the selftests/ directory
itself, which has no provision for defining ARCH, so this
change is to use the current definition (if any), or to check
uname -m if undefined.
Signed-off-by: Daniel Díaz <daniel.diaz(a)linaro.org>
---
tools/testing/selftests/intel_pstate/Makefile | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/intel_pstate/Makefile b/tools/testing/selftests/intel_pstate/Makefile
index 5a3f7d37..7340fd6 100644
--- a/tools/testing/selftests/intel_pstate/Makefile
+++ b/tools/testing/selftests/intel_pstate/Makefile
@@ -2,7 +2,10 @@
CFLAGS := $(CFLAGS) -Wall -D_GNU_SOURCE
LDLIBS := $(LDLIBS) -lm
-ifeq (,$(filter $(ARCH),x86))
+uname_M := $(shell uname -m 2>/dev/null || echo not)
+ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
+
+ifeq (x86,$(ARCH))
TEST_GEN_FILES := msr aperf
endif
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html