xref: /linux/tools/testing/selftests/drivers/net/hw/devmem.py (revision 8d72997dab65b1e9e3220302e26eaecd9b99c02f)
1#!/usr/bin/env python3
2# SPDX-License-Identifier: GPL-2.0
3
4from os import path
5from devmem_lib import setup_test, run_rx, run_tx, run_tx_chunks, run_rx_hds
6from lib.py import ksft_run, ksft_exit, ksft_disruptive
7from lib.py import NetDrvEpEnv
8
9
10@ksft_disruptive
11def check_rx(cfg) -> None:
12    """Run the devmem RX test."""
13    run_rx(cfg)
14
15
16@ksft_disruptive
17def check_tx(cfg) -> None:
18    """Run the devmem TX test."""
19    run_tx(cfg)
20
21
22@ksft_disruptive
23def check_tx_chunks(cfg) -> None:
24    """Run the devmem TX chunking test."""
25    run_tx_chunks(cfg)
26
27
28def check_rx_hds(cfg) -> None:
29    """Run the HDS test."""
30    run_rx_hds(cfg)
31
32
33def main() -> None:
34    """Run the devmem test cases."""
35    with NetDrvEpEnv(__file__) as cfg:
36        setup_test(cfg, path.abspath(path.dirname(__file__) + "/ncdevmem"))
37        ksft_run([check_rx, check_tx, check_tx_chunks, check_rx_hds],
38                 args=(cfg,))
39    ksft_exit()
40
41
42if __name__ == "__main__":
43    main()
44