mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 06:50:17 +00:00
tests: Look for zlog_backtrace in ci system
There are parts of our daemons that upon certain types of errors that a zlog_backtrace is auto-generated. It is desirable for this to be caught and have the test auto-failed. Issue: #13787 Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
parent
b35dbae2c2
commit
caa278d0c7
@ -297,6 +297,39 @@ def check_for_memleaks():
|
||||
pytest.fail("memleaks found for daemons: " + " ".join(daemons))
|
||||
|
||||
|
||||
def check_for_backtraces():
|
||||
backtraces = []
|
||||
tgen = get_topogen() # pylint: disable=redefined-outer-name
|
||||
latest = []
|
||||
existing = []
|
||||
|
||||
if tgen is not None:
|
||||
logdir = tgen.logdir
|
||||
if hasattr(tgen, "backtraces_existing_files"):
|
||||
existing = tgen.backtraces_existing_files
|
||||
latest = glob.glob(os.path.join(logdir, "*/*.log"))
|
||||
|
||||
daemons = []
|
||||
for vfile in latest:
|
||||
if vfile in existing:
|
||||
continue
|
||||
with open(vfile, encoding="ascii") as vf:
|
||||
vfcontent = vf.read()
|
||||
backtrace = vfcontent.count("Backtrace:")
|
||||
if backtrace:
|
||||
existing.append(vfile) # have backtrace don't check again
|
||||
emsg = "Backtrace found in {}, failing test".format(vfile)
|
||||
backtraces.append(emsg)
|
||||
|
||||
if tgen is not None:
|
||||
tgen.backtrace_existing_files = existing
|
||||
|
||||
if backtraces:
|
||||
logger.error("Backtraces found in test suite, erroring")
|
||||
logger.error(backtraces)
|
||||
pytest.fail("Backtraces found")
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True, scope="module")
|
||||
def module_autouse(request):
|
||||
basename = get_test_logdir(request.node.nodeid, True)
|
||||
@ -320,6 +353,7 @@ def module_check_memtest(request):
|
||||
if request.config.option.memleaks:
|
||||
if get_topogen() is not None:
|
||||
check_for_memleaks()
|
||||
check_for_backtraces()
|
||||
|
||||
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user