selftests: drv-net: add a simple TSO test
Subsystems (3)
Jakub Kicinski
maintainerv3 cover selftests: drv-net: add a simple TSO test
Add a simple test for exercising TSO over tunnels.
Similarly to csum test we want to iterate over ip versions. Rework how addresses are stored in env to make this easier.
v3:
- [patch 3] new patch
- [patch 4] rework after new patch added
v2: https://lore.kernel.org/[email protected]
- [patch 1] check for IP being on multiple ifcs
- [patch 4] lower max noise
- [patch 4] mention header overhead in the comment
- [patch 4] fix the basic v4 TSO feature name
- [patch 4] also run a stream with just GSO partial for tunnels
v1: https://lore.kernel.org/[email protected]
Jakub Kicinski (4):
selftests: drv-net: resolve remote interface name
selftests: drv-net: get detailed interface info
selftests: drv-net: store addresses in dict indexed by ipver
selftests: drv-net: add a simple TSO test
.../testing/selftests/drivers/net/hw/Makefile | 1 + .../testing/selftests/drivers/net/hw/csum.py | 48 ++-- .../selftests/drivers/net/hw/devmem.py | 6 +- tools/testing/selftests/drivers/net/hw/tso.py | 222 ++++++++++++++++++ .../selftests/drivers/net/lib/py/env.py | 58 +++-- tools/testing/selftests/drivers/net/ping.py | 12 +- 6 files changed, 286 insertions(+), 61 deletions(-) create mode 100755 tools/testing/selftests/drivers/net/hw/tso.py
Signature · 1 line
2.48.1
Jakub Kicinski
maintainerPATCH v3 1/4 selftests: drv-net: resolve remote interface name
Find out and record in env the name of the interface which remote host will use for the IP address provided via config.
Interface name is useful for mausezahn and for setting up tunnels.
---
v2:
- check for IP being on multiple ifcs
v1: https://lore.kernel.org/[email protected]
--- tools/testing/selftests/drivers/net/lib/py/env.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
tools/testing/selftests/drivers/net/lib/py/env.py +15 -0
@@ -154,6 +154,9 @@ from .remote import Remote self.ifname = self.dev['ifname'] self.ifindex = self.dev['ifindex'] + # resolve remote interface name + self.remote_ifname = self.resolve_remote_ifc() + self._required_cmd = {} def create_local(self):
@@ -200,6 +203,18 @@ from .remote import Remote raise Exception("Invalid environment, missing configuration:", missing, "Please see tools/testing/selftests/drivers/net/README.rst") + def resolve_remote_ifc(self): + v4 = v6 = None + if self.remote_v4: + v4 = ip("addr show to " + self.remote_v4, json=True, host=self.remote) + if self.remote_v6: + v6 = ip("addr show to " + self.remote_v6, json=True, host=self.remote) + if v4 and v6 and v4[0]["ifname"] != v6[0]["ifname"]: + raise Exception("Can't resolve remote interface name, v4 and v6 don't match") + if (v4 and len(v4) > 1) or (v6 and len(v6) > 1): + raise Exception("Can't resolve remote interface name, multiple interfaces match") + return v6[0]["ifname"] if v6 else v4[0]["ifname"] + def __enter__(self): return self
Signature · 1 line
2.48.1
Jakub Kicinski
maintainerPATCH v3 2/4 selftests: drv-net: get detailed interface info
In reply to Jakub KicinskiWe already record output of ip link for NETIF in env for easy access. Record the detailed version. TSO test will want to know the max tso size.
--- tools/testing/selftests/drivers/net/lib/py/env.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/drivers/net/lib/py/env.py +2 -2
@@ -64,7 +64,7 @@ from .remote import Remote self._ns = None if 'NETIF' in self.env: - self.dev = ip("link show dev " + self.env['NETIF'], json=True)[0] + self.dev = ip("-d link show dev " + self.env['NETIF'], json=True)[0] else: self._ns = NetdevSimDev(**kwargs) self.dev = self._ns.nsims[0].dev
@@ -118,7 +118,7 @@ from .remote import Remote raise KsftXfailEx("Test only works on netdevsim") self._check_env() - self.dev = ip("link show dev " + self.env['NETIF'], json=True)[0] + self.dev = ip("-d link show dev " + self.env['NETIF'], json=True)[0] self.v4 = self.env.get("LOCAL_V4") self.v6 = self.env.get("LOCAL_V6")
Signature · 1 line
2.48.1
Jakub Kicinski
maintainerPATCH v3 3/4 selftests: drv-net: store addresses in dict indexed by ipver
In reply to Jakub KicinskiLooks like more and more tests want to iterate over IP version, run the same test over ipv4 and ipv6. The current naming of members in the env class makes it a bit awkward, we have separate members for ipv4 and ipv6 parameters.
Store the parameters inside dicts, so that tests can easily index them with ip version.
---
v3:
- new patch
--- .../testing/selftests/drivers/net/hw/csum.py | 48 +++++++------------ .../selftests/drivers/net/hw/devmem.py | 6 +-- .../selftests/drivers/net/lib/py/env.py | 47 +++++++++--------- tools/testing/selftests/drivers/net/ping.py | 12 ++--- 4 files changed, 50 insertions(+), 63 deletions(-)
tools/testing/selftests/drivers/net/hw/csum.py +18 -30
@@ -9,15 +9,12 @@ from lib.py import ksft_run, ksft_exit, KsftSkipEx from lib.py import EthtoolFamily, NetDrvEpEnv from lib.py import bkg, cmd, wait_port_listen -def test_receive(cfg, ipv4=False, extra_args=None): +def test_receive(cfg, ipver="6", extra_args=None): """Test local nic checksum receive. Remote host sends crafted packets.""" if not cfg.have_rx_csum: raise KsftSkipEx(f"Test requires rx checksum offload on {cfg.ifname}") - if ipv4: - ip_args = f"-4 -S {cfg.remote_v4} -D {cfg.v4}" - else: - ip_args = f"-6 -S {cfg.remote_v6} -D {cfg.v6}" + ip_args = f"-{ipver} -S {cfg.remote_addr_v[ipver]} -D {cfg.addr_v[ipver]}" rx_cmd = f"{cfg.bin_local} -i {cfg.ifname} -n 100 {ip_args} -r 1 -R {extra_args}" tx_cmd = f"{cfg.bin_remote} -i {cfg.ifname} -n 100 {ip_args} -r 1 -T {extra_args}"
@@ -27,17 +24,14 @@ from lib.py import bkg, cmd, wait_port_listen cmd(tx_cmd, host=cfg.remote) -def test_transmit(cfg, ipv4=False, extra_args=None): +def test_transmit(cfg, ipver="6", extra_args=None): """Test local nic checksum transmit. Remote host verifies packets.""" if (not cfg.have_tx_csum_generic and - not (cfg.have_tx_csum_ipv4 and ipv4) and - not (cfg.have_tx_csum_ipv6 and not ipv4)): + not (cfg.have_tx_csum_ipv4 and ipver == "4") and + not (cfg.have_tx_csum_ipv6 and ipver == "6")): raise KsftSkipEx(f"Test requires tx checksum offload on {cfg.ifname}") - if ipv4: - ip_args = f"-4 -S {cfg.v4} -D {cfg.remote_v4}" - else: - ip_args = f"-6 -S {cfg.v6} -D {cfg.remote_v6}" + ip_args = f"-{ipver} -S {cfg.addr_v[ipver]} -D {cfg.remote_addr_v[ipver]}" # Cannot randomize input when calculating zero checksum if extra_args != "-U -Z":
@@ -51,26 +45,20 @@ from lib.py import bkg, cmd, wait_port_listen cmd(tx_cmd) -def test_builder(name, cfg, ipv4=False, tx=False, extra_args=""): +def test_builder(name, cfg, ipver="6", tx=False, extra_args=""): """Construct specific tests from the common template. Most tests follow the same basic pattern, differing only in Direction of the test and optional flags passed to csum.""" def f(cfg): - if ipv4: - cfg.require_v4() - else: - cfg.require_v6() + cfg.require_ipver(ipver) if tx: - test_transmit(cfg, ipv4, extra_args) + test_transmit(cfg, ipver, extra_args) else: - test_receive(cfg, ipv4, extra_args) + test_receive(cfg, ipver, extra_args) - if ipv4: - f.__name__ = "ipv4_" + name - else: - f.__name__ = "ipv6_" + name + f.__name__ = f"ipv{ipver}_" + name return f
@@ -104,15 +92,15 @@ from lib.py import bkg, cmd, wait_port_listen cfg.bin_remote = cfg.remote.deploy(cfg.bin_local) cases = [] - for ipv4 in [True, False]: - cases.append(test_builder("rx_tcp", cfg, ipv4, False, "-t")) - cases.append(test_builder("rx_tcp_invalid", cfg, ipv4, False, "-t -E")) + for ipver in ["4", "6"]: + cases.append(test_builder("rx_tcp", cfg, ipver, False, "-t")) + cases.append(test_builder("rx_tcp_invalid", cfg, ipver, False, "-t -E")) - cases.append(test_builder("rx_udp", cfg, ipv4, False, "")) - cases.append(test_builder("rx_udp_invalid", cfg, ipv4, False, "-E")) + cases.append(test_builder("rx_udp", cfg, ipver, False, "")) + cases.append(test_builder("rx_udp_invalid", cfg, ipver, False, "-E")) - cases.append(test_builder("tx_udp_csum_offload", cfg, ipv4, True, "-U")) - cases.append(test_builder("tx_udp_zero_checksum", cfg, ipv4, True, "-U -Z")) + cases.append(test_builder("tx_udp_csum_offload", cfg, ipver, True, "-U")) + cases.append(test_builder("tx_udp_zero_checksum", cfg, ipver, True, "-U -Z")) ksft_run(cases=cases, args=(cfg, )) ksft_exit()
tools/testing/selftests/drivers/net/hw/devmem.py +3 -3
@@ -21,15 +21,15 @@ from lib.py import ksft_disruptive @ksft_disruptive def check_rx(cfg) -> None: - cfg.require_v6() + cfg.require_ipver("6") require_devmem(cfg) port = rand_port() - listen_cmd = f"./ncdevmem -l -f {cfg.ifname} -s {cfg.v6} -p {port}" + listen_cmd = f"./ncdevmem -l -f {cfg.ifname} -s {cfg.addr_v['6']} -p {port}" with bkg(listen_cmd) as socat: wait_port_listen(port) - cmd(f"echo -e \"hello\\nworld\"| socat -u - TCP6:[{cfg.v6}]:{port}", host=cfg.remote, shell=True) + cmd(f"echo -e \"hello\\nworld\"| socat -u - TCP6:[{cfg.addr_v['6']}]:{port}", host=cfg.remote, shell=True) ksft_eq(socat.stdout.strip(), "hello\nworld")
tools/testing/selftests/drivers/net/lib/py/env.py +23 -24
84 lines not on this page · raw message
tools/testing/selftests/drivers/net/ping.py +6 -6
@@ -8,17 +8,17 @@ from lib.py import bkg, cmd, wait_port_listen, rand_port def test_v4(cfg) -> None: - cfg.require_v4() + cfg.require_ipver("4") - cmd(f"ping -c 1 -W0.5 {cfg.remote_v4}") - cmd(f"ping -c 1 -W0.5 {cfg.v4}", host=cfg.remote) + cmd(f"ping -c 1 -W0.5 {cfg.remote_addr_v["4"]}") + cmd(f"ping -c 1 -W0.5 {cfg.addr_v["4"]}", host=cfg.remote) def test_v6(cfg) -> None: - cfg.require_v6() + cfg.require_ipver("6") - cmd(f"ping -c 1 -W0.5 {cfg.remote_v6}") - cmd(f"ping -c 1 -W0.5 {cfg.v6}", host=cfg.remote) + cmd(f"ping -c 1 -W0.5 {cfg.remote_addr_v["6"]}") + cmd(f"ping -c 1 -W0.5 {cfg.addr_v["6"]}", host=cfg.remote) def test_tcp(cfg) -> None:
Signature · 1 line
2.48.1
Jakub Kicinski
maintainerPATCH v3 4/4 selftests: drv-net: add a simple TSO test
In reply to Jakub KicinskiAdd a simple test for TSO. Send a few MB of data and check device stats to verify that the device was performing segmentation. Do the same thing over a few tunnel types.
Injecting GSO packets directly would give us more ability to test corner cases, but perhaps starting simple is good enough?
# ./ksft-net-drv/drivers/net/hw/tso.py # Detected qstat for LSO wire-packets KTAP version 1 1..14 ok 1 tso.ipv4 # SKIP Test requires IPv4 connectivity ok 2 tso.vxlan4_ipv4 # SKIP Test requires IPv4 connectivity ok 3 tso.vxlan6_ipv4 # SKIP Test requires IPv4 connectivity ok 4 tso.vxlan_csum4_ipv4 # SKIP Test requires IPv4 connectivity ok 5 tso.vxlan_csum6_ipv4 # SKIP Test requires IPv4 connectivity ok 6 tso.gre4_ipv4 # SKIP Test requires IPv4 connectivity ok 7 tso.gre6_ipv4 # SKIP Test requires IPv4 connectivity ok 8 tso.ipv6 ok 9 tso.vxlan4_ipv6 ok 10 tso.vxlan6_ipv6 ok 11 tso.vxlan_csum4_ipv6 ok 12 tso.vxlan_csum6_ipv6 ok 13 tso.gre4_ipv6 ok 14 tso.gre6_ipv6 # Totals: pass:7 fail:0 xfail:0 xpass:0 skip:7 error:0
Note that the test currently depends on the driver reporting the LSO count via qstat, which appears to be relatively rare (virtio, cisco/enic, sfc/efc; but virtio needs host support).
---
v3:
- rework after the v4/v6 address split
v2: https://lore.kernel.org/[email protected]
- lower max noise
- mention header overhead in the comment
- fix the basic v4 TSO feature name
- also run a stream with just GSO partial for tunnels
v1: https://lore.kernel.org/[email protected]
--- .../testing/selftests/drivers/net/hw/Makefile | 1 + tools/testing/selftests/drivers/net/hw/tso.py | 222 ++++++++++++++++++ 2 files changed, 223 insertions(+) create mode 100755 tools/testing/selftests/drivers/net/hw/tso.py
tools/testing/selftests/drivers/net/hw/Makefile +1 -0
@@ -15,6 +15,7 @@ TEST_PROGS = \ nic_performance.py \ pp_alloc_fail.py \ rss_ctx.py \ + tso.py \ # TEST_FILES := \
tools/testing/selftests/drivers/net/hw/tso.py new file +222 -0
222 lines not on this page · raw message
Signature · 1 line
2.48.1
Re: [PATCH net-next v3 3/4] selftests: drv-net: store addresses in dict indexed by ipver
In reply to Jakub KicinskiQuoted 12 lines · Jakub Kicinski
Looks like more and more tests want to iterate over IP version, run the same test over ipv4 and ipv6. The current naming of members in the env class makes it a bit awkward, we have separate members for ipv4 and ipv6 parameters.
Store the parameters inside dicts, so that tests can easily index them with ip version.
Signed-off-by Jakub Kicinski <[email protected]>+++
b/tools/testing/selftests/drivers/net/ping.py
tools/testing/selftests/drivers/net/ping.py from lib.py import bkg, cmd, wait_port_listen, rand_port · line 14
Quoted 10 lines
tools/testing/selftests/drivers/net/ping.py +3
-3@@ -8,17 +8,17 @@ from lib.py import bkg, cmd, wait_port_listen, rand_port def test_v4(cfg) -> None: - cfg.require_v4() + cfg.require_ipver("4") - cmd(f"ping -c 1 -W0.5 {cfg.remote_v4}") - cmd(f"ping -c 1 -W0.5 {cfg.v4}", host=cfg.remote) + cmd(f"ping -c 1 -W0.5 {cfg.remote_addr_v["4"]}") + cmd(f"ping -c 1 -W0.5 {cfg.addr_v["4"]}", host=cfg.remote)
Here and below, intended to use single quote around constant?
Quoted 15 lines
tools/testing/selftests/drivers/net/ping.py +3
-3def test_v6(cfg) -> None: - cfg.require_v6() + cfg.require_ipver("6") - cmd(f"ping -c 1 -W0.5 {cfg.remote_v6}") - cmd(f"ping -c 1 -W0.5 {cfg.v6}", host=cfg.remote) + cmd(f"ping -c 1 -W0.5 {cfg.remote_addr_v["6"]}") + cmd(f"ping -c 1 -W0.5 {cfg.addr_v["6"]}", host=cfg.remote) def test_tcp(cfg) -> None:Signature · 1 line
2.48.1
Quoted 71 lines · Jakub Kicinski
Add a simple test for TSO. Send a few MB of data and check device stats to verify that the device was performing segmentation. Do the same thing over a few tunnel types.
Injecting GSO packets directly would give us more ability to test corner cases, but perhaps starting simple is good enough?
# ./ksft-net-drv/drivers/net/hw/tso.py # Detected qstat for LSO wire-packets KTAP version 1 1..14 ok 1 tso.ipv4 # SKIP Test requires IPv4 connectivity ok 2 tso.vxlan4_ipv4 # SKIP Test requires IPv4 connectivity ok 3 tso.vxlan6_ipv4 # SKIP Test requires IPv4 connectivity ok 4 tso.vxlan_csum4_ipv4 # SKIP Test requires IPv4 connectivity ok 5 tso.vxlan_csum6_ipv4 # SKIP Test requires IPv4 connectivity ok 6 tso.gre4_ipv4 # SKIP Test requires IPv4 connectivity ok 7 tso.gre6_ipv4 # SKIP Test requires IPv4 connectivity ok 8 tso.ipv6 ok 9 tso.vxlan4_ipv6 ok 10 tso.vxlan6_ipv6 ok 11 tso.vxlan_csum4_ipv6 ok 12 tso.vxlan_csum6_ipv6 ok 13 tso.gre4_ipv6 ok 14 tso.gre6_ipv6 # Totals: pass:7 fail:0 xfail:0 xpass:0 skip:7 error:0Note that the test currently depends on the driver reporting the LSO count via qstat, which appears to be relatively rare (virtio, cisco/enic, sfc/efc; but virtio needs host support).
Signed-off-by Jakub Kicinski <[email protected]>---
v3:
- rework after the v4/v6 address split
v2: https://lore.kernel.org/[email protected]
- lower max noise
- mention header overhead in the comment
- fix the basic v4 TSO feature name
- also run a stream with just GSO partial for tunnels
v1: https://lore.kernel.org/[email protected]tools/testing/selftests/drivers/net/hw/tso.py new file +29
-0+def test_builder(name, cfg, ipver, feature, tun=None, inner_ipver=None): + """Construct specific tests from the common template.""" + def f(cfg): + cfg.require_ipver(ipver) + + if not cfg.have_stat_super_count and \ + not cfg.have_stat_wire_count: + raise KsftSkipEx(f"Device does not support LSO queue stats") + + if tun: + remote_v4, remote_v6 = build_tunnel(cfg, ipver, tun) + else: + remote_v4 = cfg.remote_addr_v["4"] + remote_v6 = cfg.remote_addr_v["6"] + + tun_partial = tun and tun[1] + has_gso_partial = tun and 'tx-gso-partial' in cfg.features + + # First test without the feature enabled. + ethtool(f"-K {cfg.ifname} {feature} off") + if has_gso_partial: + ethtool(f"-K {cfg.ifname} tx-gso-partial off") + run_one_stream(cfg, ipver, remote_v4, remote_v6, should_lso=False) + + # Now test with the feature enabled. + # For compatible tunnels only - just GSO partial, not specific feature. + if has_gso_partial: + ethtool(f"-K {cfg.ifname} tx-gso-partial on") + run_one_stream(cfg, ipver, remote_v4, remote_v6,
tools/testing/selftests/drivers/net/hw/tso.py line 160
Quoted 10 lines
tools/testing/selftests/drivers/net/hw/tso.py new file +10
-0+ should_lso=tun_partial) + + # Full feature enabled. + if feature in cfg.features: + ethtool(f"-K {cfg.ifname} {feature} on") + run_one_stream(cfg, ipver, remote_v4, remote_v6, should_lso=True) + else: + raise KsftXfailEx(f"Device does not support {feature}") + + f.__name__ = name + ((ipver + "_") if tun else "") + "ipv" + ipver
use inner_ipver if tun?
based on previous version of the patch:
+ if tun:
+ name += ("4" if inner_ipv4 else "6") + "_"
Quoted 2 lines
tools/testing/selftests/drivers/net/hw/tso.py new file +2
-0+ return f +
Re: [PATCH net-next v3 3/4] selftests: drv-net: store addresses in dict indexed by ipver
In reply to Willem de BruijnQuoted 19 lines · Willem de Bruijn
Quoted 18 lines · Jakub Kicinski
Looks like more and more tests want to iterate over IP version, run the same test over ipv4 and ipv6. The current naming of members in the env class makes it a bit awkward, we have separate members for ipv4 and ipv6 parameters.
Store the parameters inside dicts, so that tests can easily index them with ip version.
Signed-off-by Jakub Kicinski <[email protected]>+++
b/tools/testing/selftests/drivers/net/ping.pytools/testing/selftests/drivers/net/ping.py +1
-1@@ -8,17 +8,17 @@ from lib.py import bkg, cmd, wait_port_listen, rand_port def test_v4(cfg) -> None: - cfg.require_v4() + cfg.require_ipver("4")
Quoted 6 lines
tools/testing/selftests/drivers/net/ping.py from lib.py import bkg, cmd, wait_port_listen, rand_port · line 14
Quoted 4 lines
tools/testing/selftests/drivers/net/ping.py +2
-2- cmd(f"ping -c 1 -W0.5 {cfg.remote_v4}") - cmd(f"ping -c 1 -W0.5 {cfg.v4}", host=cfg.remote) + cmd(f"ping -c 1 -W0.5 {cfg.remote_addr_v["4"]}") + cmd(f"ping -c 1 -W0.5 {cfg.addr_v["4"]}", host=cfg.remote)Here and below, intended to use single quote around constant?
Let's kick it off the testing queue as well..
# overriding timeout to 90
# selftests: drivers/net: ping.py
# File "/home/virtme/testing-18/tools/testing/selftests/drivers/net/./ping.py", line 13
# cmd(f"ping -c 1 -W0.5 {cfg.remote_addr_v["4"]}")
# ^
# SyntaxError: f-string: unmatched '['---
pw-bot: cr
Jakub Kicinski
maintainerRe: [PATCH net-next v3 3/4] selftests: drv-net: store addresses in dict indexed by ipver
Quoted 11 lines · On Mon, 17 Feb 2025 20:21:56 -0800 Stanislav Fomichev wrote:
Quoted 10 lines
tools/testing/selftests/drivers/net/ping.py from lib.py import bkg, cmd, wait_port_listen, rand_port · line 14
Quoted 8 lines
def
test_v4(cfg)-> None:tools/testing/selftests/drivers/net/ping.py +3
-3- cfg.require_v4() + cfg.require_ipver("4") - cmd(f"ping -c 1 -W0.5 {cfg.remote_v4}") - cmd(f"ping -c 1 -W0.5 {cfg.v4}", host=cfg.remote) + cmd(f"ping -c 1 -W0.5 {cfg.remote_addr_v["4"]}") + cmd(f"ping -c 1 -W0.5 {cfg.addr_v["4"]}", host=cfg.remote)Here and below, intended to use single quote around constant?
Quoted 8 lines
Let's kick it off the testing queue as well..
# overriding timeout to 90 # selftests: drivers/net: ping.py # File "/home/virtme/testing-18/tools/testing/selftests/drivers/net/./ping.py", line 13 # cmd(f"ping -c 1 -W0.5 {cfg.remote_addr_v["4"]}") # ^ # SyntaxError: f-string: unmatched '['
Huh, it worked for me locally, must be a python version thing..
Python 3.13.2
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
a={"a": ' '}
f"test{a["a"]}test"
'test test'
Re: [PATCH net-next v3 3/4] selftests: drv-net: store addresses in dict indexed by ipver
Quoted 21 lines · Jakub Kicinski
Quoted 11 lines · On Mon, 17 Feb 2025 20:21:56 -0800 Stanislav Fomichev wrote:
Quoted 10 lines
tools/testing/selftests/drivers/net/ping.py from lib.py import bkg, cmd, wait_port_listen, rand_port · line 14
Quoted 8 lines
def
test_v4(cfg)-> None:tools/testing/selftests/drivers/net/ping.py +3
-3- cfg.require_v4() + cfg.require_ipver("4") - cmd(f"ping -c 1 -W0.5 {cfg.remote_v4}") - cmd(f"ping -c 1 -W0.5 {cfg.v4}", host=cfg.remote) + cmd(f"ping -c 1 -W0.5 {cfg.remote_addr_v["4"]}") + cmd(f"ping -c 1 -W0.5 {cfg.addr_v["4"]}", host=cfg.remote)Here and below, intended to use single quote around constant?
Quoted 8 lines
Let's kick it off the testing queue as well..
# overriding timeout to 90 # selftests: drivers/net: ping.py # File "/home/virtme/testing-18/tools/testing/selftests/drivers/net/./ping.py", line 13 # cmd(f"ping -c 1 -W0.5 {cfg.remote_addr_v["4"]}") # ^ # SyntaxError: f-string: unmatched '['
Quoted 7 lines
Huh, it worked for me locally, must be a python version thing..
Python 3.13.2
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
a={"a": ' '}
f"test{a["a"]}test"'test test'
Failed for me on 3.11.
Apparently this was indeed addressed in 3.12:
https://realpython.com/python-f-strings/#using-quotation-marks