Skip to contentSkip to conversation

Two minor testsuite fixes

PATCH Superseded Phil Sutter 2 participants 5 messages Feb 7, 2017

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Two minor testsuite fixes

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

Phil Sutter (2):
testsuite: skip link show test on big endian systems
testsuite: Search kernel config in modules dir also

 .gitignore                                    | 1 +
 testsuite/Makefile                            | 7 +++++++
 testsuite/tests/ip/link/show_dev_wo_vf_rate.t | 5 +++++
 testsuite/tools/Makefile                      | 2 ++
 testsuite/tools/is_big_endian.c               | 7 +++++++
 5 files changed, 22 insertions(+)
 create mode 100644 testsuite/tools/Makefile
 create mode 100644 testsuite/tools/is_big_endian.c
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/2 testsuite: skip link show test on big endian systems

Netlink protocol is in host byte order, so the provided binary netlink message buffer being in little endian format will cause the test to fail on big endian systems.

---
 .gitignore                                    | 1 +
 testsuite/Makefile                            | 1 +
 testsuite/tests/ip/link/show_dev_wo_vf_rate.t | 5 +++++
 testsuite/tools/Makefile                      | 2 ++
 testsuite/tools/is_big_endian.c               | 7 +++++++
 5 files changed, 16 insertions(+)
 create mode 100644 testsuite/tools/Makefile
 create mode 100644 testsuite/tools/is_big_endian.c
.gitignore +1 -0
index 74a5496ddf7aa..a1f295dac3dd2 100644
@@ -36,6 +36,7 @@ series
 # tests
 testsuite/results
 testsuite/iproute2/iproute2-this
+testsuite/tools/is_big_endian
 
 # doc files generated at runtime
 doc/*.aux
testsuite/Makefile +1 -0
index 2027650051d48..17568881b8b66 100644
@@ -24,6 +24,7 @@ configure:
 
 compile: configure
 	echo "Entering iproute2" && cd iproute2 && $(MAKE) && cd ..;
+	echo "Entering tools" && cd tools && $(MAKE) && cd ..;
 
 listtests:
 	@for t in $(TESTS); do \
testsuite/tests/ip/link/show_dev_wo_vf_rate.t +5 -0
index a600ba65c5bec..ad90af5400271 100755
@@ -2,5 +2,10 @@
 
 source lib/generic.sh
 
+if ./tools/is_big_endian; then
+	ts_log "won't work on big endian system"
+	ts_skip
+fi
+
 NL_FILE="tests/ip/link/dev_wo_vf_rate.nl"
 ts_ip "$0" "Show VF devices w/o VF rate info" -d monitor file $NL_FILE
testsuite/tools/Makefile new file +2 -0
new file mode 100644
index 0000000000000..ecbea16c2c1cc
@@ -0,0 +1,2 @@
+is_big_endian: is_big_endian.c
+	$(CC) -o $@ $<
testsuite/tools/is_big_endian.c new file +7 -0
new file mode 100644
index 0000000000000..303e91b4603e8
@@ -0,0 +1,7 @@
+//#include <stdio.h>
+#include <arpa/inet.h>
+
+int main(void)
+{
+	return 1 != ntohs(1);
+}
Signature · 1 line
2.11.0
#4 lore raw

PATCH 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 17568881b8b66..41a3afc92ae98 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
#2 lore raw

Re: [iproute PATCH 1/2] testsuite: skip link show test on big endian systems

In reply to Phil Sutter
Quoted 5 lines · On Wed, 8 Feb 2017 00:04:21 +0100 Phil Sutter <[email protected]> wrote:

Netlink protocol is in host byte order, so the provided binary netlink message buffer being in little endian format will cause the test to fail on big endian systems.

Maybe better to figure out how to generate the files in host order?

#3 lore raw

Re: [iproute PATCH 1/2] testsuite: skip link show test on big endian systems

Quoted 10 lines · Stephen Hemminger
Quoted 5 lines · On Wed, 8 Feb 2017 00:04:21 +0100 Phil Sutter <[email protected]> wrote:

Netlink protocol is in host byte order, so the provided binary netlink message buffer being in little endian format will cause the test to fail on big endian systems.

Maybe better to figure out how to generate the files in host order?

Yes, I had thought about that as well. Not sure whether it's worth the effort though to write a program which constructs the messages and dumps them into a file for 'ip monitor' to read. I think there's a certain chance this will eventually test the message builder instead of iproute. :)

Cheers, Phil