| 1 | |
| 2 | |
| 3 |
|
| 4 | from lib.py import ksft_run, ksft_exit
|
| 5 | from lib.py import ksft_eq, NetDrvEpEnv
|
| 6 | from lib.py import bkg, cmd, rand_port, NetNSEnter
|
| 7 |
|
| 8 | def test_napi_id(cfg) -> None:
|
| 9 | port = rand_port()
|
| 10 | listen_cmd = f"{cfg.test_dir}/napi_id_helper {cfg.addr} {port}"
|
| 11 |
|
| 12 | with bkg(listen_cmd, ksft_wait=3) as server:
|
| 13 | cmd(f"echo a | socat - TCP:{cfg.baddr}:{port}", host=cfg.remote, shell=True)
|
| 14 |
|
| 15 | ksft_eq(0, server.ret)
|
| 16 |
|
| 17 | def main() -> None:
|
| 18 | with NetDrvEpEnv(__file__) as cfg:
|
| 19 | ksft_run([test_napi_id], args=(cfg,))
|
| 20 | ksft_exit()
|
| 21 |
|
| 22 | if __name__ == "__main__":
|
| 23 | main()
|