Skip to contentSkip to conversation

netstress, lib: TCONF on "not supported" in SAFE_SOCKET()

RFC PATCH Superseded Petr Vorel 2 participants 4 messages Feb 27, 2018 – Feb 28, 2018 Library code

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

cover netstress, lib: TCONF on "not supported" in SAFE_SOCKET()

Hi Alexey,

these patches on the top of your patch netstress: set port dynamically on the server-side [1] can detect problems when some feature is missing (e.g. dccp module not compiled).

The only problem is whether we are ok that SAFE_*() macros can exit with TCONF or we expect it always to exit with TBROK.

[1] http://lists.linux.it/pipermail/ltp/2018-February/007173.html

Petr Vorel (2):
lib: TCONF on ESOCKTNOSUPPORT and EPROTONOSUPPORT in SAFE_SOCKET()
tst_netload: Exit with TCONF when netstress exit with CONF

 lib/safe_net.c            | 9 ++++-----
 testcases/lib/test_net.sh | 4 +++-
 2 files changed, 7 insertions(+), 6 deletions(-)
Signature · 1 line
2.16.2
author
#1 lore raw

RFC PATCH 1/2 lib: TCONF on ESOCKTNOSUPPORT and EPROTONOSUPPORT in SAFE_SOCKET()

As this is clearly configuration issue.

Example of use if missing dccp module in netstress.c:
safe_net.c:117: BROK: netstress.c:654: socket(10, 6, 33) failed: ESOCKTNOSUPPORT

---
 lib/safe_net.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
lib/safe_net.c +4 -5
index 9ea9d2b42..f8f4f44ca 100644
@@ -111,11 +111,10 @@ int safe_socket(const char *file, const int lineno, void (cleanup_fn)(void),
 
 	rval = socket(domain, type, protocol);
 
-	if (rval < 0) {
-		tst_brkm(TBROK | TERRNO, cleanup_fn,
-			 "%s:%d: socket(%d, %d, %d) failed", file, lineno,
-			 domain, type, protocol);
-	}
+	if (rval < 0)
+		tst_brkm((errno == EPROTONOSUPPORT || errno == ESOCKTNOSUPPORT ? TCONF : TBROK)
+				 | TERRNO, cleanup_fn, "%s:%d: socket(%d, %d, %d) failed",
+				 file, lineno, domain, type, protocol);
 
 	return rval;
 }
Signature · 1 line
2.16.2
#2 lore raw

RFC PATCH 1/2 lib: TCONF on ESOCKTNOSUPPORT and EPROTONOSUPPORT in SAFE_SOCKET()

Hi!

lib/safe_net.c int safe_socket(const char *file, const int lineno, void (cleanup_fn)(void), · line 117

Quoted 4 lines
lib/safe_net.c +4 -0
+	if (rval < 0)
+		tst_brkm((errno == EPROTONOSUPPORT || errno == ESOCKTNOSUPPORT ? TCONF : TBROK)
+				 | TERRNO, cleanup_fn, "%s:%d: socket(%d, %d, %d) failed",
+				 file, lineno, domain, type, protocol);

This is kind of ugly code, can we please write it more readable?

Signature · 2 lines
Cyril Hrubis
[email protected]
author
#3 lore raw

RFC PATCH 2/2 tst_netload: Exit with TCONF when netstress exit with CONF

In reply to Petr Vorel

as some issues are configuration issues.

---
 testcases/lib/test_net.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
testcases/lib/test_net.sh +3 -1
index 95e13ee03..db9bb028d 100644
@@ -453,7 +453,9 @@ tst_netload()
 	tst_rhost_run -c "netstress $s_opts" > tst_netload.log 2>&1
 	if [ $? -ne 0 ]; then
 		cat tst_netload.log
-		tst_brkm TFAIL "server failed"
+		local ttype="TFAIL"
+		grep -e 'CONF:' tst_netload.log && ttype="TCONF"
+		tst_brkm $ttype "server failed"
 	fi
 
 	local port=$(tst_rhost_run -s -c "cat $TST_TMPDIR/netstress_port")
Signature · 1 line
2.16.2