summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/drivers/net/ping.py
blob: e75908d7c55859f7d89e47376fdea8c1a9d49f88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0

from lib.py import ksft_run, ksft_exit
from lib.py import NetDrvEpEnv
from lib.py import cmd


def test_v4(cfg) -> None:
    cmd(f"ping -c 1 -W0.5 {cfg.remote_v4}")
    cmd(f"ping -c 1 -W0.5 {cfg.v4}", host=cfg.remote)


def test_v6(cfg) -> None:
    cmd(f"ping -c 1 -W0.5 {cfg.remote_v6}")
    cmd(f"ping -c 1 -W0.5 {cfg.v6}", host=cfg.remote)


def main() -> None:
    with NetDrvEpEnv(__file__) as cfg:
        ksft_run([test_v4, test_v6],
                 args=(cfg, ))
    ksft_exit()


if __name__ == "__main__":
    main()