Skip to contentSkip to conversation

selftest: add a reuseaddr test

PATCH In review [email protected] 3 participants 7 messages Sep 19, 2017 – Oct 16, 2017

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

PATCH v2 1/3 selftest: add a reuseaddr test

From: Josef Bacik <[email protected]>

This is to test for a regression introduced by

b9470c27607b ("inet: kill smallest_size and smallest_port")

which introduced a problem with reuseaddr and bind conflicts.

---
 tools/testing/selftests/net/.gitignore           |   1 +
 tools/testing/selftests/net/Makefile             |   2 +-
 tools/testing/selftests/net/reuseaddr_conflict.c | 114 +++++++++++++++++++++++
 3 files changed, 116 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/net/reuseaddr_conflict.c
tools/testing/selftests/net/.gitignore +1 -0
index 9801253e4802..c612d6e38c62 100644
@@ -6,3 +6,4 @@ reuseport_bpf
 reuseport_bpf_cpu
 reuseport_bpf_numa
 reuseport_dualstack
+reuseaddr_conflict
tools/testing/selftests/net/Makefile +1 -1
index de1f5772b878..3df542c84610 100644
@@ -7,7 +7,7 @@ TEST_PROGS := run_netsocktests run_afpackettests test_bpf.sh netdevice.sh rtnetl
 TEST_GEN_FILES =  socket
 TEST_GEN_FILES += psock_fanout psock_tpacket
 TEST_GEN_FILES += reuseport_bpf reuseport_bpf_cpu reuseport_bpf_numa
-TEST_GEN_FILES += reuseport_dualstack msg_zerocopy
+TEST_GEN_FILES += reuseport_dualstack msg_zerocopy reuseaddr_conflict
 
 include ../lib.mk
 
tools/testing/selftests/net/reuseaddr_conflict.c new file +114 -0

114 lines not on this page · raw message

Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 2/3 selftests: actually run the various net selftests

From: Josef Bacik <[email protected]>

These self tests are just self contained binaries, they are not run by any of the scripts in the directory. This means they need to be marked with TEST_GEN_PROGS to actually be run, not TEST_GEN_FILES.

---
v1->v2:
- Moved msg_zerocopy to TEST_GEN_FILES since it's not runnable in it's current state

 tools/testing/selftests/net/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tools/testing/selftests/net/Makefile +3 -3
index 3df542c84610..d86bca991f45 100644
@@ -5,9 +5,9 @@ CFLAGS += -I../../../../usr/include/
 
 TEST_PROGS := run_netsocktests run_afpackettests test_bpf.sh netdevice.sh rtnetlink.sh
 TEST_GEN_FILES =  socket
-TEST_GEN_FILES += psock_fanout psock_tpacket
-TEST_GEN_FILES += reuseport_bpf reuseport_bpf_cpu reuseport_bpf_numa
-TEST_GEN_FILES += reuseport_dualstack msg_zerocopy reuseaddr_conflict
+TEST_GEN_FILES += psock_fanout psock_tpacket msg_zerocopy
+TEST_GEN_PROGS = reuseport_bpf reuseport_bpf_cpu reuseport_bpf_numa
+TEST_GEN_PROGS += reuseport_dualstack reuseaddr_conflict
 
 include ../lib.mk
 
Signature · 1 line
2.7.4
maintainer
#2 lore raw

Re: [PATCH 2/3][v2] selftests: actually run the various net selftests

Quoted 6 lines · On 09/19/2017 07:51 AM, [email protected] wrote:

From: Josef Bacik <[email protected]>

These self tests are just self contained binaries, they are not run by any of the scripts in the directory. This means they need to be marked with TEST_GEN_PROGS to actually be run, not TEST_GEN_FILES.

Quoted 6 lines

---
v1->v2:
- Moved msg_zerocopy to TEST_GEN_FILES since it's not runnable in it's current state

I usually don't sent new tests however, since it is a test for a regression, applied to linux-kselftest fixes for 4.14-rc2

thanks,
-- Shuah

#3 lore raw

PATCH v2 3/3 selftests: silence test output by default

In reply to [email protected]

From: Josef Bacik <[email protected]>

Some of the networking tests are very noisy and make it impossible to see if we actually passed the tests as they run. Default to suppressing the output from any tests run in order to make it easier to track what failed.

---
v1->v2:
- dump output into /tmp/testname instead of /dev/null

 tools/testing/selftests/lib.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/lib.mk +2 -2
index 693616651da5..4665463779f5 100644
@@ -24,7 +24,7 @@ define RUN_TESTS
 			echo "selftests: Warning: file $$BASENAME_TEST is not executable, correct this.";\
 			echo "not ok 1..$$test_num selftests: $$BASENAME_TEST [FAIL]"; \
 		else					\
-			cd `dirname $$TEST` > /dev/null; (./$$BASENAME_TEST && echo "ok 1..$$test_num selftests: $$BASENAME_TEST [PASS]") || echo "not ok 1..$$test_num selftests:  $$BASENAME_TEST [FAIL]"; cd - > /dev/null;\
+			cd `dirname $$TEST` > /dev/null; (./$$BASENAME_TEST > /tmp/$$BASENAME_TEST 2>&1 && echo "ok 1..$$test_num selftests: $$BASENAME_TEST [PASS]") || echo "not ok 1..$$test_num selftests:  $$BASENAME_TEST [FAIL]"; cd - > /dev/null;\
 		fi;					\
 	done;
 endef
@@ -55,7 +55,7 @@ endif
 define EMIT_TESTS
 	@for TEST in $(TEST_GEN_PROGS) $(TEST_PROGS); do \
 		BASENAME_TEST=`basename $$TEST`;	\
-		echo "(./$$BASENAME_TEST && echo \"selftests: $$BASENAME_TEST [PASS]\") || echo \"selftests: $$BASENAME_TEST [FAIL]\""; \
+		echo "(./$$BASENAME_TEST > /tmp/$$BASENAME_TEST 2>&1 && echo \"selftests: $$BASENAME_TEST [PASS]\") || echo \"selftests: $$BASENAME_TEST [FAIL]\""; \
 	done;
 endef
 
Signature · 1 line
2.7.4
maintainer
#4 lore raw

Re: [PATCH 3/3][v2] selftests: silence test output by default

Quoted 7 lines · On 09/19/2017 07:51 AM, [email protected] wrote:

From: Josef Bacik <[email protected]>

Some of the networking tests are very noisy and make it impossible to see if we actually passed the tests as they run. Default to suppressing the output from any tests run in order to make it easier to track what failed.

Quoted 5 lines

---
v1->v2:
- dump output into /tmp/testname instead of /dev/null

Thanks for the fix. Applied to linux-kselftest for 4.14-rc2

-- Shuah

#5 lore raw

Re: [PATCH 3/3][v2] selftests: silence test output by default

Quoted 8 lines · Shuah Khan
Quoted 7 lines · On 09/19/2017 07:51 AM, [email protected] wrote:

From: Josef Bacik <[email protected]>

Some of the networking tests are very noisy and make it impossible to see if we actually passed the tests as they run. Default to suppressing the output from any tests run in order to make it easier to track what failed.

Quoted 7 lines
Quoted 5 lines

---
v1->v2:
- dump output into /tmp/testname instead of /dev/null

Thanks for the fix. Applied to linux-kselftest for 4.14-rc2

Sorry this is not a fix.

This is a regression, it breaks all my test infrastructure, because we use the output of the test case.

Can we please revert this and fix any tests that are overly verbose.

cheers

maintainer
#6 lore raw
In reply to [email protected]
Quoted 9 lines · On 09/19/2017 07:51 AM, [email protected] wrote:

From: Josef Bacik <[email protected]>

This is to test for a regression introduced by

b9470c27607b ("inet: kill smallest_size and smallest_port")

which introduced a problem with reuseaddr and bind conflicts.

I usually don't sent new tests however, since it is a test for a regression, applied to linux-kselftest fixes for 4.14-rc2

thanks,
-- Shuah