Skip to content

Commit 37e2a31

Browse files
Yakiv-Hurykyxieca
authored andcommitted
[tests] [asan] add graceful stop flag (#2347)
- What I did Added a new flag to DVS tests - Why I did it Currently, when running the tests with ASAN-enabled image, leak reports are not generated. The reason is that dvs.destroy() (via 'ctn.remove(force=True)') uses SIGKILL to stop the container. To address this, a new flag is added. When the new flag is set, the swss processes are gracefully stopped (via SIGTERM). So ASAN reports can be generated as a result of DVS tests run - How I verified it Run the tests with --graceful-stop, observe that swss processes are stopped via SIGTERM Signed-off-by: Yakiv Huryk <[email protected]>
1 parent 5ab84cf commit 37e2a31

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/conftest.py

+9
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ def pytest_addoption(parser):
8989
default="traditional",
9090
help="Buffer model")
9191

92+
parser.addoption("--graceful-stop",
93+
action="store_true",
94+
default=False,
95+
help="Stop swss before stopping a conatainer")
96+
9297

9398
def random_string(size=4, chars=string.ascii_uppercase + string.digits):
9499
return "".join(random.choice(chars) for x in range(size))
@@ -1730,6 +1735,8 @@ def manage_dvs(request) -> str:
17301735
max_cpu = request.config.getoption("--max_cpu")
17311736
buffer_model = request.config.getoption("--buffer_model")
17321737
force_recreate = request.config.getoption("--force-recreate-dvs")
1738+
graceful_stop = request.config.getoption("--graceful-stop")
1739+
17331740
dvs = None
17341741
curr_dvs_env = [] # lgtm[py/unused-local-variable]
17351742

@@ -1778,6 +1785,8 @@ def update_dvs(log_path, new_dvs_env=[]):
17781785

17791786
yield update_dvs
17801787

1788+
if graceful_stop:
1789+
dvs.stop_swss()
17811790
dvs.get_logs()
17821791
dvs.destroy()
17831792

0 commit comments

Comments
 (0)