This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Max gerrit-no-reply at lists.osmocom.orgHello Jenkins Builder, Holger Freyther,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/1172
to look at the new patch set (#2).
Add logging and testing for FSM deallocation
osmo_fsm_inst_alloc() logs allocation but osmo_fsm_inst_free() is
silent. Fix this by adding log message for deallocation to make FSM
lifecycle tracking easier. Also make sure it's covered by test suite.
Change-Id: I7e5b55a1fff8e36cf61c7fb61d3e79c1f00e29d2
---
M src/fsm.c
M tests/fsm/fsm_test.c
2 files changed, 6 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/72/1172/2
diff --git a/src/fsm.c b/src/fsm.c
index 31ed194..a599a58 100644
--- a/src/fsm.c
+++ b/src/fsm.c
@@ -233,6 +233,7 @@
*/
void osmo_fsm_inst_free(struct osmo_fsm_inst *fi)
{
+ LOGPFSM(fi, "Deallocated\n");
osmo_timer_del(&fi->timer);
llist_del(&fi->list);
talloc_free(fi);
diff --git a/tests/fsm/fsm_test.c b/tests/fsm/fsm_test.c
index 84c2ae4..4a9be9d 100644
--- a/tests/fsm/fsm_test.c
+++ b/tests/fsm/fsm_test.c
@@ -89,7 +89,7 @@
.log_subsys = DMAIN,
};
-static int foo(void)
+static struct osmo_fsm_inst *foo(void)
{
struct osmo_fsm_inst *fi;
@@ -115,7 +115,7 @@
OSMO_ASSERT(fi->state == ST_TWO);
- return 0;
+ return fi;
}
static const struct log_info_cat default_categories[] = {
@@ -134,6 +134,7 @@
int main(int argc, char **argv)
{
struct log_target *stderr_target;
+ struct osmo_fsm_inst *finst;
osmo_fsm_log_addr(false);
@@ -145,11 +146,11 @@
g_ctx = NULL;
osmo_fsm_register(&fsm);
- foo();
+ finst = foo();
while (1) {
osmo_select_main(0);
}
-
+ osmo_fsm_inst_free(finst);
exit(0);
}
--
To view, visit https://gerrit.osmocom.org/1172
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I7e5b55a1fff8e36cf61c7fb61d3e79c1f00e29d2
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Holger Freyther <holger at freyther.de>
Gerrit-Reviewer: Jenkins Builder