Skip to contentSkip to conversation

Two minor testsuite fixes

PATCH In review Phil Sutter 2 participants 4 messages Feb 9, 2017 – Feb 10, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover Two minor testsuite fixes

While playing around with testsuite, I noticed two minor nits which this series attempts to fix.

Changes since v1:
- Replaced patch1 completely.

Phil Sutter (2):
testsuite: Generate nlmsg blob at runtime
testsuite: Search kernel config in modules dir also

 .gitignore                                |   2 +
 testsuite/Makefile                        |   8 +++
 testsuite/tests/ip/link/dev_wo_vf_rate.nl | Bin 14076 -> 0 bytes
 testsuite/tools/Makefile                  |   2 +
 testsuite/tools/generate_nlmsg.c          | 116 ++++++++++++++++++++++++++++++
 5 files changed, 128 insertions(+)
 delete mode 100644 testsuite/tests/ip/link/dev_wo_vf_rate.nl
 create mode 100644 testsuite/tools/Makefile
 create mode 100644 testsuite/tools/generate_nlmsg.c
Signature · 1 line
2.11.0
#1 lore raw

PATCH v2 1/2 testsuite: Generate nlmsg blob at runtime

Since netlink messages are in host byte order, shipping a pre-generated nlmsg blob won't suffice on systems with different endianness. Therefore generate the blob at runtime, so it's content fits the hosts endianness.

Note that the generated message will contain only a single interface featuring two VFs instead of the full list before. Yet this is sufficient, as it triggers the crash with iproute versions prior to commit 8c29ae7cc2494 ("ip link: Fix crash on older kernels when show VF dev").

---
Changes since v1:
- Dropped the previous workaround altogether.
- Instead implemented this simple nlmsg generator.

---
 .gitignore                                |   2 +
 testsuite/Makefile                        |   2 +
 testsuite/tests/ip/link/dev_wo_vf_rate.nl | Bin 14076 -> 0 bytes
 testsuite/tools/Makefile                  |   2 +
 testsuite/tools/generate_nlmsg.c          | 116 ++++++++++++++++++++++++++++++
 5 files changed, 122 insertions(+)
 delete mode 100644 testsuite/tests/ip/link/dev_wo_vf_rate.nl
 create mode 100644 testsuite/tools/Makefile
 create mode 100644 testsuite/tools/generate_nlmsg.c
.gitignore +2 -0
index 74a5496ddf7aa..c3b8d386450bf 100644
@@ -36,6 +36,8 @@ series
 # tests
 testsuite/results
 testsuite/iproute2/iproute2-this
+testsuite/tools/generate_nlmsg
+testsuite/tests/ip/link/dev_wo_vf_rate.nl
 
 # doc files generated at runtime
 doc/*.aux
testsuite/Makefile +2 -0
index 2027650051d48..fa7ddb8620754 100644
@@ -43,6 +43,8 @@ $(TESTS): clean
 ifeq (,$(HAVE_UNSHARED_UTIL))
 	$(error Please install util-linux tools to run tests in separated network namespace)
 endif
+	@./tools/generate_nlmsg
+
 	@mkdir -p $(RESULTS_DIR)
 	
 	@for d in $(TESTS_DIR); do \
testsuite/tests/ip/link/dev_wo_vf_rate.nl deleted binary +0 -0
deleted file mode 100644
index 40fa87ff1b158fb972e064efb38f76b0e9a56697..0000000000000000000000000000000000000000
GIT binary patch
testsuite/tools/Makefile new file +2 -0
new file mode 100644
index 0000000000000..9581de51fd358
@@ -0,0 +1,2 @@
+generate_nlmsg: generate_nlmsg.c ../../lib/libnetlink.c
+	$(CC) -o $@ $^
testsuite/tools/generate_nlmsg.c new file +116 -0

116 lines not on this page · raw message

Signature · 1 line
2.11.0
#2 lore raw

PATCH v2 2/2 testsuite: Search kernel config in modules dir also

In reply to Phil Sutter

At least in Fedora there is no /proc/config.gz but instead /lib/modules/uname -r/config, so use that as a fallback.

---
 testsuite/Makefile | 6 ++++++
 1 file changed, 6 insertions(+)
testsuite/Makefile +6 -0
index fa7ddb8620754..50a7bafaca897 100644
@@ -15,6 +15,12 @@ IPVERS := $(filter-out iproute2/Makefile,$(wildcard iproute2/*))
 
 ifneq (,$(wildcard /proc/config.gz))
 	KENV := $(shell cat /proc/config.gz | gunzip | grep ^CONFIG)
+else
+KVER := $(shell uname -r)
+KCPATH := /lib/modules/${KVER}/config
+ifneq (,$(wildcard ${KCPATH}))
+	KENV := $(shell cat ${KCPATH} | grep ^CONFIG)
+endif
 endif
 
 .PHONY: compile listtests alltests configure $(TESTS)
Signature · 1 line
2.11.0
#3 lore raw
In reply to Phil Sutter
Quoted 10 lines · On Thu, 9 Feb 2017 11:50:53 +0100 Phil Sutter <[email protected]> wrote:

While playing around with testsuite, I noticed two minor nits which this series attempts to fix.

Changes since v1:
- Replaced patch1 completely.

Phil Sutter (2):
testsuite: Generate nlmsg blob at runtime
testsuite: Search kernel config in modules dir also

Quoted 10 lines
 .gitignore                                |   2 +
 testsuite/Makefile                        |   8 +++
 testsuite/tests/ip/link/dev_wo_vf_rate.nl | Bin 14076 -> 0 bytes
 testsuite/tools/Makefile                  |   2 +
 testsuite/tools/generate_nlmsg.c          | 116 ++++++++++++++++++++++++++++++
 5 files changed, 128 insertions(+)
 delete mode 100644 testsuite/tests/ip/link/dev_wo_vf_rate.nl
 create mode 100644 testsuite/tools/Makefile
 create mode 100644 testsuite/tools/generate_nlmsg.c

Nice. Applied.
I suspect the tests are rarely run because the core functionality doesn't change often. But in new environments these would be really useful.