[MERGED] libosmocore[master]: contrib/fsm-to-dot: allow transition from and to the same state

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
Mon Mar 26 13:03:20 UTC 2018


Neels Hofmeyr has submitted this change and it was merged.

Change subject: contrib/fsm-to-dot: allow transition from and to the same state
......................................................................


contrib/fsm-to-dot: allow transition from and to the same state

In osmo-bsc's new gscon FSM, there is an osmo_fsm_inst_state_chg() from
ST_ACTIVE to ST_ACTIVE. Avoid an exception triggering on this simple fact.

Change-Id: I420c7be84e3af555cc5e8bddbff7261013348375
---
M contrib/fsm-to-dot.py
1 file changed, 5 insertions(+), 3 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/contrib/fsm-to-dot.py b/contrib/fsm-to-dot.py
index 3e9678d..276fccc 100755
--- a/contrib/fsm-to-dot.py
+++ b/contrib/fsm-to-dot.py
@@ -205,9 +205,11 @@
           out_edge.add_events(edge.events)
           out_edge.add_actions(edge.actions)
           return
-      # sanity
-      if out_edge.to_state.get_label() == edge.to_state.get_label():
-        raise Exception('Two distinct states exist with identical labels.')
+      elif out_edge.to_state.get_label() == edge.to_state.get_label():
+        # sanity: there already is an edge to a state that a) is not identical to the target state of the
+        # newly added edge but b) has the same label.
+        raise Exception('Two distinct states exist with identical label: %r: states %r and %r.'
+                        % (out_edge.to_state.get_label(), out_edge.to_state, edge.to_state))
     state.out_edges.append(edge)
 
   def get_label(state):

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I420c7be84e3af555cc5e8bddbff7261013348375
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list