Project

General

Profile

Feature #2712

implement reproducible talloc context printout, i.e. without memory addresses

Added by neels over 1 year ago. Updated 10 days ago.

Status:
New
Priority:
Normal
Assignee:
Category:
libosmocore
Target version:
-
Start date:
12/06/2017
Due date:
% Done:

0%

Spec Reference:

Description

In some tests (e.g. osmo-msc/tests/msc_vlr/msc_vlr_tests.c) we want to expect a specific non-empty talloc context, and it would be best to print a summary and verify against it in test.ok or test.err output. However, the talloc_report* functions print memory addresses that change for every invocation, and hence cannot be used easily for automatic verification.

Implement a talloc table walker similar to what Vadim has done for the "show talloc-context" VTY code.

Use it in msc_vlr_tests.c to add to expected output, and remove that comment added in https://gerrit.osmocom.org/4927 aka If92a18bb3dc24c2cf6498aa2da29266267488240


Related issues

Related to OsmoBSC - Feature #2781: Extend OsmBSC TTCN-3 test coverage regarding resource leaksNew12/22/2017

History

#1 Updated by laforge about 1 year ago

  • Category set to libosmocore
  • Assignee set to Osmocom CNI Developers

This could also be useful in the context of TTCN3 tests. If there was a way to obtain a talloc report without address information via the VTY, it could be queried using the existing VTY interface code we have in TTCN3, in order to verify no memory leaks occurred during the execution of a given (or at some point, hopefully each) test case.

#2 Updated by Hoernchen 10 days ago

  • Assignee changed from Osmocom CNI Developers to Hoernchen

#3 Updated by fixeria 10 days ago

Some general tips / ideas:

  • the talloc_ctx_walk_cb() needs to be moved from libosmovty to libosmocore;
  • it should accept a pointer to the target char buffer instead of printing directly to the VTY;
  • it should accept a bitmask ('flags') where the caller can indicate whether to print addresses, references, etc. or not;
  • one of the flags (e.g. OSMO_BLABLA_F_VTY) should indicate the need to use VTY-specific new line symbol (i.e. VTY_NEWLINE).

#4 Updated by fixeria 10 days ago

Also, it would probably make sense to use osmo_strbuf API in talloc_ctx_walk_cb(), i.e. accept a pointer to struct osmo_strbuf *buf.

#5 Updated by laforge 3 days ago

  • Related to Feature #2781: Extend OsmBSC TTCN-3 test coverage regarding resource leaks added

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)