File: test_dgram.py

package info (click to toggle)
mpich 4.3.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 101,184 kB
  • sloc: ansic: 1,040,629; cpp: 82,270; javascript: 40,763; perl: 27,933; python: 16,041; sh: 14,676; xml: 14,418; f90: 12,916; makefile: 9,270; fortran: 8,046; java: 4,635; asm: 324; ruby: 103; awk: 27; lisp: 19; php: 8; sed: 4
file content (38 lines) | stat: -rw-r--r-- 2,139 bytes parent folder | download | duplicates (5)
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
28
29
30
31
32
33
34
35
36
37
38
import pytest
import copy
from efa.efa_common import efa_retrieve_hw_counter_value

# this test must be run in serial mode because it check hw counter
@pytest.mark.serial
@pytest.mark.parametrize("iteration_type",
                         [pytest.param("short", marks=pytest.mark.short),
                          pytest.param("standard", marks=pytest.mark.standard)])
def test_dgram_pingpong(cmdline_args, iteration_type):
    from common import ClientServerTest

    # dgram is unreliable, therefore it is expected that receiver does not always get all the messages
    # when that happened, the test will return -FI_ENODATA
    # Disable the strict mode to mark such return code as pass
    cmdline_args_copy = copy.copy(cmdline_args)
    cmdline_args_copy.strict_fabtests_mode = False

    server_tx_bytes_before_test = efa_retrieve_hw_counter_value(cmdline_args.client_id, "tx_bytes")
    client_tx_bytes_before_test = efa_retrieve_hw_counter_value(cmdline_args.client_id, "tx_bytes")
    server_rx_bytes_before_test = efa_retrieve_hw_counter_value(cmdline_args.client_id, "rx_bytes")
    client_rx_bytes_before_test = efa_retrieve_hw_counter_value(cmdline_args.client_id, "rx_bytes")

    # efa's dgram endpoint requires prefix therefore must always test with prefix mode on
    test = ClientServerTest(cmdline_args_copy, "fi_dgram_pingpong", iteration_type,
                            prefix_type="with_prefix")
    test.run()

    server_tx_bytes_after_test = efa_retrieve_hw_counter_value(cmdline_args.client_id, "tx_bytes")
    client_tx_bytes_after_test = efa_retrieve_hw_counter_value(cmdline_args.client_id, "tx_bytes")
    server_rx_bytes_after_test = efa_retrieve_hw_counter_value(cmdline_args.client_id, "rx_bytes")
    client_rx_bytes_after_test = efa_retrieve_hw_counter_value(cmdline_args.client_id, "rx_bytes")

    # verify there is EFA traffic
    assert server_tx_bytes_before_test < server_tx_bytes_after_test
    assert client_tx_bytes_before_test < client_tx_bytes_after_test
    assert server_rx_bytes_before_test < server_rx_bytes_after_test
    assert client_rx_bytes_before_test < client_rx_bytes_after_test