Skip to content

Commit

Permalink
tests: If a core file is generated fail the test
Browse files Browse the repository at this point in the history
If a .dmp file is found in the test log directories
fail the test.

Fixes: FRRouting#13788
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
  • Loading branch information
donaldsharp committed Jun 29, 2023
1 parent 768898e commit 9e60a9d
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/topotests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,26 @@ def check_for_memleaks():
pytest.fail("memleaks found for daemons: " + " ".join(daemons))


def check_for_core_dumps():
dumps = []
tgen = get_topogen() # pylint: disable=redefined-outer-name
latest = []
existing = []

if tgen is not None:
logdir = tgen.logdir
if hasattr(tgen, "cores_existing_files"):
existing = tgen.cores_existing_files
cores = glob.glob(os.path.join(logdir, "*/*.dmp"))

if tgen is not None:
tgen.cores_existing_files = existing

if cores:
logger.error("Cores found:\n\t%s", "\n\t".join(cores))
pytest.fail("Core files found")


def check_for_backtraces():
backtraces = []
tgen = get_topogen() # pylint: disable=redefined-outer-name
Expand Down Expand Up @@ -354,6 +374,7 @@ def module_check_memtest(request):
if get_topogen() is not None:
check_for_memleaks()
check_for_backtraces()
check_for_core_dumps()


#
Expand Down

0 comments on commit 9e60a9d

Please sign in to comment.