Skip to content

Commit

Permalink
[tests] [asan] add graceful stop flag (#2347)
Browse files Browse the repository at this point in the history
- 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 <yhuryk@nvidia.com>
  • Loading branch information
Yakiv-Huryk authored and yxieca committed Jun 28, 2022
1 parent 5ab84cf commit 37e2a31
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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]

Expand Down Expand Up @@ -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()

Expand Down

0 comments on commit 37e2a31

Please sign in to comment.