From 37e2a317f7c0723b1fbf76126cfbc7a11251c2c7 Mon Sep 17 00:00:00 2001 From: Yakiv Huryk <62013282+Yakiv-Huryk@users.noreply.github.com> Date: Tue, 28 Jun 2022 18:52:56 +0300 Subject: [PATCH] [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 --- tests/conftest.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index efe6c85225..6e6939d41c 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -89,6 +89,11 @@ def pytest_addoption(parser): default="traditional", help="Buffer model") + parser.addoption("--graceful-stop", + action="store_true", + default=False, + help="Stop swss before stopping a conatainer") + def random_string(size=4, chars=string.ascii_uppercase + string.digits): return "".join(random.choice(chars) for x in range(size)) @@ -1730,6 +1735,8 @@ def manage_dvs(request) -> str: max_cpu = request.config.getoption("--max_cpu") buffer_model = request.config.getoption("--buffer_model") force_recreate = request.config.getoption("--force-recreate-dvs") + graceful_stop = request.config.getoption("--graceful-stop") + dvs = None curr_dvs_env = [] # lgtm[py/unused-local-variable] @@ -1778,6 +1785,8 @@ def update_dvs(log_path, new_dvs_env=[]): yield update_dvs + if graceful_stop: + dvs.stop_swss() dvs.get_logs() dvs.destroy()