33
44import re
55from pathlib import PurePath , PurePosixPath
6- from typing import Any , List , Tuple , Type
6+ from typing import Any , Dict , List , Optional , Tuple , Type
77
88from assertpy import assert_that , fail
99from 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
0 commit comments