Skip to content

Commit

Permalink
autotest: ensure no stray message listeners after test
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbarker committed Jun 23, 2021
1 parent 6a8ca9e commit 99c7d3a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Tools/autotest/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -5784,6 +5784,8 @@ def run_one_test_attempt(self, test, interact=False, attempt=1, do_fail_list=Tru

tee = TeeBoth(test_output_filename, 'w', self.mavproxy_logfile)

start_num_message_hooks = len(self.mav.message_hooks)

prettyname = "%s (%s)" % (name, desc)
self.start_test(prettyname)
self.set_current_test_name(name)
Expand Down Expand Up @@ -5856,6 +5858,12 @@ def run_one_test_attempt(self, test, interact=False, attempt=1, do_fail_list=Tru
(old_contexts_length, len(self.contexts)))
passed = False

# make sure we don't leave around stray listeners:
if len(self.mav.message_hooks) != start_num_message_hooks:
self.progress("Stray message listeners: %s" %
str(self.mav.message_hooks))
passed = False

if passed:
# self.remove_bin_logs() # can't do this as one of the binlogs is probably open for writing by the SITL process. If we force a rotate before running tests then we can do this. # noqa
pass
Expand Down

0 comments on commit 99c7d3a

Please sign in to comment.