netstress, lib: TCONF on "not supported" in SAFE_SOCKET()
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
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
@@ -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
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]
RFC PATCH 2/2 tst_netload: Exit with TCONF when netstress exit with CONF
In reply to Petr Vorelas 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
@@ -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