Skip to content

Commit 9953e93

Browse files
committed
dpdk: set env args for testpmd asan
1 parent 562bcad commit 9953e93

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

microsoft/testsuites/dpdk/dpdktestpmd.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import re
55
from pathlib import PurePath, PurePosixPath
6-
from typing import Any, List, Tuple, Type
6+
from typing import Any, Dict, List, Optional, Tuple, Type
77

88
from assertpy import assert_that, fail
99
from semver import VersionInfo
@@ -615,9 +615,16 @@ def generate_testpmd_command(
615615
def run_for_n_seconds(self, cmd: str, timeout: int) -> str:
616616
self._last_run_timeout = timeout
617617
self.node.log.info(f"{self.node.name} running: {cmd}")
618-
618+
envs: Optional[Dict[str, str]] = (
619+
{
620+
"ASAN_OPTIONS": "detect_leaks=false",
621+
"LD_PRELOAD": find_libasan_so(self.node),
622+
}
623+
if self.installer.use_asan
624+
else None
625+
)
619626
proc_result = self.node.tools[Timeout].run_with_timeout(
620-
cmd, timeout, SIGINT, kill_timeout=timeout + 10
627+
cmd, timeout, SIGINT, kill_timeout=timeout + 10, update_envs=envs
621628
)
622629
self._last_run_output = proc_result.stdout
623630
self.populate_performance_data()
@@ -626,7 +633,6 @@ def run_for_n_seconds(self, cmd: str, timeout: int) -> str:
626633
def start_for_n_seconds(self, cmd: str, timeout: int) -> str:
627634
self._last_run_timeout = timeout
628635
self.node.log.info(f"{self.node.name} running: {cmd}")
629-
630636
proc_result = self.node.tools[Timeout].run_with_timeout(
631637
cmd, timeout, SIGINT, kill_timeout=timeout + 10
632638
)
@@ -746,11 +752,9 @@ def get_example_app_path(self, app_name: str) -> PurePath:
746752
if not shell.exists(source_path.joinpath("build")):
747753
libasan_so = find_libasan_so(self.node)
748754
assert libasan_so != "", "couldn't find libasan"
749-
envs = (
755+
envs: Optional[Dict[str, str]] = (
750756
{
751757
"CFLAGS": "-fsanitize=address",
752-
"ASAN_OPTIONS": "detect_leaks=false",
753-
"LD_PRELOAD": libasan_so,
754758
}
755759
if self.installer.use_asan
756760
else None

microsoft/testsuites/dpdk/dpdkutil.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,7 @@ def _run_command_with_testkit(
496496
run_kit: Tuple[DpdkTestResources, str],
497497
) -> Tuple[DpdkTestResources, str]:
498498
testkit, cmd = run_kit
499+
499500
return (testkit, testkit.testpmd.run_for_n_seconds(cmd, seconds))
500501

501502
task_manager = run_in_parallel_async(
@@ -1348,7 +1349,7 @@ class DpdkDevnameInfo:
13481349
def __init__(self, testpmd: DpdkTestpmd) -> None:
13491350
self._node = testpmd.node
13501351
self._testpmd = testpmd
1351-
self.env_args = None
1352+
self.env_args: Optional[Dict[str, str]] = None
13521353

13531354
def get_port_info(self, nics: List[NicInfo], expect_ports: int = 1) -> str:
13541355
# since we only need this for netvsc, we'll only generate

0 commit comments

Comments
 (0)