[PATCH] libosmocore[master]: contrib/fsm-to-dot: warn and draw unallowed state transitions

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/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Sun Mar 25 00:51:41 UTC 2018


Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/7497

to look at the new patch set (#2).

contrib/fsm-to-dot: warn and draw unallowed state transitions

Hacked as it is, fsm-to-dot is capable of detecting action functions
transitioning to states that are not allowed according to the FSM definition
struct.

Draw those in dashed lines and output a warning.

Found these osmo-bsc gscon errors with this patch:

ERROR: gscon_fsm_active() triggers a transition to ST_WAIT_HO_COMPL, but this is not allowed by the FSM definition
ERROR: gscon_fsm_wait_ho_compl() triggers a transition to ST_WAIT_MDCX_BTS_HO, but this is not allowed by the FSM definition

Related: OS#3109
Change-Id: Ic6319a958b3c7247510c1930bac8b02b95f9dcf2
---
M contrib/fsm-to-dot.py
1 file changed, 7 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/97/7497/2

diff --git a/contrib/fsm-to-dot.py b/contrib/fsm-to-dot.py
index ce94a4e..10d73d0 100755
--- a/contrib/fsm-to-dot.py
+++ b/contrib/fsm-to-dot.py
@@ -379,9 +379,16 @@
       for to_state_name, event_name in transitions:
         if not event_name:
           continue
+        found = False
         for out_edge in state.out_edges:
           if out_edge.to_state.name == to_state_name:
             out_edge.add_event_name(event_name)
+            found = True
+        if not found:
+          sys.stderr.write(
+            "ERROR: %s() triggers a transition to %s, but this is not allowed by the FSM definition\n"
+            % (state.action, out_edge.to_state.name))
+          state.add_out_edge(Edge(fsm.find_state_by_name(to_state_name, True), event_name, 'dashed'))
 
     additional_states = []
 

-- 
To view, visit https://gerrit.osmocom.org/7497
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ic6319a958b3c7247510c1930bac8b02b95f9dcf2
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list