Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

verification/rvgen: Allow spaces in and events strings

Currently the automata parser assumes event strings don't have any
space, this stands true for event names, but can be a wrong assumption
if we want to store other information in the event strings (e.g.
constraints for hybrid automata).

Adapt the parser logic to allow spaces in the event strings.

Reviewed-by: Nam Cao <namcao@linutronix.de>
Link: https://lore.kernel.org/r/20260330111010.153663-4-gmonaco@redhat.com
Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>

+4 -5
+4 -5
tools/verification/rvgen/rvgen/automata.py
··· 127 127 # ------------ event is here ------------^^^^^ 128 128 if self.__dot_lines[cursor].split()[1] == "->": 129 129 line = self.__dot_lines[cursor].split() 130 - event = line[-2].replace('"','') 130 + event = "".join(line[line.index("label")+2:-1]).replace('"', '') 131 131 132 132 # when a transition has more than one lables, they are like this 133 133 # "local_irq_enable\nhw_local_irq_enable_n" 134 134 # so split them. 135 135 136 - event = event.replace("\\n", " ") 137 - for i in event.split(): 136 + for i in event.split("\\n"): 138 137 events.append(i) 139 138 cursor += 1 140 139 ··· 166 167 line = self.__dot_lines[cursor].split() 167 168 origin_state = line[0].replace('"','').replace(',','_') 168 169 dest_state = line[2].replace('"','').replace(',','_') 169 - possible_events = line[-2].replace('"','').replace("\\n", " ") 170 - for event in possible_events.split(): 170 + possible_events = "".join(line[line.index("label")+2:-1]).replace('"', '') 171 + for event in possible_events.split("\\n"): 171 172 matrix[states_dict[origin_state]][events_dict[event]] = dest_state 172 173 cursor += 1 173 174