This is a pure refactor, so that the key exchange sequence can be used in other test cases that start with a key exchange, but might choose to perform different tx/rx patterns afterwards.
Signed-off-by: Daniel Zahka <[email protected]> --- tools/testing/selftests/drivers/net/psp.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/drivers/net/psp.py b/tools/testing/selftests/drivers/net/psp.py index 864d9fce1094..63dc8757ba37 100755 --- a/tools/testing/selftests/drivers/net/psp.py +++ b/tools/testing/selftests/drivers/net/psp.py @@ -360,10 +360,8 @@ def assoc_twice(cfg): s.close() -def _data_basic_send(cfg, version, ipver): - """ Test basic data send """ - _init_psp_dev(cfg) - +def _establish_psp_conn(cfg, version, ipver=None): + """Establish a PSP connection and return after key exchange""" # Version 0 is required by spec, don't let it skip if version: name = cfg.pspnl.consts["version"].entries_by_val[version].name @@ -388,7 +386,14 @@ def _data_basic_send(cfg, version, ipver): "version": version, "tx-key": tx, "sock-fd": s.fileno()}) + return s + + +def _data_basic_send(cfg, version, ipver): + """ Test basic data send """ + _init_psp_dev(cfg) + s = _establish_psp_conn(cfg, version, ipver) data_len = _send_careful(cfg, s, 100) _check_data_rx(cfg, data_len) _close_psp_conn(cfg, s) -- 2.47.3
